简体   繁体   中英

How to access NodePort in Minikube with docker driver?

I launched minikube with the docker driver on a remote machine and I have used a nodePort service for a particular pod. I believe nodePort exposes the port on the minikube docker container. On doing minikube IP it gave me the IP of the docker container in which minikube runs. How can I port map the port from the minnikube container to the host port so that I can access it remotely. A different approach would other than using driver=none or restarting minikube is appreciated as I do not want to restart my spinnaker cluster.

There is a minikube service <SERVICE_NAME> --url command which will give you a url where you can access the service. In order to open the exposed service, the minikube service <SERVICE_NAME> command can be used:

$ minikube service example-minikube
Opening kubernetes service default/hello-minikube in default browser...

This command will open the specified service in your default browser.

There is also a --url option for printing the url of the service which is what gets opened in the browser:

$ minikube service example-minikube --url
http://192.168.99.100:31167

You can run minikube service list to get list of all available services with their corresponding URL's. Also make sure the service points to correct pod by using correct selector .

Try also to execute command:

ssh -i ssh -i ~/.minikube/machines/minikube/id_rsa docker@$(minikube ip) -L *:30000:0.0.0.0:30000

Take a look: minikube-service-port-forward , expose-port-minikube , minikube-service-documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM