Skip to main content

Pod ImagePullBackOff Troubleshooting

·232 words·2 mins
Jack Warner
Author
Jack Warner
A little blog by me

Scenario
#

A pod named webserver fails to start with ImagePullBackOff errors. The pod consists of:

  • Main container: nginx-container using nginx:latest
  • Sidecar container: sidecar-container using ubuntu:latest

Problem Diagnosis
#

Check pod events to identify the issue:

kubectl describe pod webserver

Key Events:

Warning  Failed     25s (x2 over 45s)  kubelet  Failed to pull image "nginx:latests": rpc error: code = NotFound desc = failed to pull and unpack image "docker.io/library/nginx:latests": failed to resolve reference "docker.io/library/nginx:latests": docker.io/library/nginx:latests: not found
Warning  Failed     14s (x3 over 41s)  kubelet  Error: ImagePullBackOff

Issue Identified: Image tag typo - nginx:latests instead of nginx:latest

Solution
#

Option 1: Edit Pod Directly
#

kubectl edit pod webserver

Change image: nginx:latests to image: nginx:latest, save and exit. Then delete and recreate the pod.

Option 2: Delete and Recreate
#

First, get the pod YAML:

kubectl get pod webserver -o yaml > webserver.yaml

Edit the file to fix the image name, then:

kubectl delete pod webserver
kubectl apply -f webserver.yaml

Option 3: Corrected YAML
#

apiVersion: v1
kind: Pod
metadata:
  name: webserver
spec:
  containers:
  - name: nginx-container
    image: nginx:latest  # Fixed from nginx:latests
  - name: sidecar-container
    image: ubuntu:latest

Verification
#

# Check pod status
kubectl get pods webserver

# Verify events show successful pulls
kubectl describe pod webserver

# Check container logs
kubectl logs webserver -c nginx-container
kubectl logs webserver -c sidecar-container

Expected output: Pod status should be Running with both containers started successfully.

Related