老师,我这里有个问题,安装完了,已经建立了nginx-busybox,但是,kubectl exec时报错,不知是什么错误

来源:12-3 搭建GitLab CI服务器和Pipeline演示

qq_罗_1

2021-04-03

老师,我这里有个问题,安装完了,已经建立了nginx-busybox,但是,kubectl exec时报错,不知是什么错误
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use 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

写回答

1回答

qq_罗_1

提问者

2021-04-03

sudo kubectl describe pod nginx-busybox

Name:         nginx-busybox

Namespace:    default

Priority:     0

Node:         k8s-node2/10.0.2.15

Start Time:   Sat, 03 Apr 2021 08:24:22 +0000

Labels:       <none>

Annotations:  <none>

Status:       Running

IP:           10.32.0.2

IPs:

  IP:  10.32.0.2

Containers:

  nginx:

    Container ID:   docker://b5efa87b2a1304293c302f1a2c11173d3b53faf5dff844a82259a4ccc68a7462

    Image:          nginx

    Image ID:       docker-pullable://nginx@sha256:bae781e7f518e0fb02245140c97e6ddc9f5fcf6aecc043dd9d17e33aec81c832

    Port:           80/TCP

    Host Port:      0/TCP

    State:          Running

      Started:      Sat, 03 Apr 2021 08:28:59 +0000

    Ready:          True

    Restart Count:  0

    Environment:    <none>

    Mounts:

      /var/run/secrets/kubernetes.io/serviceaccount from default-token-5s5ft (ro)

  busybox:

    Container ID:  docker://a41922d9395a1b78d2327f86c29f247f5ed9763f8130fd36fc0d88c859365560

    Image:         busybox

    Image ID:      docker-pullable://busybox@sha256:ce2360d5189a033012fbad1635e037be86f23b65cfd676b436d0931af390a2ac

    Port:          <none>

    Host Port:     <none>

    Command:

      /bin/sh

    Args:

      -c

      while true; do echo hello; sleep 10;done

    State:          Running

      Started:      Sat, 03 Apr 2021 08:27:17 +0000

    Ready:          True

    Restart Count:  0

    Environment:    <none>

    Mounts:

      /var/run/secrets/kubernetes.io/serviceaccount from default-token-5s5ft (ro)

Conditions:

  Type              Status

  Initialized       True

  Ready             True

  ContainersReady   True

  PodScheduled      True

Volumes:

  default-token-5s5ft:

    Type:        Secret (a volume populated by a Secret)

    SecretName:  default-token-5s5ft

    Optional:    false

QoS Class:       BestEffort

Node-Selectors:  <none>

Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s

                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s

Events:

  Type     Reason     Age                From               Message

  ----     ------     ----               ----               -------

  Normal   Scheduled  13m                default-scheduler  Successfully assigned default/nginx-busybox to k8s-node2

  Warning  Failed     10m                kubelet            Failed to pull image "nginx": rpc error: code = Unknown desc = context canceled

  Warning  Failed     10m                kubelet            Error: ErrImagePull

  Normal   Pulling    10m                kubelet            Pulling image "busybox"

  Normal   Started    10m                kubelet            Started container busybox

  Normal   Pulled     10m                kubelet            Successfully pulled image "busybox" in 8.141142008s

  Normal   Created    10m                kubelet            Created container busybox

  Normal   BackOff    10m                kubelet            Back-off pulling image "nginx"

  Warning  Failed     10m                kubelet            Error: ImagePullBackOff

  Normal   Pulling    10m (x2 over 13m)  kubelet            Pulling image "nginx"

  Normal   Pulled     9m5s               kubelet            Successfully pulled image "nginx" in 1m39.315135421s

  Normal   Created    9m4s               kubelet            Created container nginx

  Normal   Started    9m4s               kubelet            Started container nginx

pod是存在的

但是kubectl exec确报这个pod不存在

sudo kubectl exec nginx-busybox -it bash

kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use 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


0
0

系统学习Docker 践行DevOps理念

无论你是开发、测试还是运维,Docker都是你的必备技能。

3297 学习 · 1895 问题

查看课程