<p>I want to deploy a simple nginx app on my own kubernetes cluster. </p>

<p>I used the basic nginx deployment. On the machine with the ip <code>192.168.188.10</code>. It is part of cluster of 3 raspberries. </p>

<pre><code>NAME         STATUS   ROLES    AGE     VERSION
master-pi4   Ready    master   2d20h   v1.18.2
node1-pi4    Ready    &lt;none&gt;   2d19h   v1.18.2
node2-pi3    Ready    &lt;none&gt;   2d19h   v1.18.2


$ kubectl create deployment nginx --image=nginx                                                                                                        
deployment.apps/nginx created

$ kubectl create service nodeport nginx --tcp=80:80                                                                                                          
service/nginx created

$ kubectl get pods                                                                                                                                        
NAME                      READY   STATUS    RESTARTS   AGE
my-nginx-8fb6d868-6957j   1/1     Running   0          10m
my-nginx-8fb6d868-8c59b   1/1     Running   0          10m
nginx-f89759699-n6f79     1/1     Running   0          4m20s

$ kubectl describe service nginx                                                                                                                              
Name:                     nginx
Namespace:                default
Labels:                   app=nginx
Annotations:              &lt;none&gt;
Selector:                 app=nginx
Type:                     NodePort
IP:                       10.98.41.205
Port:                     80-80  80/TCP
TargetPort:               80/TCP
NodePort:                 80-80  31400/TCP
Endpoints:                &lt;none&gt;
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;


</code></pre>

<p>But I always get a time out </p>

<pre><code>$ curl http://192.168.188.10:31400/                                                                                                                     
curl: (7) Failed to connect to 192.168.188.10 port 31400: Connection timed out
</code></pre>

<p>Why is the web server nginx not reachable? I tried to run it from the same machine I deployed it to? How can I make it accessible from an other machine from the network on port <code>31400</code>? </p>

A.Dumas
<p>As mentioned by @suren, you are creating a stand-alone service without any link with your deployment.</p>

<p>You can solve using the command from suren answer, or creating a new deployment using the follow yaml spec:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - name: http
          containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-svc
spec:
  type: NodePort
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
</code></pre>

<p>After, type <code>kubectl get svc</code> to get the nodeport to access your service.</p>

<p><code>nginx-svc    NodePort    10.100.136.135   &lt;none&gt;        80:31816/TCP   34s</code></p>

<p>To access use <code>http://&lt;YOUR_NODE_IP&gt;:31816</code></p>
