您好,请问一下进入pod报错.
来源:10-4 k8s调度的最小单位pod(下)
Alan_Z
2020-05-09
[root@node1 ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-busybox 2/2 Running 0 17m
[root@node1 ~]# kubectl exec nginx-busybox -c busybox /bin/sh
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl kubectl exec [POD] – [COMMAND] instead.
error: unable to upgrade connection: pod does not exist
[root@node1 ~]#
3回答
-
麦兜搞IT
2020-06-08
➜ pod git:(master) ✗ kubectl get pod NAME READY STATUS RESTARTS AGE nginx-busybox 2/2 Running 0 3m32s ➜ pod git:(master) ✗ kubectl exec -it nginx-busybox -c nginx bin/sh # # # exit ➜ pod git:(master) ✗ ➜ pod git:(master) ✗ ➜ pod git:(master) ✗ kubectl exec -it nginx-busybox -c busybox bin/sh / # / # / # ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1000 link/sit 0.0.0.0 brd 0.0.0.0 12: eth0@if13: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue link/ether 02:42:ac:11:00:05 brd ff:ff:ff:ff:ff:ff inet 172.17.0.5/16 brd 172.17.255.255 scope global eth0 valid_lft forever preferred_lft forever / #
-c 可以指定到底进入那个container
00 -
Alan_Z
提问者
2020-05-11
[root@node1 ~]# kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:56:40Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
[root@node1 ~]# kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:56:40Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:48:36Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
[root@node1 ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx 1/1 Running 1 42h
nginx-busybox 2/2 Running 0 8m9s
[root@node1 ~]# kubectl exec -it nginx-busybox bin/sh
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl kubectl exec [POD] -- [COMMAND] instead.
Defaulting container name to nginx.
Use 'kubectl describe pod/nginx-busybox -n default' to see all of the containers in this pod.
error: unable to upgrade connection: pod does not exist
00 -
麦兜搞IT
2020-05-10
试试 kubectl exec -it nginx-busybox bin/sh
012020-06-08
相似问题