Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kubernetes local cluster create pods got errors like ‘ErrImagePull’ and ‘ImagePullBackOff’

Tags:

kubernetes

I just installed a kubernetes local cluster, but when I tried the command

cluster/kubectl.sh run my-nginx --image=nginx --replicas=2 --port=80

to create and run pods, here is what I got:

NAME             READY     STATUS              RESTARTS   AGE
my-nginx-00t7f   0/1       ContainerCreating   0          23m
my-nginx-spy2b   0/1       ContainerCreating   0          23m

and I used kubectl logs, I got

Pod "my-nginx-00t7f" in namespace "default" : pod is not in 'Running', 'Succeeded' or 'Failed' state - State: "Pending"

Seems it got stuck in 'pending' status. Then I used 'kubectl describe' and got

Name:                           my-nginx-00t7f
Namespace:                      default
Image(s):                       nginx
Node:                           127.0.0.1/127.0.0.1
Start Time:                     Thu, 17 Dec 2015 22:27:18 +0800
Labels:                         run=my-nginx
Status:                         Pending
Reason:
Message:
IP:
Replication Controllers:        my-nginx (2/2 replicas created)
Containers:
  my-nginx:
    Container ID:
    Image:              nginx
    Image ID:
    QoS Tier:
      cpu:              BestEffort
      memory:           BestEffort
    State:              Waiting
      Reason:           ContainerCreating
    Ready:              False
    Restart Count:      0
    Environment Variables:
Conditions:
  Type          Status
  Ready         False 
Volumes:
  default-token-p09p6:
    Type:       Secret (a secret that should populate this volume)
    SecretName: default-token-p09p6
Events:
  FirstSeen     LastSeen        Count   From                    SubobjectPath   Type            Reason          Message
  ---------     --------        -----   ----                    -------------   --------        ------          -------
  26m           26m             1       {scheduler }                            Normal          Scheduled       Successfully assigned my-nginx-00t7f to 127.0.0.1
  22m           1m              79      {kubelet 127.0.0.1}                     Warning         FailedSync      Error syncing pod, skipping: ImagePullBackOff
  24m           5s              8       {kubelet 127.0.0.1}                     Warning         FailedSync      Error syncing pod, skipping: ErrImagePull

It seems my docker can not pull images, but actually it can, there is no problem when I docker pull nginx.

like image 584
Lixia Chen Avatar asked Dec 17 '15 14:12

Lixia Chen


1 Answers

I assume that you figured out that it was the pause container that couldn't be pulled from the Kubelet logs.

Kubernetes needs to create a container for the pod in order to hold shared resources, such as the network namespace. It uses the pause container for this, which is a very small container that just sleeps forever.

like image 101
briangrant Avatar answered Sep 28 '22 12:09

briangrant