Kubernetes Error: ImagePullBackOff / ErrImagePull
Fix ImagePullBackOff and ErrImagePull errors caused by non-existent container images, invalid tags, private registry authorization failures, or rate limits.
Symptoms
kubectl get podsshows statusImagePullBackOfforErrImagePull.RESTARTScount is 0.- Pod is stuck in
PendingorWaitingphase.
Why It Happens
The worker node's container runtime (containerd/CRI-O) tried to pull the specified image from a container registry (Docker Hub, GitHub Container Registry, AWS ECR) and failed.
Common causes:
- Typo in image repository or tag: Image or version tag does not exist (e.g.
nginx:1.999-alpine). - Missing Private Registry Credentials: The image is private and the cluster lacks
imagePullSecrets. - Docker Hub Rate Limit: Exceeded anonymous pull rate limits (100 pulls per 6 hours).
- Network connectivity or DNS failure: Worker node cannot resolve external registry hostnames.
How to Diagnose
Look at the **Events** table at the bottom of the output:
```text
Failed to pull image "ghcr.io/org/private-app:v1.0.0": rpc error: code = Unknown desc = failed to pull and unpack image: failed to resolve reference: unexpected status from HEAD request: 401 Unauthorized
```Solutions & Fixes
1. Fix Image Name and Tag
Verify the exact image name and tag exists on the container registry:
spec:
containers:
- name: web
# Ensure image name and tag are spelled correctly
image: ghcr.io/my-org/my-app:1.2.02. Configure imagePullSecrets for Private Registries
Step 1: Create a Docker Registry Secret
kubectl create secret docker-registry ghcr-secret \
--docker-server=ghcr.io \
--docker-username=YOUR_GITHUB_USERNAME \
--docker-password=YOUR_GITHUB_TOKEN \
--docker-email=user@example.comStep 2: Attach Secret to Pod or Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-deployment
spec:
template:
spec:
imagePullSecrets:
- name: ghcr-secret
containers:
- name: private-api
image: ghcr.io/my-org/private-app:v1.0.0Related Topics
Kubernetes Error: CrashLoopBackOff
Fix the Kubernetes CrashLoopBackOff error when a container repeatedly starts, crashes on initialization, and enters an exponential backoff delay.
Kubernetes Error: OOMKilled (Exit Code 137)
Diagnose and fix Kubernetes OOMKilled (Out of Memory) exit code 137 when containers exceed memory limits or experience memory leaks.