How to access kubernetes service on localhost with Docker for Windows How to access kubernetes service on localhost with Docker for Windows kubernetes kubernetes

How to access kubernetes service on localhost with Docker for Windows


There are two ways to expose a service to the outer world from a Kubernetes cluster:

  1. type: LoadBalancer. However, it works only with cloud providers.

  2. type: NodePort. As you used in this case. Now, to access service inside Kubernetes cluster, you need to use the IP address of one of your Nodes and the port from the field nodePortFor example, 12.34.56.78:30001

For more information, look through the official documentation.


For local development:

kubectl port-forward <my-pod-name> 8080:8080

Your pod will be accessible on localhost:8080.

More about port forwarding here.