kubernetes pod状态总是"待定"

时间:2015-03-20 14:12:07

标签: kubernetes

我正在关注Fedora入门指南(https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/fedora/fedora_ansible_config.md)并尝试运行pod fedoraapache。但kubectl始终将fedoraapache显示为待处理状态:

POD                 IP                  CONTAINER(S)        IMAGE(S)            HOST                              LABELS              STATUS
fedoraapache                            fedoraapache        fedora/apache       192.168.226.144/192.168.226.144   name=fedoraapache   Pending

由于它处于待处理状态,我无法运行kubectl log pod fedoraapache。所以, 我改为运行kubectl describe pod fedoraapache,它显示以下错误:

  Fri, 20 Mar 2015 22:00:05 +0800   Fri, 20 Mar 2015 22:00:05 +0800 1   {kubelet 192.168.226.144}   implicitly required container POD   created     Created with docker id d4877bdffd4f2a13a17d4cc93c27c1c93d5494807b39ee8a823f5d9350e404d4
  Fri, 20 Mar 2015 22:00:05 +0800   Fri, 20 Mar 2015 22:00:05 +0800 1   {kubelet 192.168.226.144}                       failedSync  Error syncing pod, skipping: API error (500): Cannot start container d4877bdffd4f2a13a17d4cc93c27c1c93d5494807b39ee8a823f5d9350e404d4:  (exit status 1)

  Fri, 20 Mar 2015 22:00:15 +0800   Fri, 20 Mar 2015 22:00:15 +0800 1   {kubelet 192.168.226.144}   implicitly required container POD   created Created with docker id 1c32b4c6e1aad0e575f6a155aebefcd5dd96857b12c47a63bfd8562fba961747
  Fri, 20 Mar 2015 22:00:15 +0800   Fri, 20 Mar 2015 22:00:15 +0800 1   {kubelet 192.168.226.144}   implicitly required container POD   failed  Failed to start with docker id 1c32b4c6e1aad0e575f6a155aebefcd5dd96857b12c47a63bfd8562fba961747 with error: API error (500): Cannot start container 1c32b4c6e1aad0e575f6a155aebefcd5dd96857b12c47a63bfd8562fba961747:  (exit status 1)

  Fri, 20 Mar 2015 22:00:15 +0800   Fri, 20 Mar 2015 22:00:15 +0800 1   {kubelet 192.168.226.144}       failedSync  Error syncing pod, skipping: API error (500): Cannot start container 1c32b4c6e1aad0e575f6a155aebefcd5dd96857b12c47a63bfd8562fba961747:  (exit status 1)

  Fri, 20 Mar 2015 22:00:25 +0800   Fri, 20 Mar 2015 22:00:25 +0800 1   {kubelet 192.168.226.144}       failedSync  Error syncing pod, skipping: API error (500): Cannot start container 8b117ee5c6bf13f0e97b895c367ce903e2a9efbd046a663c419c389d9953c55e:  (exit status 1)

  Fri, 20 Mar 2015 22:00:25 +0800   Fri, 20 Mar 2015 22:00:25 +0800 1   {kubelet 192.168.226.144}   implicitly required container POD   created Created with docker id 8b117ee5c6bf13f0e97b895c367ce903e2a9efbd046a663c419c389d9953c55e
  Fri, 20 Mar 2015 22:00:25 +0800   Fri, 20 Mar 2015 22:00:25 +0800 1   {kubelet 192.168.226.144}   implicitly required container POD   failed  Failed to start with docker id 8b117ee5c6bf13f0e97b895c367ce903e2a9efbd046a663c419c389d9953c55e with error: API error (500): Cannot start container 8b117ee5c6bf13f0e97b895c367ce903e2a9efbd046a663c419c389d9953c55e:  (exit status 1)

  Fri, 20 Mar 2015 22:00:35 +0800   Fri, 20 Mar 2015 22:00:35 +0800 1   {kubelet 192.168.226.144}   implicitly required container POD   failed  Failed to start with docker id 4b463040842b6a45db2ab154652fd2a27550dbd2e1a897c98473cd0b66d2d614 with error: API error (500): Cannot start container 4b463040842b6a45db2ab154652fd2a27550dbd2e1a897c98473cd0b66d2d614:  (exit status 1)

  Fri, 20 Mar 2015 22:00:35 +0800   Fri, 20 Mar 2015 22:00:35 +0800 1   {kubelet 192.168.226.144}   implicitly required container POD   created     Created with docker id 4b463040842b6a45db2ab154652fd2a27550dbd2e1a897c98473cd0b66d2d614
  Fri, 20 Mar 2015 21:42:35 +0800   Fri, 20 Mar 2015 22:00:35 +0800 109 {kubelet 192.168.226.144}   implicitly required container POD   pulled      Successfully pulled image "kubernetes/pause:latest"
  Fri, 20 Mar 2015 22:00:35 +0800   Fri, 20 Mar 2015 22:00:35 +0800 1   {kubelet 192.168.226.144}                       failedSync  Error syncing pod, skipping: API error (500): Cannot start container 4b463040842b6a45db2ab154652fd2a27550dbd2e1a897c98473cd0b66d2d614:  (exit status 1)

3 个答案:

答案 0 :(得分:3)

容器无法启动有几个原因:

  • 容器命令本身失败并退出 - &gt;检查您的docker镜像并启动脚本以确保它正常工作。 使用 sudo docker ps -a找到有问题的容器和 sudo docker logs <container>检查容器内的故障

  • 不存在依赖关系:例如,当尝试安装不存在的卷时,例如 Secrets 尚未创建。 - &GT;确保创建了相关卷。

答案 1 :(得分:2)

Kubelet无法启动我们用于保存网络命名空间的容器。有些事情要尝试:

您可以手动拉取并运行gcr.io/google_containers/pause:0.8.0吗? (这是现在用于网络名称空间容器的图像。)

如上所述,/ var / log / kubelet.log应该有更多细节;但是日志位置依赖于发行版,因此请检查https://github.com/GoogleCloudPlatform/kubernetes/wiki/Debugging-FAQ#checking-logs

答案 2 :(得分:0)

检查您的计算机上是否正在运行Kubelet。我有一次遇到这个问题,发现Kubelet没有运行,这解释了为什么吊舱状态停留在“挂起”状态。 Kubelet在我的环境中作为systemd服务运行,因此如果您也是这种情况,那么以下命令将帮助您检查其状态:

systemctl status kubelet