<p>I tried starting minikube using virtualbox, docker and hyperkit. For each case, I cannot access the nodeport.</p>
<p>My pods and services look good</p>
<pre><code>NAME                            READY   STATUS    RESTARTS   AGE
dbpostgresql-655654d6dd-mmgxk   1/1     Running   0          40m
tern-559c74bfb7-tqs96           1/1     Running   0          27m
test-pod                        1/1     Running   0          11m
</code></pre>
<hr />
<pre><code>NAME           TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
dbpostgresql   ClusterIP   10.102.194.214   &lt;none&gt;        5432/TCP         40m
kubernetes     ClusterIP   10.96.0.1        &lt;none&gt;        443/TCP          44m
tern           NodePort    10.102.162.15    &lt;none&gt;        8080:31905/TCP   19m
</code></pre>
<p>my minikube ip is 192.168.59.103</p>
<p>but when typing <a href="http://192.168.59.103:31905/" rel="nofollow noreferrer">http://192.168.59.103:31905/</a>
I am having site cannot be reached</p>
<p>here my deployment file</p>
<pre><code>    apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: tern
  name: tern
spec:
  replicas: 1
  selector:
    matchLabels:
      app: tern
  template:
    metadata:
      labels:
        app: tern
    spec:
      containers:
        - image: tern:6
          name: tern
          ports:
            - containerPort: 8080
</code></pre>
<p>here my service file</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: tern
spec:
  type: NodePort
  ports:
    - port: 8080
      targetPort: 8080
  selector:
    app.kubernetes.io/name: tern
</code></pre>

Judy1989
<p>The service is wrong, selector should be the same as matchLabels, change it to this:</p>
<pre><code>kind: Service
metadata:
  name: tern
spec:
  type: NodePort
  ports:
    - port: 8080
      targetPort: 8080
  selector:
    app: tern
</code></pre>
<p>After updating the service definition, perform a service describe to verify if the pod IP has been added to the endpoints. Next, validate from another pod whether the service is reachable. Additionally, on the same VM, check if the NodePort is accessible using either 'localhost' or the node's IP. Finally, from your localhost, add a port forward from the VM to your local machine, and then confirm if the service is accessible.</p>
