How to access application deployed in minikube remotely

11/23/2020

I am using kubernetes to deploy my application on minikube. After deploying using command

minikube service helloworld-all-service --url

Which shows some URL to access the application. Something like

http://192.168.49.2:32474

I was to access this application from a different machine on the same network. I tried port-forwarding

kubectl port-forward service/helloworld-all-service 8080:8080

This allowed me access application using localhost:8080/myApp. But when I tried using my system IP it didn't work 10.14.77.88:8080/myApp. What am I doing wrong here

-- Pranjal Doshi
docker
kubernetes
minikube

1 Answer

11/23/2020

Normally the port is only bound to localhost, to make it also available on the external address you need to specify the bind address (0.0.0.0 binds to all interfaces on the machine):

kubectl port-forward --address 0.0.0.0 service/helloworld-all-service 8080:8080
-- Henry
Source: StackOverflow