<p>I am not be able to access my service from my local machine. I had done my k8 deployment using minikube and created a service of NodePort type to access it.</p>

<pre><code>C:\WINDOWS\system32&gt;kubectl get deployments
NAME                 READY   UP-TO-DATE   AVAILABLE   AGE
fromk8dashboard      2/2     2            2           25m
</code></pre>

<p>And the service </p>

<pre><code>C:\WINDOWS\system32&gt;kubectl get svc
NAME              TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)           AGE
fromk8dashboard   NodePort    10.100.68.204    &lt;none&gt;        31000:32058/TCP   26m
kubernetes        ClusterIP   10.96.0.1        &lt;none&gt;        443/TCP           24h
</code></pre>

<p>When I run the command:</p>

<pre><code>C:\WINDOWS\system32&gt;minikube service fromk8dashboard
|-----------|-----------------|--------------------------|----------------------------|
| NAMESPACE |      NAME       |       TARGET PORT        |            URL             |
|-----------|-----------------|--------------------------|----------------------------|
| default   | fromk8dashboard | tcp-31000-80-6bw28/31000 | http://172.26.75.182:32058 |
|-----------|-----------------|--------------------------|----------------------------|
* Opening service default/fromk8dashboard in default browser...
</code></pre>

<p>This opens the url "<a href="http://172.26.75.182:32058" rel="nofollow noreferrer">http://172.26.75.182:32058</a>" on browser but it shows <strong>the site cannot be reached</strong>. Am I missing some config or proxy settings?</p>

<p>Another query is, my kubernetes dashboard is running on "<a href="http://127.0.0.1:61750/" rel="nofollow noreferrer">http://127.0.0.1:61750/</a>", so shouldn't the service nodeport url be <a href="http://127.0.0.1:32058/" rel="nofollow noreferrer">http://127.0.0.1:32058/</a> or localhost:32058 ?</p>

<p>Describe service returns the below result:</p>

<pre><code>C:\WINDOWS\system32&gt;kubectl describe svc fromk8dashboard
Name:                     fromk8dashboard
Namespace:                default
Labels:                   k8s-app=fromk8dashboard
Annotations:              &lt;none&gt;
Selector:                 k8s-app=fromk8dashboard
Type:                     NodePort
IP:                       10.100.68.204
Port:                     tcp-31000-80-6bw28  31000/TCP
TargetPort:               80/TCP
NodePort:                 tcp-31000-80-6bw28  32058/TCP
Endpoints:                172.17.0.7:80,172.17.0.8:80
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;



C:\WINDOWS\system32&gt;kubectl describe pod fromk8dashboard-6f98f9468c-wjrd5
Name:           fromk8dashboard-6f98f9468c-wjrd5
Namespace:      default
Priority:       0
Node:           minikube/172.26.75.182
Start Time:     Tue, 12 May 2020 17:43:05 +0530
Labels:         k8s-app=fromk8dashboard
                pod-template-hash=6f98f9468c
Annotations:    &lt;none&gt;
Status:         Running
IP:             172.17.0.8
Controlled By:  ReplicaSet/fromk8dashboard-6f98f9468c
Containers:
  fromk8dashboard:
    Container ID:   docker://eef3ecc8e564d9439b66592aa2f1eebd0a886e6380986066ae61bb00193c3687
    Image:          ranjit1827/niguel
    Image ID:       docker-pullable://ranjit1827/niguel@sha256:b9229b2fdc7e5e3e9872189b3840f3c6f23d312af1bff9bbf5a5c68428be5894
    Port:           &lt;none&gt;
    Host Port:      &lt;none&gt;
    State:          Running
      Started:      Tue, 12 May 2020 17:43:30 +0530
    Ready:          True
    Restart Count:  0
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-rn7lm (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  default-token-rn7lm:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-rn7lm
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:          &lt;none&gt;
</code></pre>

<p>My service yaml below:</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: fromk8dashboard
  namespace: default
  selfLink: /api/v1/namespaces/default/services/fromk8dashboard
  uid: 406e99ce-dec1-4e80-91aa-84f75c2d9892
  resourceVersion: '70115'
  creationTimestamp: '2020-05-12T12:13:05Z'
  labels:
    k8s-app: fromk8dashboard
  managedFields:
    - manager: dashboard
      operation: Update
      apiVersion: v1
      time: '2020-05-12T12:13:41Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:labels':
            .: {}
            'f:k8s-app': {}
        'f:spec':
          'f:externalTrafficPolicy': {}
          'f:ports':
            .: {}
            'k:{"port":31000,"protocol":"TCP"}':
              .: {}
              'f:name': {}
              'f:port': {}
              'f:protocol': {}
              'f:targetPort': {}
          'f:selector':
            .: {}
            'f:k8s-app': {}
          'f:sessionAffinity': {}
          'f:type': {}
spec:
  ports:
    - name: tcp-31000-80-6bw28
      protocol: TCP
      port: 31000
      targetPort: 80
      nodePort: 32058
  selector:
    k8s-app: fromk8dashboard
  clusterIP: 10.100.68.204
  type: NodePort
  sessionAffinity: None
  externalTrafficPolicy: Cluster
status:
  loadBalancer: {}
</code></pre>

Ranjit Mattamal
<p>Use below yaml and you should be to access it via <code>http://172.26.75.182:30007/</code></p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: NodePort
  selector:
    k8s-app: fromk8dashboard
  ports:
      # By default and for convenience, the `targetPort` is set to the same value as the `port` field.
    - port: 80
      targetPort: 80
      # Optional field
      # By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767)
      nodePort: 30007
</code></pre>

<p>Check the <a href="https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/" rel="nofollow noreferrer">guide</a> for exposing pod via nodeport service.</p>
