15

我正在关注 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)
4

4 回答 4

4

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

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

  • 不存在依赖关系:例如,当尝试挂载不存在的卷时会发生这种情况,例如尚未创建的秘密。--> 确保创建了依赖卷。

于 2015-08-27T18:43:37.980 回答
2

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

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

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

于 2015-07-07T18:16:16.623 回答
0

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

systemctl status kubelet
于 2018-11-26T21:20:37.567 回答
0

第一步是描述 pod 并查看问题:

 $ kubectl describe pod <pod Name>

或者

如果您使用主节点,那么您可以配置主节点以运行 pod:

$ kubectl taint nodes --all node-role.kubernetes.io/master-
于 2022-01-27T15:29:36.580 回答