lima icon indicating copy to clipboard operation
lima copied to clipboard

Forwarded port accessible only on localhost

Open matteosilv opened this issue 3 years ago • 1 comments

Description

I started a new lima vm with the k8s.yaml manifest.

I'm able to browse a Kubernetes service of type LoadBalancer exposed on port 30674 but only on localhost:

curl http://127.0.0.1:30674

If I try on the local network interface en0 ip I got a connection refused:

curl http://192.168.1.126:30674

matteosilv avatar Apr 01 '22 14:04 matteosilv

Please use the "Bug" template to report issues and fill in all the details regarding to OS and RD versions etc.

From the interface name "en0" I gather that you are on macOS, where Rancher Desktop will attempt to create a bridged network and use that for your cluster, so it has its own IP address and no port conflicts with the host.

Run kubectl get svc -A and check the external IP of your LoadBalancer.

jandubois avatar Apr 01 '22 16:04 jandubois

I have the same issue, tried with k3s, even the port on mac bind to 0.0.0.0, it can only be accessed with localhost or 127.0.0.1

unidevel avatar Nov 16 '22 06:11 unidevel

You can change the hostIP to 0.0.0.0 in the yaml

https://github.com/lima-vm/lima/blob/3c9eb1b8906f911b7273e455d06a4cfd891203ab/examples/default.yaml#L314-L318

AkihiroSuda avatar Nov 21 '22 09:11 AkihiroSuda