请教老师,为什么在我使用的node上无法执行kubectl exec -it 无法进入pod中?
[root@VM-8-15-centos docs]# kubectl get pod -n ingress-nginx
NAME READY STATUS RESTARTS AGE
nginx-ingress-controller-84865c44d9-rxr4p 1/1 Running 0 17m
但是执行exec命令时报错:
[root@VM-8-15-centos docs]# kubectl exec -it nginx-ingress-controller-84865c44d9-rxr4p sh -n ingress-nginx
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
Error from server: error dialing backend: dial tcp 172.16.0.11:10250: i/o timeout
然后为了研究是哪里出了问题,我检查到底是什么问题。于是,找到6-2nginx-deplyment.yaml 创建的pod实验,执行:
[root@VM-8-15-centos docs]# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
my-nginx-6d97ddfff5-cwbl2 1/1 Running 0 99m 10.244.1.11 vm-0-11-centos <none> <none>
my-nginx-6d97ddfff5-wgxjp 1/1 Running 0 99m 10.244.2.20 vm-8-15-centos <none> <none>
但是执行exec的时候也都是timeout
[root@VM-8-15-centos docs]# kubectl exec -it my-nginx-6d97ddfff5-wgxjp sh
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
Error from server: error dialing backend: dial tcp 10.0.8.15:10250: i/o timeout
[root@VM-8-15-centos docs]# kubectl exec -it my-nginx-6d97ddfff5-cwbl2 sh
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
Error from server: error dialing backend: dial tcp 172.16.0.11:10250: i/o timeout