【问题标题】:I can't get into the azure kubernetes pod我无法进入 azure kubernetes pod
【发布时间】:2020-08-01 10:41:41
【问题描述】:

我想在 pod 内部检查图像内部存在的缺陷,但出现以下错误。正如我在描述中验证的那样,容器的名称是正确的。我还能做些什么来获得集群中的连接?

命令:kubectl exec -it -c 气流控制台 -n 气流气流控制台-xxxxxxx-xxxxxx bash

error: unable to upgrade connection: container not found ("airflow-console")

命令:kubectl describe pod/airflow-console-xxxxxxx-xxxxx -n 气流

Events:
  Type     Reason     Age                    From                                           Message
  ----     ------     ----                   ----                                           -------
  Normal   Scheduled  37m                    default-scheduler                              Successfully assigned airflow/airflow-console-xxxxxxx-xxxxx to aks-test
  Normal   Pulling    37m                    kubelet, aks-test  Pulling image "test.azurecr.io/airflow:2"
  Normal   Pulled     37m                    kubelet, aks-test  Successfully pulled image "test.azurecr.io/airflow:2"
  Warning  BackOff    36m                    kubelet, aks-test  Back-off restarting failed container
  Normal   Pulled     36m (x3 over 37m)      kubelet, aks-test  Container image "k8s.gcr.io/git-sync:v3.1.2" already present on machine
  Normal   Created    36m (x3 over 37m)      kubelet, aks-test  Created container git-sync
  Normal   Started    36m (x3 over 37m)      kubelet, aks-test  Started container git-sync
  Normal   Created    36m (x3 over 36m)      kubelet, aks-test  Created container airflow-console
  Normal   Pulled     36m (x2 over 36m)      kubelet, aks-test  Container image "test.azurecr.io/airflow:2" already present on machine
  Normal   Started    36m (x3 over 36m)      kubelet, aks-test  Started container airflow-console
  Warning  BackOff    2m15s (x178 over 36m)  kubelet, aks-test  Back-off restarting failed container

【问题讨论】:

  • 看起来您的 pod 没有运行。你有kubectl get po airflow-console-xxxxxxx-xxxxx -n airflow的输出吗?
  • 您能否发布完整的kubectl describe pod/airflow-console-xxxxxxx-xxxxx -n airflow 以及您用于创建它的清单(yaml)?
  • 需要更多有关 pod 状态的信息来帮助调查,您的 pod 清楚地表明它处于错误状态。

标签: kubernetes kubectl azure-aks


【解决方案1】:

这一行

Warning  BackOff    2m15s (x178 over 36m)  kubelet, aks-test  Back-off restarting failed container

显示您的 pod/容器处于故障状态。这将阻止您在容器中执行命令,因为它不是活着的。

要了解您的 pod/容器为何处于错误状态,您应该查看故障容器的日志

kubectl logs -n airflow airflow-console-xxxxxxx-xxxxx -c airflow-console

或从前一个失败的容器中注销。 (有时会有所帮助)

kubectl logs -n airflow airflow-console-xxxxxxx-xxxxx -c airflow-console -p

这解释了用户无法执行到容器中的主要原因。

【讨论】:

    猜你喜欢
    • 2018-08-09
    • 2016-05-25
    • 1970-01-01
    • 2021-05-19
    • 2021-06-26
    • 2020-07-06
    • 2017-05-04
    • 2021-08-05
    • 2019-02-16
    相关资源
    最近更新 更多