Skip to main content
🎤 Luca Berton is speaking at Red Hat Summit & KubeCon EU 2026!Learn more →
Back to Blog

Kubernetes Pod Troubleshooting

Debug Kubernetes pods systematically. Fix CrashLoopBackOff, ImagePullBackOff, pending pods, and OOMKilled with diagnostic commands.

Luca BertonApril 10, 20262 min read

First Steps

When a pod is not running, start here:

bash
# What state is it in?
kubectl get pods

# Why?
kubectl describe pod <pod-name>

# What did the app say?
kubectl logs <pod-name>

# Previous crash logs
kubectl logs <pod-name> --previous

CrashLoopBackOff

The container starts, crashes, and Kubernetes keeps restarting it.

Check logs:

bash
kubectl logs <pod-name> --previous

Common causes: - Application error (check stack trace in logs) - Missing environment variable or config - Wrong command or entrypoint

Quick debug — run a shell instead:

bash
kubectl run debug --image=<your-image> --rm -it -- /bin/sh

ImagePullBackOff

Kubernetes cannot pull the container image.

bash
kubectl describe pod <pod-name> | grep -A5 "Events"

Fixes: - Wrong image name: check for typos in the deployment spec - Private registry: create an image pull secret

bash
kubectl create secret docker-registry regcred \
  --docker-server=ghcr.io \
  --docker-username=<user> \
  --docker-password=<token>

Add to your pod spec:

yaml
spec:
  imagePullSecrets:
    - name: regcred
Related Course

Master this topic with hands-on labs

Go beyond reading — build real projects in sandboxed environments with expert video guidance.

Browse Courses →

Pending Pod

Pod stays in Pending state — not scheduled to any node.

bash
kubectl describe pod <pod-name> | grep -A10 "Events"

Common causes: - Insufficient resources: no node has enough CPU/memory

bash
kubectl describe nodes | grep -A5 "Allocated resources"
  • Node selector or affinity mismatch: pod requires a label no node has
  • PVC not bound: the persistent volume claim is waiting
bash
kubectl get pvc

OOMKilled

Container exceeded its memory limit and was killed.

bash
kubectl describe pod <pod-name> | grep -i "oom\|killed\|memory"

Fix: increase the memory limit or fix the memory leak:

yaml
resources:
  requests:
    memory: "256Mi"
  limits:
    memory: "512Mi"

Check actual usage:

bash
kubectl top pod <pod-name>

Container Won't Start

Exit code 0 but pod keeps restarting — the process exits immediately.

Common fix: your container needs a foreground process. Docker images that work with docker run may exit in Kubernetes because there is no TTY.

yaml
# Wrong — exits immediately
command: ["bash", "-c", "echo hello"]

# Right — stays running
command: ["bash", "-c", "echo hello && sleep infinity"]
Stay Updated

Get weekly IT automation tips

Docker, Ansible, Terraform, MLOps — curated insights delivered to your inbox. No spam.

Subscribe Free →

Network Issues

Pod is running but cannot be reached:

bash
# Check service endpoints
kubectl get endpoints <service-name>

# Test from inside the cluster
kubectl run curl --image=curlimages/curl --rm -it -- curl http://<service-name>:<port>

# Check DNS
kubectl run dns --image=busybox --rm -it -- nslookup <service-name>

Quick Reference

SymptomFirst Command
CrashLoopBackOffkubectl logs --previous
ImagePullBackOffkubectl describe pod
Pendingkubectl describe pod
OOMKilledkubectl top pod
Not reachablekubectl get endpoints
Slow startupkubectl describe pod (check readiness probe)

- Local Kubernetes with Kind for local testing - Monitoring ML Models in K8s for observability - CI/CD for ML on Kubernetes for deployment pipelines -e ---

Ready to go deeper? Explore our hands-on DevOps courses — from Docker and Terraform to MLflow on Kubernetes.

Ready to learn by doing?

Stop reading tutorials — start building. Expert video courses with hands-on labs in real sandboxed environments.

Share this article
LB
Luca Berton

Docker Captain, IT automation expert, Red Hat Summit & KubeCon speaker. Building hands-on education for DevOps engineers at CopyPasteLearn.

Related Articles

Explore topics

Browse more articles on the topics covered here.