根据 DNS 无法从 pods 的容器访问 kubernetes master

Can not access kubernetes master from the container of pods according DNS

我在 kubernetes 中使用 DNS。测试结果如下:

core@core-1-86 ~ $ kubectl exec busybox -- nslookup kubernetes
Server:    10.100.0.10
Address 1: 10.100.0.10

Name:      kubernetes
Address 1: 10.100.0.1

然后我进入 busybox 容器,并 ping kubernetes,如:

core@core-1-86 ~ $ kubectl exec -it busybox sh
/ # ping kubernetes
PING kubernetes (10.100.0.1): 56 data bytes
^C
--- kubernetes ping statistics ---
55 packets transmitted, 0 packets received, 100% packet loss
/ #

如果我 ping 另一个 ip,就可以了!

/ # ping 10.12.1.85
PING 10.12.1.85 (10.12.1.85): 56 data bytes
64 bytes from 10.12.1.85: seq=0 ttl=63 time=0.262 ms
64 bytes from 10.12.1.85: seq=1 ttl=63 time=0.218 ms
^C
--- 10.12.1.85 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.218/0.240/0.262 ms
/ #

谁能帮帮我,告诉我为什么?

kubernetes 服务是一个虚拟 IP,目前不处理 ICMP 请求(参见#2259)。您应该能够使用 TCP 连接验证与 kubernetes 服务的连接,例如curl https://kubernetes/