Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Diagnose a Kubernetes ImagePullBackOff

By updated

Improve this page

Logo Kubernetes

ImagePullBackOff means that the kubelet cannot download the container image from the registry. The pod is assigned to a node (it is no longer Pending), but creating the container fails because the image is not found, not reachable or refused. This guide gives you a 4-step method to identify the cause and unblock the deployment.

What you will learn

  • Understand the difference between ErrImagePull and ImagePullBackOff
  • Identify the 7 main causes of an image pull failure
  • Apply a repeatable diagnostic method in 4 steps
  • Configure imagePullSecrets for a private registry
  • Reproduce and fix an ImagePullBackOff on a test cluster

Prerequisites

  • A working Kubernetes cluster on 1.37, the version the course teaches
  • kubectl configured and connected to the cluster
  • Read access to pods and events
  • Basic knowledge of Pods and container images

What is an ImagePullBackOff?

When the kubelet tries to download an image and fails, it goes through two successive states:

StateMeaning
ErrImagePullThe pull has just failed, this is the first attempt (or a new attempt after a backoff)
ImagePullBackOffThe kubelet has already failed and waits before retrying, this is the exponential backoff

These two states alternate in a loop: the kubelet tries (ErrImagePull), fails, waits (ImagePullBackOff), then retries. The waiting delay increases after each failure, following an exponential backoff. The official documentation does not publish the exact durations, unlike what it does for CrashLoopBackOff.

The image pull process

When the kubelet has to start a container, it follows these steps:

  1. Check the local cache: does the image already exist on the node?
  2. Resolve the image name: add docker.io/library/ if there is no explicit registry, and :latest if there is no tag
  3. Authenticate: if an imagePullSecret is configured, the kubelet uses it to authenticate against the registry
  4. Download the image: pull the missing layers
  5. Check integrity: validation of the SHA256 digest

If one of these steps fails, the kubelet emits a Failed event with the error details, and the pod goes into ErrImagePull.

The imagePullPolicy decides whether step 4 takes place at all, and it has a direct consequence on the diagnosis. With Never, the kubelet never contacts the registry: if the image is not already on the node, the Pod does not go into ImagePullBackOff but into ErrImageNeverPull, a distinct status that means nothing was attempted. Checking the registry, the credentials or the network is then pointless. The details of the three policies and of their default values are covered in Manage container images.

The 7 main causes

The column to use first is Typical error message: it is what sorts the causes, not the description of the cause. The kubelet copies the registry's answer verbatim into the pod's event, which makes the diagnosis almost mechanical. Note that causes 1 and 6 produce the same message (manifest unknown), because the registry does not tell a tag that never existed from a deleted tag; the history of your publishing pipeline settles it. Cause 7 is harder to spot: the image exists, so does the tag, but no variant matches the architecture of the node, which happens in mixed fleets (amd64 and arm64 nodes).

#CauseTypical error messageWhere to look
1Incorrect image tag or namemanifest unknown, not foundkubectl describe pod → Events
2Private registry without authenticationunauthorized, authentication requiredkubectl describe pod → Events
3Missing or invalid imagePullSecretno basic auth credentials, unauthorizedkubectl describe pod → Events + kubectl get secret
4Unreachable registry (network)dial tcp: i/o timeout, no such hostkubectl describe pod → Events
5Docker Hub pull limittoomanyrequests, rate limit exceededkubectl describe pod → Events
6Deleted image or tagmanifest unknown, not foundkubectl describe pod → Events
7Incompatible architectureno matching manifest for linux/amd64kubectl describe pod → Events

4-step diagnostic method

  1. Identify the pods in ImagePullBackOff

    Terminal window
    kubectl get pods -A | grep -E 'ImagePull|ErrImage'

    You can also filter the failed pull events:

    Terminal window
    kubectl get events -A --field-selector reason=Failed --sort-by='.lastTimestamp' | grep -i pull

    Note the pod name, its namespace and how long it has been in this state.

  2. Read the exact error message

    Terminal window
    kubectl describe pod <pod> -n <namespace>

    Go straight to the Events section and look for the Failed or Warning lines. The message holds the essential information. Examples:

    Failed to pull image "my-registry.example.com/app:v2.1":
    rpc error: code = Unknown desc = failed to pull and unpack image:
    failed to resolve reference: pull access denied, repository does not
    exist or may require authorization

    This message tells you: the registry is private and the kubelet does not have the credentials.

    Failed to pull image "nginx:v99":
    rpc error: code = NotFound desc = failed to pull and unpack image:
    failed to resolve reference: docker.io/library/nginx:v99:
    not found

    This one: the v99 tag does not exist on Docker Hub.

  3. Check the image and the authentication

    Check that the image exists:

    Look at the web interface or the API of the registry concerned (Docker Hub, Harbor, GitLab Registry, ECR) to confirm that the tag exists and that it is available for the architecture of your nodes. To test the download directly from a node, use crictl:

    Terminal window
    # Test the pull from the node (via a debug Pod or over SSH)
    crictl pull my-registry.example.com/app:v2.1

    Check the imagePullSecret:

    Terminal window
    # Does the secret exist in the pod's namespace?
    kubectl get secret -n <namespace> | grep docker
    # Does the pod reference the secret?
    kubectl get pod <pod> -n <namespace> -o jsonpath='{.spec.imagePullSecrets}'

    If the pod has no imagePullSecrets and the registry is private, that is the cause of the problem.

    Check network connectivity (from the context of a node):

    kubectl debug node/ creates a diagnostic Pod attached to the target node. From that Pod, you test DNS resolution and network connectivity in the node's network context, the only place where the test makes sense:

    Terminal window
    kubectl debug node/<node-name> -it --image=busybox:1.37@sha256:a7dbc319b1438115a207e11930dc4bb3e643dcb3ec0bdd694bb36cd8fad289ec
    # Once in the shell of the debug Pod:
    nslookup my-registry.example.com
    wget -q --spider https://my-registry.example.com/v2/ && echo "OK" || echo "UNREACHABLE"
  4. Fix and verify

    Depending on the cause identified:

    CauseCorrective action
    Incorrect tagFix the tag in the manifest (check on the registry)
    Private registry without authCreate an imagePullSecret and reference it in the pod
    Invalid secretRecreate the secret with the right credentials
    Unreachable registryCheck the DNS, the firewall, the node's proxy
    Docker Hub rate limitAuthenticate the pulls or use a mirror
    Deleted image or tagFix the tag or rebuild/repush the image
    Incompatible architectureRebuild the image for the target architecture or use a multi-arch manifest

    After the fix, the pod retries the pull automatically. If you want to force an immediate re-pull:

    Terminal window
    kubectl delete pod <pod> -n <namespace>

    The controller (Deployment, StatefulSet...) will recreate a pod that attempts the pull with the new parameters.

Configure an imagePullSecret

A common cause is the absence of credentials for a private registry. Here is the complete procedure:

Create the secret

The docker-registry type produces a Secret in the kubernetes.io/dockerconfigjson format, that is exactly the content of a ~/.docker/config.json file that the kubelet knows how to consume. The --docker-server field must contain the same host as the one written in the pod's image field: if the image is my-registry.example.com/app:v2.1, a secret created for https://my-registry.example.com/v2/ will not be matched and the pull will stay refused. For --docker-password, prefer a revocable access token rather than the account password.

Terminal window
read -rsp 'Registry token: ' REGISTRY_TOKEN && echo
kubectl create secret docker-registry my-registry-secret \
--docker-server=my-registry.example.com \
--docker-username=my-user \
--docker-password="$REGISTRY_TOKEN" \
--docker-email=admin@example.com \
-n <namespace>
unset REGISTRY_TOKEN

Reading with read -rs avoids writing the token in clear text in the shell history and in the process table, where any ps aux on the machine would show it. The Secret itself is not encrypted in etcd by default, it is only encoded in base64: hardening goes through encryption at rest on the API server side.

Reference the secret in the pod

