Kubernetes 想要将pod与集群通信以运行一些kubectl命令
我试图从pod内部运行kubectl命令,以便与集群通信,并在通过延长的宽限期将pod保持在删除状态后,通过监视脚本删除--graceperiod=0的pod,以保持pod删除与prestop挂钩。但无法连接到群集IP,也无法ping pod本身Kubernetes 想要将pod与集群通信以运行一些kubectl命令,kubernetes,Kubernetes,我试图从pod内部运行kubectl命令,以便与集群通信,并在通过延长的宽限期将pod保持在删除状态后,通过监视脚本删除--graceperiod=0的pod,以保持pod删除与prestop挂钩。但无法连接到群集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: conne
[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上网络组件在pod中处于终止状态,无法与群集通信。我强烈建议您使用它们来寻址pod和服务,而不是像您现在使用的那样使用全局pod和服务。如果问题仍然存在,请更改并通知我。