简体   繁体   English

"kubernetes pod 状态总是“待定”"

[英]kubernetes pod status always "pending"

There are several reasons container can fail to start: 容器无法启动的原因有很多:

  • the container command itself fails and exits -> check your docker image and start up script to make sure it works. container命令本身失败并退出->检查您的docker映像并启动脚本以确保其正常工作。 Use sudo docker ps -a to find the offending container and sudo docker logs <container> to check for failure inside the container 使用sudo docker ps -a查找有问题的容器,并使用sudo docker logs <container>检查容器内部是否存在故障

  • a dependency is not there: that happens for example when one tries to mount a volume that is not present, for example Secrets that are not created yet. 依赖项不存在:例如,当人们尝试挂载不存在的卷(例如尚未创建的机密)时,就会发生这种情况。 --> make sure the dependent volumes are created. ->确保已创建从属卷。

Kubelet is unable to start the container we use for holding the network namespace. Kubelet无法启动用于保存网络名称空间的容器。 Some things to try are: 可以尝试的一些事情是:

Can you manually pull and run gcr.io/google_containers/pause:0.8.0? 您可以手动拉并运行gcr.io/google_containers/pause:0.8.0吗? (This is the image used for the network namespace container at head right now.) (这是现在最前面用于网络名称空间容器的图像。)

As mentioned already, /var/log/kubelet.log should have more detail; 如前所述,/ var / log / kubelet.log应该有更多详细信息。 but log location is distro-dependent, so check https://github.com/GoogleCloudPlatform/kubernetes/wiki/Debugging-FAQ#checking-logs . 但是日志位置取决于发行版,因此请检查https://github.com/GoogleCloudPlatform/kubernetes/wiki/Debugging-FAQ#checking-logs

Check if is Kubelet is running on your machine. 检查您的计算机上是否正在运行Kubelet。 I came across this problem one time and discovered that Kubelet was not running, which explains why the pod status was stuck in "pending". 我有一次遇到这个问题,发现Kubelet没有运行,这解释了为什么吊舱状态停留在“挂起”状态。 Kubelet runs as a systemd service in my environment, so if that is also the case for you then the following command will help you check its status: Kubelet在我的环境中作为systemd服务运行,因此如果您也是这种情况,那么以下命令将帮助您检查其状态:

systemctl status kubelet

Step one is to describe the pod and see the problems:第一步是描述 pod 并查看问题:

 $ kubectl describe pod <pod Name>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM