How to run kubernetes service in web browser?

12/25/2019

I have create a docker image of nodejs app and create a deployment on kubernetes and expose the deployment to the kubernetes service.

when i run kubectl get svc it shows External ip >>localhost and Ports>>3000:30316/TCP but when i put localhost:3000 in broswer it didn't work.

-- Tabish
devops
docker
kubernetes

1 Answer

12/25/2019

If your service is NortPort type then you can access your app from outside of the cluster by using http://<Node IP>:<port>. Here, if you use minikube(node ip -> 192.168.99.100) and port is 30316 then you can try by using this: http://192.168.99.100:30316.

You can also access your app by using the port-forward mechanism.

following procedure:

  • kubectl port-forward -n <namespace> <deployment pod name> :<deployment C ontainerPort>

  • http://localhost:<forwarded port>

-- Sayf Uddin Al Azad Sagor
Source: StackOverflow