how to access the service located in minikube from outside

5/28/2020

I've created a service inside a minikube (192.168.64.2) running on my PC (172.10.10.2) and launched an Ingress service, so I can access that service from my PC (172.10.10.2) with minikube ip (192.168.64.2). But I also want to access that service from the other PC (172.10.10.100), how can I achieve this goal?

-- Packy
kubernetes
minikube
nginx-ingress

1 Answer

5/28/2020

you can do port-forward and if both PC in the same network you can access port over PC IP address. if required you can use Nginx also to access specific routes.

In docker run container with port-forwarding

docker run -p 5000:containerport <image name>

Get minikube PC IP

access this IP from another PC and use Port : 5000

this will if both in same network. if required you can use nginx.

Update :

if you are on Kubernetes you can use

kubectl port-forward svc/<service-name> 5000:<container-port>

kubectl port-forward pod/<pod-name> 5000:<container-port>
-- Harsh Manvar
Source: StackOverflow