kubernetes pod status always "pending"

3/20/2015

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)
-- daizuozhuo
kubernetes

3 Answers

11/26/2018

Check if is Kubelet is running on your machine. 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 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:

systemctl status kubelet
-- Parth Shah
Source: StackOverflow

8/27/2015

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.

-- MrE
Source: StackOverflow

7/7/2015

Kubelet is unable to start the container we use for holding the network namespace. Some things to try are:

Can you manually pull and run 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; but log location is distro-dependent, so check https://github.com/GoogleCloudPlatform/kubernetes/wiki/Debugging-FAQ#checking-logs.

-- lavalamp
Source: StackOverflow