<p>So I've read a bunch of these similar questions/issues on stackoverflow and I understand it enough but not sure what I am missing.</p>
<p>deployment.yml</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  namespace: dev-namespace
  labels:
    web: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      web: nginx
  template:
    metadata:
      labels:
        web: nginx
    spec:
      containers:
        - name: nginx
          image: nginx
          ports:
            - containerPort: 8080
</code></pre>
<p>service.yml</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  type: NodePort
  selector:
    web: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
</code></pre>
<p>This is my <em>minikube ip</em>:</p>
<pre><code>$ minikube ip
192.168.49.2
</code></pre>
<p>This is the service</p>
<pre><code>$ kubectl get service
NAME            TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
nginx-service   NodePort   10.104.139.228   &lt;none&gt;        80:30360/TCP   14
</code></pre>
<p>This is the deployment</p>
<pre><code>$ kubectl get deployments.apps
NAME               READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deployment   2/2     2            2           14h
</code></pre>
<p>This is the pods</p>
<pre><code>$ kubectl get pods -o wide
NAME                                READY   STATUS    RESTARTS   AGE   IP           NODE       NOMINATED NODE   READINESS GATES
nginx-deployment-5b78696cc8-9fpmr   1/1     Running   0          14h   172.17.0.6   minikube   &lt;none&gt;           &lt;none&gt;
nginx-deployment-5b78696cc8-h4m72   1/1     Running   0          14h   172.17.0.4   minikube   &lt;none&gt;           &lt;none&gt;
</code></pre>
<p>This is the endpoints</p>
<pre><code>$ kubectl get endpoints
NAME            ENDPOINTS                         AGE
nginx-service   172.17.0.4:8080,172.17.0.6:8080   14h
</code></pre>
<p>But when I try to <em>curl 10.104.139.228:30360</em> it just hangs. When I try to <em>curl 192.168.49.2:30360</em> I get the <em>Connection refused</em></p>
<p>I am sure that using <em>NodePort</em> means I need to use the <em>node</em> ip and that would be the server's local IP since I am using <em>minikube</em> and <em>control plane</em> and <em>worker</em> are in the same server.</p>
<p>What am I missing here? Please help, this is driving me crazy. I should mention that I am able to <em>kubectl exec -ti pod-name -- /bin/bash</em> and if I do a <em>curl localhost</em> I do get the famous response &quot;Welcome to NGINX&quot;</p>

eljoeyjojo
<p>Nevermind :/ I feel very foolish I see that the mistake was the container ports :/ my <em>nginx</em> pods are listening on port 80 not port 8080</p>
<p>For anyone out there, I updated my config files to this:</p>
<p>service.yml</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: nginx-service
  namespace: busy-qa
spec:
  type: NodePort
  selector:
    web: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
</code></pre>
<p>deployment.yml</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  namespace: busy-qa
  labels:
    web: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      web: nginx
  template:
    metadata:
      labels:
        web: nginx
    spec:
      containers:
        - name: nginx
          image: nginx
          ports:
            - containerPort: 80
</code></pre>
<p>Now when I <em>curl</em> I get the NGINX response</p>
<pre><code>$ curl 192.168.49.2:31168
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Welcome to nginx!&lt;/title&gt;
&lt;style&gt;
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Welcome to nginx!&lt;/h1&gt;
&lt;p&gt;If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.&lt;/p&gt;

&lt;p&gt;For online documentation and support please refer to
&lt;a href=&quot;http://nginx.org/&quot;&gt;nginx.org&lt;/a&gt;.&lt;br/&gt;
Commercial support is available at
&lt;a href=&quot;http://nginx.com/&quot;&gt;nginx.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thank you for using nginx.&lt;/em&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
