Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kubernetes pod status always "pending"

Tags:

kubernetes

I am following the Fedora getting started guide (https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/fedora/fedora_ansible_config.md) and trying to run the pod fedoraapache. But kubectl always shows fedoraapache as pending:

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

Since it is pending, I cannot run kubectl log pod fedoraapache. So, I instead run kubectl describe pod fedoraapache, which shows the following errors:

  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)
like image 567
daizuozhuo Avatar asked Mar 20 '15 14:03

daizuozhuo


People also ask

Why my deployment is not ready in Kubernetes?

If a Pod is Running but not Ready it means that the Readiness probe is failing. When the Readiness probe is failing, the Pod isn't attached to the Service, and no traffic is forwarded to that instance.


1 Answers

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. Use sudo docker ps -a to find the offending container and sudo docker logs <container> to check for failure inside the 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.

like image 200
MrE Avatar answered Sep 25 '22 01:09

MrE