DEV Community

Sedat SALMAN
Sedat SALMAN

Posted on

Why Isn't My Pod Running? 5 Kubernetes Errors Explained and Fixed

Your Pod isn't running, and kubectl get pods gives you one word: Pending, ImagePullBackOff, CrashLoopBackOff. Each word points to a different step in a Pod's life, and each one has a command that tells you exactly what went wrong.

This post walks through the five problems I see most often, with real terminal output for each one and the fix. The video at the top covers the same ground in four and a half minutes if you'd rather watch.

Where these words come from

When you create a Pod, the cluster accepts it and the Pod is Pending. Pending covers two things: waiting for the scheduler to pick a node, and downloading the container images. Once the Pod is bound to a node, its containers exist and at least one is running, starting or restarting, the Pod is Running.

Each of the five problems below breaks a different step:

  • Pending: no node was chosen.
  • ImagePullBackOff: the image never arrived.
  • CrashLoopBackOff: the process starts and exits.
  • OOMKilled: the kernel killed the process for using too much memory.
  • Restarts while the app is fine: a liveness probe tells Kubernetes to restart a healthy container.

The routine: three commands

For all five, the routine is the same:

  1. kubectl get pods tells you which word you have.
  2. kubectl describe pod <name> shows the events and the container's last state.
  3. kubectl logs <name> --previous shows what the container printed before its last restart.

Most of the time, the answer is in step 2.

1. Pending: no node fits

fast-db has been Pending for twenty seconds.

$ kubectl get pods
NAME      READY   STATUS    RESTARTS   AGE
fast-db   0/1     Pending   0          20s

$ kubectl describe pod fast-db
Node-Selectors:  disk=nvme
Events:
  Warning  FailedScheduling  20s  default-scheduler  0/3 nodes are available: 1 node(s) didn't match Pod's node affinity/selector, 1 node(s) had untolerated taint {node-role.kubernetes.io/control-plane: }, 1 node(s) had untolerated taint {workload: batch}.
Enter fullscreen mode Exit fullscreen mode

The FailedScheduling event gives a reason for every node: one didn't match the Pod's node selector, and the other two have taints the Pod doesn't tolerate. The selector asks for disk=nvme. Let's see which node actually has a disk label:

$ kubectl get nodes -l disk=ssd
NAME     STATUS   ROLES    AGE   VERSION
node02   Ready    <none>   15m   v1.35.0
Enter fullscreen mode Exit fullscreen mode

Only node02 has one, and it says ssd. Kubernetes only schedules a Pod onto nodes that have every label in its nodeSelector, so this Pod would wait forever. Change the selector to disk: ssd in fast-db.yaml and replace the Pod:

$ kubectl replace --force -f fast-db.yaml

$ kubectl get pod fast-db -o wide
NAME      READY   STATUS    RESTARTS   AGE   IP           NODE
fast-db   1/1     Running   0          10s   10.244.2.4   node02
Enter fullscreen mode Exit fullscreen mode

Rule of thumb: Pending? Run describe and read the events.

One-minute version: Kubernetes Pod Stuck in Pending: Cause and Fix

2. ImagePullBackOff: the image never arrived

$ kubectl get pods
NAME     READY   STATUS             RESTARTS   AGE
webapp   0/1     ImagePullBackOff   0          20s

$ kubectl describe pod webapp
    Image:          ngnix:1.27
Events:
  Warning  Failed   19s  kubelet  Failed to pull image "ngnix:1.27": ... pull access denied, repository does not exist or may require authorization ...
  Warning  Failed   19s  kubelet  Error: ErrImagePull
  Normal   BackOff  18s  kubelet  Back-off pulling image "ngnix:1.27"
  Warning  Failed   18s  kubelet  Error: ImagePullBackOff
Enter fullscreen mode Exit fullscreen mode

The kubelet couldn't download the image. There are two usual reasons: the name or tag is wrong, or the registry is private and the Pod has no pull secret. BackOff means it keeps trying, waiting longer each time, up to five minutes.

Read the image name slowly: ngnix. Two letters are swapped. You can change the image of a running Pod, so one command fixes it:

$ kubectl set image pod/webapp webapp=nginx:1.27
pod/webapp image updated

$ kubectl get pods
NAME     READY   STATUS    RESTARTS   AGE
webapp   1/1     Running   0          35s
Enter fullscreen mode Exit fullscreen mode

Rule of thumb: ImagePullBackOff? Check the image name and tag before anything else.

One-minute version: Kubernetes ImagePullBackOff: Cause and Fix

3. CrashLoopBackOff: Kubernetes is fine, your process isn't

This is the one people misread most.

$ kubectl get pods
NAME     READY   STATUS             RESTARTS      AGE
worker   0/1     CrashLoopBackOff   3 (17s ago)   30s
Enter fullscreen mode Exit fullscreen mode

CrashLoopBackOff sounds like Kubernetes is broken. It isn't. The container starts, the process exits, and the kubelet restarts it, waiting ten seconds, then twenty, then forty, up to five minutes. That waiting is the BackOff. The timer resets once the container has run fine for ten minutes.

$ kubectl describe pod worker
    Command:
      sh
      -c
      echo processing jobs; sleeep 3600
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    127
Enter fullscreen mode Exit fullscreen mode

Exit code 127 means "command not found" in a shell. Now the most useful flag for this status, --previous, which shows the output of the attempt that just died:

$ kubectl logs worker --previous
processing jobs
sh: sleeep: not found
Enter fullscreen mode Exit fullscreen mode

Three e's. Fix the typo and replace the Pod:

$ sed -i 's/sleeep/sleep/' worker.yaml
$ kubectl replace --force -f worker.yaml

$ kubectl get pods
NAME     READY   STATUS    RESTARTS   AGE
worker   1/1     Running   0          10s
Enter fullscreen mode Exit fullscreen mode

Rule of thumb: CrashLoopBackOff? Read logs --previous first.

One-minute version: Kubernetes CrashLoopBackOff: Cause and Fix

4. OOMKilled: hiding behind CrashLoopBackOff

Here's a trap. This Pod also says CrashLoopBackOff, but the cause is completely different.

$ kubectl get pods -n reports
NAME                        READY   STATUS             RESTARTS      AGE
renderer-bfqsczsg7g-pl5bw   0/1     CrashLoopBackOff   3 (15s ago)   30s

$ kubectl describe pod -n reports -l app=renderer
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       OOMKilled
      Exit Code:    137
    Limits:
      memory:  64Mi
    Requests:
      memory:     32Mi
Enter fullscreen mode Exit fullscreen mode

Last State says OOMKilled, exit code 137. 137 is 128 plus 9, and signal 9 is SIGKILL. The process went over its 64Mi memory limit and the kernel killed it, then the kubelet restarted it, again and again.

The team says the app needs about 100Mi normally and 200Mi at month end. A container can use more than its request, but never more than its limit. Set the request to 128Mi and the limit to 256Mi:

$ kubectl set resources deployment renderer -n reports --requests=memory=128Mi --limits=memory=256Mi
deployment.apps/renderer resource requirements updated

$ kubectl rollout status deployment/renderer -n reports --timeout=60s
deployment "renderer" successfully rolled out

$ kubectl get pods -n reports
NAME                        READY   STATUS    RESTARTS   AGE
renderer-lkhgjzqfr6-x67cf   1/1     Running   0          23s
Enter fullscreen mode Exit fullscreen mode

Rule of thumb: CPU limits slow a container down. Memory limits kill it.

One-minute version: Kubernetes OOMKilled (Exit Code 137): Cause and Fix

5. Restarts while the app is fine: a liveness probe

$ kubectl get pods
NAME       READY   STATUS    RESTARTS     AGE
frontend   1/1     Running   7 (1s ago)   40s
Enter fullscreen mode Exit fullscreen mode

Running, ready, and seven restarts in forty seconds. Who keeps killing it?

$ kubectl describe pod frontend
    Liveness:       http-get http://:80/healthz delay=0s timeout=1s period=5s #success=1 #failure=2
Events:
  Warning  Unhealthy  1s (x15 over 37s)  kubelet  Liveness probe failed: HTTP probe failed with statuscode: 404
  Normal   Killing    1s (x7 over 32s)   kubelet  Container nginx failed liveness probe, will be restarted
Enter fullscreen mode Exit fullscreen mode

A liveness probe calls /healthz on port 80 and gets a 404, so the kubelet kills the container and starts it again. The logs from before the restart confirm it:

$ kubectl logs frontend --previous
192.168.56.11 - - [23/Nov/2026:10:00:40 +0000] "GET /healthz HTTP/1.1" 404 146 "-" "kube-probe/1.35" "-"
Enter fullscreen mode Exit fullscreen mode

nginx is healthy. It just has no /healthz page. Keep the difference in mind:

  • A failing liveness probe makes the kubelet kill and restart the container.
  • A failing readiness probe only takes the Pod out of its Services. No restart.

Point the probe at a path that exists (here, /), replace the Pod, and the restarts stop:

$ kubectl get pods
NAME       READY   STATUS    RESTARTS   AGE
frontend   1/1     Running   0          20s
Enter fullscreen mode Exit fullscreen mode

Rule of thumb: a healthy app that keeps restarting? Check the probe.

One-minute version: Kubernetes Pod Keeps Restarting (Liveness Probe): Cause and Fix

Cheat sheet

Status Where to look Usual cause
Pending describe, Events No node fits: a label or a taint
ImagePullBackOff describe, Events Wrong image name or tag, or a private registry without a pull secret
CrashLoopBackOff logs --previous, Last State The process inside exits
OOMKilled (shown as CrashLoopBackOff) describe, Last State Over the memory limit
Restarts, app is fine describe, Events A liveness probe checking the wrong thing

Try it yourself

Every terminal output above comes from PodSim, a free, open-source Kubernetes training simulator I'm building. It runs in your browser, so there's no cluster to set up. Each problem is a lab with its own checks, so you can break it, fix it and see if your fix holds.

Open sdtslmn.github.io/podsim, go to Labs, and pick:

  • I19 for Pending
  • B15 for ImagePullBackOff
  • B16 for CrashLoopBackOff
  • S07 for OOMKilled
  • I11 for the liveness probe restart loop

GitHub logo sdtslmn / podsim

PodSim: Kubernetes training simulator. Practice kubectl on a simulated cluster in the browser or terminal, with guided labs.

PodSim

A Kubernetes training simulator. Practice kubectl on a simulated cluster, in your terminal or in the browser, along a training path from your first Pod to real-life production scenarios. Every lab checks your work automatically, and a CKAD track with two timed mock exams prepares you for the certification.

Nothing here runs real containers. The simulator models how Kubernetes objects behave: the scheduler places Pods on nodes, the kubelet pulls images and starts containers, Deployments roll out new ReplicaSets, Services collect endpoints. You see the same states, events and error messages a real cluster gives you, without installing anything or paying for a cluster.

Try it in the browser: https://sdtslmn.github.io/podsim/

The browser version running the Services lab

Why a simulator

Real practice clusters (Killercoda, KodeKloud, kind, minikube) are great once you know the basics. For a first contact they are often too much: you wait for VMs, things break in ways that have nothing to do…




Next in this series: your Pod is running, but nobody can reach it. Services with no endpoints, readiness probes, DNS, NetworkPolicy and Ingress 404s.

Sources


I post a one-minute Kubernetes fix most days on Kubernetes in a Minute. Questions or a status you keep running into? Leave a comment.

Kubernetes® is a registered trademark of The Linux Foundation. This post is independent and not affiliated with or endorsed by The Linux Foundation or the CNCF.

Top comments (0)