macos - unable to access minikube service ports when using tunnel - Stack Overflow

admin2025-04-29  1

I have minikube up and running on OSX using VMWare Fusion. Things seem to be working as expected except for one issue.

If I use kubectl get services I see:

imac:h2spec robertengels$ kubectl get services
NAME              TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
httpserver-node   LoadBalancer   10.105.199.106   <pending>     8080:31664/TCP   118m
kubernetes        ClusterIP      10.96.0.1        <none>        443/TCP          47h

If I use minikube service httpserver-node --url I see:

http://192.168.158.129:31664

and I can successfully access the url in the browser.

If I then run minikube tunnel and after entering my password I see:

Status: 
    machine: minikube
    pid: 13476
    route: 10.96.0.0/12 -> 192.168.158.129
    minikube: Running
    services: [httpserver-node]
    errors: 
        minikube: no errors
        router: no errors
        loadbalancer emulator: no errors

and if I run kubectl get services I see:

NAME              TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)          AGE
httpserver-node   LoadBalancer   10.105.199.106   10.105.199.106   8080:31664/TCP   137m
kubernetes        ClusterIP      10.96.0.1        <none>           443/TCP          2d

but the service is not available at 10:105.199.106:8080 ??? (This is my issue/lack of understanding).

If I then run kubectl port-forward service/httpserver-node 8080:8080 I can successfully access the service at http://localhost:8080

Why is the service not available at 10.105.199.106:8080 when the tunnel is up? When I check netstat -rn I don't see a route to 10.105.199.106...

I expect to be able to access the service at the 'EXTERNAL_IP' according to the documentation here in the 'LoadBalancer access' section.

I have minikube up and running on OSX using VMWare Fusion. Things seem to be working as expected except for one issue.

If I use kubectl get services I see:

imac:h2spec robertengels$ kubectl get services
NAME              TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
httpserver-node   LoadBalancer   10.105.199.106   <pending>     8080:31664/TCP   118m
kubernetes        ClusterIP      10.96.0.1        <none>        443/TCP          47h

If I use minikube service httpserver-node --url I see:

http://192.168.158.129:31664

and I can successfully access the url in the browser.

If I then run minikube tunnel and after entering my password I see:

Status: 
    machine: minikube
    pid: 13476
    route: 10.96.0.0/12 -> 192.168.158.129
    minikube: Running
    services: [httpserver-node]
    errors: 
        minikube: no errors
        router: no errors
        loadbalancer emulator: no errors

and if I run kubectl get services I see:

NAME              TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)          AGE
httpserver-node   LoadBalancer   10.105.199.106   10.105.199.106   8080:31664/TCP   137m
kubernetes        ClusterIP      10.96.0.1        <none>           443/TCP          2d

but the service is not available at 10:105.199.106:8080 ??? (This is my issue/lack of understanding).

If I then run kubectl port-forward service/httpserver-node 8080:8080 I can successfully access the service at http://localhost:8080

Why is the service not available at 10.105.199.106:8080 when the tunnel is up? When I check netstat -rn I don't see a route to 10.105.199.106...

I expect to be able to access the service at the 'EXTERNAL_IP' according to the documentation here in the 'LoadBalancer access' section.

Share Improve this question asked Jan 7 at 0:52 robert engelsrobert engels 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Not sure if you consider this to answer your minikube question, but I like the way that KIND clusters provide a development option that acts more like deployed clusters eg in AWS.

Install a KIND cluster:

kind create cluster

Download and run the cloud provider binary which watches for services of type load balancer and creates an external load balancer (a Docker container running envoyproxy).

sudo ./cloud-provider-kind

The service then gets an external IP address which you can call directly. No need for developer workarounds to get an external IP. You can also map the external IP to a fictonal domain in your /etc/hosts file and call that instead.

10.105.199.106 mydomain.com

I find KIND's load balancing support very useful for rehearsing deployments to real systems locally.

转载请注明原文地址:http://anycun.com/QandA/1745936719a91360.html