The imagePullSecrets field is declared at the level of the pod, not of the container, and therefore applies to all the containers of the pod, init containers included. The referenced name must match a Secret present in the same namespace: Kubernetes raises no validation error if the Secret is missing, the pull simply fails as if there were no authentication.

apiVersion: v1
kind: Pod
metadata:
name: private-app
spec:
imagePullSecrets:
- name: my-registry-secret
containers:
- name: app
image: my-registry.example.com/app:v2.1

Automate with the ServiceAccount

To avoid adding imagePullSecrets to every pod, attach the secret to the namespace's default ServiceAccount:

Terminal window
kubectl patch serviceaccount default -n <namespace> \
-p '{"imagePullSecrets": [{"name": "my-registry-secret"}]}'

All the pods of the namespace that use the default ServiceAccount will automatically inherit the secret.

One point not to discover during an incident: a Secret is scoped to a namespace. A Pod can only reference the Secrets of its own, so deploying the same application in three namespaces means creating the secret three times.

Practical examples: reproduce an ImagePullBackOff

Nothing beats a provoked failure for recognizing a real one. The three cases below apply to a test cluster and each produces a different status and message in kubectl describe. Above all, remember that not every image failure ends in ImagePullBackOff: a syntactically invalid image name is rejected before any pull attempt, under the InvalidImageName status, as the third case shows.

Case 1: nonexistent tag

The manifest below is deliberately broken: this tag does not exist, and the image is therefore neither pinned nor pinnable. ❌ Deliberate counter-example, not to be copied anywhere else.

Terminal window
kubectl apply -f- <<'EOF'
apiVersion: v1
kind: Pod
metadata:
name: pull-bad-tag
namespace: default
spec:
containers:
- name: app
image: nginx:nonexistent-version
EOF

Diagnosis:

Terminal window
kubectl describe pod pull-bad-tag | tail -10

You will see Failed to pull image "nginx:nonexistent-version" with not found.

Case 2: private repository without credentials

To reproduce a real authentication refusal, you need to target a registry that answers, but on a repository that requires permissions. A path under a Docker Hub namespace that you do not own works: the registry is reachable, but it refuses access.

❌ Deliberate counter-example, like the previous one: this image must not be pinned, its inaccessibility being the whole point.

Terminal window
kubectl apply -f- <<'EOF'
apiVersion: v1
kind: Pod
metadata:
name: pull-no-auth
namespace: default
spec:
containers:
- name: app
image: docker.io/stephanerobert/nonexistent-private-repo:v1
EOF

Diagnosis:

Terminal window
kubectl describe pod pull-no-auth | tail -10

The message will contain pull access denied, repository does not exist or may require authorization followed by insufficient_scope: authorization failed.

Case 3: malformed image name

❌ Third deliberate counter-example. This one does not even get past the name validation: it differs from the two previous ones before any call to the registry.

Terminal window
kubectl apply -f- <<'EOF'
apiVersion: v1
kind: Pod
metadata:
name: pull-bad-name
namespace: default
spec:
containers:
- name: app
image: "nginx ::latest"
EOF

Diagnosis:

Terminal window
kubectl describe pod pull-bad-name | tail -10

This pod does not go into ImagePullBackOff: its status is InvalidImageName, with the event Failed to apply default image tag "nginx ::latest": ... invalid reference format. The name is rejected at validation, before the kubelet even attempts a pull. It is a neighboring but distinct case, useful to know so that you do not look for a registry problem where there is only a typo in the manifest.

Cleanup

These test Pods stay stuck indefinitely without ever starting: delete them once you have observed them. The --force --grace-period=0 options avoid waiting for a clean termination, which is pointless here since no container has started.

Terminal window
kubectl delete pod pull-bad-tag pull-no-auth pull-bad-name --force --grace-period=0 2>/dev/null

Special cases

The three situations below share one trait: the manifest is correct, and yet the download fails. The cause is no longer in the Pod but in its environment: the node, the registry quota, or the state of the cache after an infrastructure operation. Recognizing them saves you from rereading ten times an image name that never had a problem.

