<p>I set up a single node cluster using minikube. I have also configured a client pod inside this node and also a nodeport service to access the pod. But the service is unreachable on browser.</p>

<p>Below are the config files for client pod and the nodeport service:</p>

<p><strong>client-pod.yaml</strong></p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: client-pod
  labels:
    component:web
spec:
  containers:
    - name: client
      image: stephengrider/multi-worker
      ports:
        - containerPort: 9999
</code></pre>

<p><strong>client-node-port.yaml</strong></p>

<pre><code>kind: Service
metadata:
    name: client-node-port
spec:
    type: NodePort
    ports:
        - port: 3050
          targetPort: 3000
          nodePort: 31515
    selector:
        component:web
</code></pre>

<p>I can see the status of both the pod and the service as running when I run the below commands:</p>

<pre><code>&gt; kubectl get pods

NAME                              READY   STATUS    RESTARTS   AGE
client-pod                        1/1     Running   0          60m

</code></pre>

<pre><code>&gt; kubectl get services

NAME               TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
client-node-port   NodePort    10.99.14.107   &lt;none&gt;        3050:31515/TCP   63m


</code></pre>

<p>Then I found out the service url on the minikube cluster:</p>

<pre><code>&gt; minikube service list

|-------------|------------------|-----------------------------|
|  NAMESPACE  |       NAME       |             URL             |
|-------------|------------------|-----------------------------|
| default     | client-node-port | http://192.168.99.101:31515 |
| default     | hello-minikube   | http://192.168.99.101:31324 |
| default     | kubernetes       | No node port                |
| kube-system | kube-dns         | No node port                |
|-------------|------------------|-----------------------------|

</code></pre>

<p>I was able to access hello-minikube service with the URL mentioned against it in the table. But I could not access the client-node-port service and it just says:</p>

<pre><code>This site can’t be reached192.168.99.101 refused to connect.
</code></pre>

<p>How do I proceed?</p>

<blockquote>
  <p>ContainerPort is used to decide which of the container's ports should be used by the service.</p>
  
  <p>The target port on svc spec specifies which port the service should hit when a request arrives.</p>
</blockquote>

<pre><code>spec:
  containers:
    - name: client
      image: stephengrider/multi-worker
      ports:
        - containerPort: 3000
</code></pre>

<p>Since the <code>stephengrider/multi-worker</code> image you're using used <code>3000</code> as default port, set <code>containerPort</code> to <code>3000</code>. Update the pod yaml. It should work. </p>

<p>N.B: You should always target those ports from your service that are valid from pod's side.</p>
