Bind K8s ingress/load balancer to 127.0.0.1 instead of 0.0.0.0

11/23/2020

When I run a local cluster using Docker for Window's built-in Kubernetes server, and install the Nginx ingress, the server is accessible on the entire local network. How can I bind the server to the loopback address (127.0.0.1) only so that it is not accessible?

I tried setting the Nginx's LoadBalancer service's loadBalancerIp to 127.0.0.1 but that didn't work.

-- Code
kubernetes
kubernetes-ingress
nginx

1 Answer

11/24/2020

I worked around this by switching to Kind (instead of Docker Desktop's K8s). It allows specifying listenAddress=127.0.0.1 when creating a cluster.

-- Code
Source: StackOverflow