I deployed an image to Kubernetes, but it never becomes ready, even after hours.
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
myapp-b8dd974db-9jbsl 0/1 ImagePullBackOff 0 21m
All this happens with the Quickstart Hello app, as well as my own Docker image.
Attempts to attach fail.
$ kubectl attach -it myapp-b8dd974db-9jbs
Unable to use a TTY - container myapp did not allocate one
If you don't see a command prompt, try pressing enter.
error: unable to upgrade connection: container
myapp not found in pod myapp-b8dd974db-9jbsl_default
Attempts to access it over HTTP fail.
In Stackdriver Logging I see messages like
skipping: failed to "StartContainer" for "myapp"
with ImagePullBackOff: "Back-off pulling image
\"gcr.io/myproject/myapp-image:1.0\""
and No such image
Yet I did deploy these images and the Cloud Console shows that the pods are "green."
And kubectl
seems to tell me that the cluster is OK.
$ kubectl get service myapp
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
myapp LoadBalancer 10.43.248.78 35.193.107.141 8222:31840/TCP 29m
How can I diagnose this?
You can use kubectl describe myapp-b8dd974db-9jbsl
to get more information on your pod.
But from the status message 'ImagePullBackOff' it is probably trying to download the docker image and failing.
This might because of several reasons, you will obtain more information with the kubectl describe
but it's probably that you don't have permissions to that docker repository or the image/image:tag does not exist.