简体   繁体   English

将 K8s 入口/负载均衡器绑定到 127.0.0.1 而不是 0.0.0.0

[英]Bind K8s ingress/load balancer to 127.0.0.1 instead of 0.0.0.0

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.当我使用 Docker for Window 的内置 Kubernetes 服务器运行本地集群,并安装 Nginx 入口时,该服务器在整个本地网络上都可以访问。 How can I bind the server to the loopback address (127.0.0.1) only so that it is not accessible?如何将服务器绑定到环回地址 (127.0.0.1) 使其无法访问?

I tried setting the Nginx's LoadBalancer service's loadBalancerIp to 127.0.0.1 but that didn't work.我尝试将 Nginx 的 LoadBalancer 服务的loadBalancerIp127.0.0.1但这没有用。

I worked around this by switching to Kind (instead of Docker Desktop's K8s).我通过切换到 Kind(而不是 Docker Desktop 的 K8s)来解决这个问题。 It allows specifying listenAddress=127.0.0.1 when creating a cluster.它允许在创建集群时指定listenAddress=127.0.0.1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM