我正在尝试在pod内部运行kubectl命令以与集群通信并通过监视脚本在--graceperiod = 0的情况下通过扩展宽限期将pod保持在删除状态以通过prestop挂钩来保持pod删除,从而删除pod 。但是无法连接到群集IP,也无法ping Pod本身。
[root@pod01 /]# kubectl exec dnsutils cat /etc/resolv.conf
Unable to connect to the server: dial tcp 196.19.0.1:443: connect: network is unreachable
[root@pod01 /]# cat /etc/resolv.conf
nameserver 196.19.0.2
search namespace.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
[root@pod01 /]# kubectl exec -ti dnsutils -- nslookup kubernetes.default
Unable to connect to the server: dial tcp 196.19.0.1:443: connect: network is unreachable
[root@pod01 /]# ping namespace.svc.cluster.local
ping: namespace.svc.cluster.local: Name or service not known
[root@pod01 /]# ^C
[root@pod01 /]# nslookup Cluster_IP
bash: nslookup: command not found
[root@pod01 /]# ping Cluster_IP port
connect: Network is unreachable
[root@pod01 /]# cat /etc/hosts
# Kubernetes-managed hosts file.
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
196.18.9.8 pod01
[root@pod01 /]# ping 196.18.9.8
connect: Network is unreachable
[root@pod01 /]# nslookup 196.18.9.8
bash: nslookup: command not found
[root@pod01 /]# ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.014 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.013 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.015 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.015 ms
^C
--- localhost ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3065ms
有什么帮助吗??我无法运行其中任何一个来使Pod与外界进行交互,而我使用的是CentOS 7
答案 0 :(得分:0)
网络组件处于处于终止状态的Pod中,无法与集群通信。