When you start working with Kubernetes, everything looks fine until your pods start failing. Errors like CrashLoopBackOff or ImagePullBackOff feel confusing at first, but each one points to a specific, fixable cause. Once you know where to look, most of them take minutes to solve.
In this post I’ll walk through the five Kubernetes errors you will hit most often, what each one actually means, the commands I use to diagnose them, and how to fix them, with real examples.
Your Debugging Toolkit: Three Commands
Almost every Kubernetes problem can be diagnosed with three commands. Learn these before anything else:
kubectl get pods # status of every pod
kubectl describe pod <pod-name> # events, scheduling, image pulls, probes
kubectl logs <pod-name> --previous # logs from the last crashed container
kubectl describe is the most underrated. The Events section at the bottom usually tells you exactly what went wrong. --previous matters because when a container restarts, plain kubectl logs shows the new container, which may not have failed yet.
1. CrashLoopBackOff
What it means
The container starts, exits (crashes), and Kubernetes keeps restarting it. Each restart waits longer than the last (10s, 20s, 40s, up to 5 minutes). That growing wait is the “BackOff” part.
Common causes
- The application throws an error on startup (missing config file, bad database URL)
- Missing or wrong environment variables or secrets
- Wrong
commandorargsin the pod spec - The main process finishes and exits (for example, a container that runs a script and ends)
- A liveness probe that fails and keeps killing a healthy but slow-starting app
How to diagnose
kubectl logs <pod-name> --previous
kubectl describe pod <pod-name>
A typical log looks like:
App started
Error: missing config file /app/config.yaml
In describe, check Last State and Exit Code. Exit code 1 is an application error, 127 means the command was not found, and 137 means the container was killed (often memory; see error 4).
Fix
- Fix the application error shown in the logs
- Check that every ConfigMap, Secret and environment variable the app needs exists in the same namespace
- Verify the
command/argsmatch what the image expects - If a liveness probe is killing the app, add a
startupProbeor increaseinitialDelaySeconds
2. ImagePullBackOff / ErrImagePull
What it means
The kubelet cannot pull the container image, so the container never starts. ErrImagePull is the first failure; ImagePullBackOff is Kubernetes waiting before trying again.
Common causes
- A typo in the image name or tag, such as
image: nginx:latesttt - The tag does not exist in the registry
- A private registry (ECR, Docker Hub private repo) without pull credentials
- Docker Hub rate limits, or the node cannot reach the registry over the network
How to diagnose
kubectl describe pod <pod-name>
The Events section shows the exact error, for example manifest unknown (wrong tag), pull access denied or no basic auth credentials (missing credentials).
Fix
- Correct the image name and tag, and confirm it exists with
docker pulllocally - For private registries, create an image pull secret and reference it:
then addkubectl create secret docker-registry regcred \ --docker-server=<registry> --docker-username=<user> --docker-password=<token>imagePullSecrets: [{ name: regcred }]to the pod spec - On EKS with ECR, make sure the node IAM role has the
AmazonEC2ContainerRegistryReadOnlypolicy
3. Pending Pods
What it means
The pod has been accepted by the cluster, but the scheduler cannot place it on any node, so it never starts.
Common causes
- Not enough CPU or memory on any node for the pod’s
requests - A
nodeSelector, affinity rule or taint that no node satisfies - A PersistentVolumeClaim that is not bound (no matching StorageClass or volume)
How to diagnose
kubectl describe pod <pod-name>
kubectl describe nodes | grep -A5 "Allocated resources"
kubectl get pvc
Events like 0/3 nodes are available: 3 Insufficient memory or node(s) had untolerated taint tell you which case you are in.
Fix
- Lower the pod’s resource requests if they are unrealistically high, or add nodes (or enable the Cluster Autoscaler or Karpenter)
- Fix the node selector or add a matching toleration
- Create the missing StorageClass or PersistentVolume so the PVC can bind
4. OOMKilled
What it means
The container used more memory than its limits.memory allows, so the Linux kernel killed it. You will see Reason: OOMKilled and exit code 137, and it often leads into CrashLoopBackOff.
How to diagnose
kubectl describe pod <pod-name> # Last State: Terminated, Reason: OOMKilled
kubectl top pod <pod-name> # needs metrics-server
Fix
- Raise the memory limit to match what the app really needs under load
- For JVM, Node.js and similar runtimes, set heap sizes that fit inside the container limit (for example
-XX:MaxRAMPercentage=75for Java) - Look for memory leaks if usage keeps climbing over time
5. Service Not Reachable (No Endpoints)
What it means
Pods are running, but traffic to the Service fails or times out. This one is sneaky because nothing shows as an error in kubectl get pods.
Common causes
- The Service
selectordoes not match the pod labels, so the Service has no endpoints targetPortdoes not match the port the container actually listens on- Pods are not Ready because the readiness probe is failing
How to diagnose
kubectl get endpoints <service-name>
kubectl get pods --show-labels
kubectl port-forward svc/<service-name> 8080:80
If get endpoints shows <none>, it’s almost always a label mismatch.
Fix
- Make the Service selector match the pod template labels exactly
- Set
targetPortto the container’s listening port - Fix the readiness probe path or port
Quick Reference
- CrashLoopBackOff:
kubectl logs --previousto see why the app exits - ImagePullBackOff: check image name, tag and pull credentials in
describe - Pending: check resources, taints and PVCs in
describe - OOMKilled: raise the memory limit or fix the leak
- No endpoints: match Service selector labels and ports
The habit that fixes most errors
Kubernetes errors look intimidating, but they follow patterns. Get into the habit of running kubectl describe and reading the Events first; that one step solves most problems. If you are still getting comfortable with how the pieces fit together, read my guides on Kubernetes architecture and setting up K3s on EC2 to get a practice cluster running.
I demonstrate these fixes live on my YouTube channel, Madhukar Reddy (@awsandevops).