ImagePullBackOff on a single node

If some pods start normally and others do not, the problem is probably local to the node:

  • The node has no network connectivity to the registry (missing proxy, faulty DNS)
  • The node's disk is full (no more room to store the layers)
  • The container runtime has a configuration problem (containerd, CRI-O)

Open a diagnostic session on the affected node with kubectl debug node/<node-name>, then check the DNS resolution, the network connectivity to the registry and the state of the container runtime. To inspect the latter, use crictl:

Terminal window
# Interactive debug session on the node
kubectl debug node/<node-name> -it --image=busybox:1.37@sha256:a7dbc319b1438115a207e11930dc4bb3e643dcb3ec0bdd694bb36cd8fad289ec
# From the debug pod, test connectivity
nslookup my-registry.example.com
Terminal window
# On the node (SSH or debug), inspect the runtime
crictl info
crictl images | grep my-image

Docker Hub rate limit

Docker Hub applies pull limits over a 6-hour window. An unauthenticated access is capped at 100 pulls per IPv4 address (or per IPv6 /64 subnet), a free authenticated Personal account at 200 pulls, while paid subscriptions (Pro, Team, Business) have no limit. In a cluster where several nodes go out behind the same public IP, these quotas are quickly reached, because they apply to the address, not to the node.

The error message contains toomanyrequests:

toomanyrequests: You have reached your pull rate limit.
You may increase the limit by authenticating and upgrading:
https://www.docker.com/increase-rate-limit

Solutions:

  • Authenticate the pulls with a Docker Hub account to get a higher limit
  • Set up a registry mirror (Harbor, Nexus, registry:2)
  • Use imagePullPolicy: IfNotPresent to avoid unnecessary pulls

ImagePullBackOff after a cluster upgrade

An upgrade that changes the container runtime, for example from Docker to containerd, can make you lose the local image cache. All the Pods must then download their images again, which causes simultaneous ImagePullBackOff errors if the registry or the network cannot take the load.

Quick troubleshooting

When facing a stuck Pod, read the exact event first with kubectl describe pod: it is what tells a badly named image from an unreachable registry or an authentication refusal. The table below starts from the visible symptom and gives the command that confirms the cause.

SymptomFirst actionCommand
ImagePullBackOff + not foundCheck the tagkubectl describe pod <pod> → look for the exact image name
ImagePullBackOff + unauthorizedCheck the imagePullSecretkubectl get pod <pod> -o jsonpath='{.spec.imagePullSecrets}'
ImagePullBackOff + i/o timeoutNetwork problemTest connectivity from the node to the registry
ImagePullBackOff + toomanyrequestsDocker Hub rate limitAuthenticate the pulls or set up a mirror
ErrImageNeverPullimagePullPolicy: Never but image missingChange the policy or preload the image on the node
Only one node in errorProblem local to the nodeCheck the node's disk, DNS, proxy and runtime

Put it into practice

The useful message is neither in the logs nor in kubectl get pods, it is in the events. This lab has you read the exact message of the runtime, fix the image reference, and check that the server answers.

Key takeaways

  • ErrImagePull is the immediate error, ImagePullBackOff is the wait between two attempts, the two appear alternately
  • kubectl describe pod is the key command, the error message in the Events holds the exact reason for the failure
  • The :latest tag is a trap: if it is deleted from the registry, the new pods fail while the old ones keep working. Use explicit tags
  • For a private registry, you need an imagePullSecret in the same namespace as the pod, remember to attach it to the ServiceAccount so you do not forget it
  • Docker Hub has a rate limit over a 6-hour window, authenticate your pulls or use a local mirror in production
  • If the problem affects only one node, it is probably a local network, disk or runtime issue
  • After the fix, the kubelet retries the pull automatically, if you want to force an immediate retry, delete the pod

Knowledge check

Seven questions on what tells the causes apart: the registry message, the DNS one, and the status that betrays a typo rather than an access problem.

Knowledge check

Check what you have learned with this interactive quiz

7 questions
5 min
80% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer