Virtualization

Fix Kubernetes CrashLoopBackOff, ImagePullBackOff, and Pending Pods with kubectl (2026 Triage Runbook)

Aseem Kishore
28 min read

The Back Room Tech is reader-supported. We may earn a commission when you buy through links on our site. Learn more.

Your deploy went out and kubectl now shows CrashLoopBackOff, ImagePullBackOff, or Pending in the kubectl get pods output. Each status points to a short list of causes: a bad command, a memory limit that’s too low, a typo’d image tag, missing registry credentials, or a node that can’t fit the pod. Annoyingly, Kubernetes is almost always doing exactly what the spec told it to do.

The triage is the same every time. Run kubectl get pods, then kubectl describe pod, then kubectl get events, then kubectl logs --previous. Read the Last State, Exit Code, and Events lines. Then fix the Deployment (or StatefulSet, Job, or Helm values), not the pod. Below is what each output means and the exact fix for each case.

Prerequisites

  • kubectl installed on Windows, macOS, or in a browser-based cloud shell. Keep the client within one minor version of your cluster’s API server, as the version skew policy requires.
  • A working kubeconfig at ~/.kube/config (macOS/Linux) or %USERPROFILE%\.kube\config (Windows). It must have an active context.
  • RBAC permissions to get, list, and describe pods, read pods/log, list events, and (for the debug section) create pods/ephemeralcontainers.
  • Any conformant Kubernetes cluster. That covers cloud-managed clusters, self-hosted kubeadm clusters, and homelab distros like k3s, minikube, or MicroK8s. The commands work the same on all of them.
  • Optional: metrics-server installed in the cluster if you want kubectl top to work.

Environment and Scope

The commands and output here follow kubectl and Kubernetes behavior for v1.33 through v1.37. v1.37 is the latest minor release, shipped in August 2026; v1.37.1 (September 2026) was its newest patch release when sources were last checked; 1.37.2 is the next scheduled patch. The sample output is illustrative. Pod names, IPs, and ages will differ on your cluster, and some columns are trimmed for width. Official sources were last checked on 2026-10-10.

Confirm what you’re talking to before you start debugging. Plenty of “my fix did nothing” incidents come down to the wrong context or namespace.

kubectl version                       # client and server versions
kubectl config current-context        # which cluster you're targeting
kubectl config view --minify -o jsonpath='{..namespace}'   # active namespace (blank = default)

Client Version: v1.37.1
Kustomize Version: v5.7.1
Server Version: v1.37.0
homelab-k3s
production

Quick Diagnosis: The Four-Command Triage Flow

Use this flow for every failing pod. Each step narrows the cause before you change anything.

Step 1: See the symptom with kubectl get pods

kubectl get pods -n production -o wide   # -o wide adds node and pod IP columns

NAME READY STATUS RESTARTS AGE IP NODE
api-7d9f8c6b5d-x2kqp 0/1 CrashLoopBackOff 6 (2m10s ago) 12m 10.42.1.17 node-2
web-5c8b7f9d4-mz8tw 0/1 ImagePullBackOff 0 8m 10.42.2.9 node-3
worker-6f7d8b9c5-q4jzl 0/1 Pending 0 15m <none> <none>

Terminal output of kubectl get pods -o wide showing three pods with CrashLoopBackOff, ImagePullBackOff, and Pending in the STATUS column, with the RESTARTS column visible showing a non-zero restart count for the CrashLoopBackOff pod

How to read this:

  • A rising RESTARTS count means the container starts and then dies. Go to the CrashLoopBackOff section.
  • RESTARTS stays at 0 and the status mentions an image means the container never started. Go to the ImagePullBackOff section.
  • NODE shows <none> means the scheduler never placed the pod. Go to the Pending section.

Step 2: Read Last State and Events with kubectl describe pod

kubectl describe pod api-7d9f8c6b5d-x2kqp -n production

This is the single most useful command. Skip to two parts of the output: the container’s State / Last State block and the Events table at the bottom.

Step 3: Get wider context with events

kubectl get events -n production --sort-by=.lastTimestamp   # oldest first, newest at the bottom
kubectl events -n production --for=pod/api-7d9f8c6b5d-x2kqp  # kubectl events (beta since v1.26), filtered to one pod

LAST SEEN TYPE REASON OBJECT MESSAGE
14m Normal Scheduled pod/api-7d9f8c6b5d-x2kqp Successfully assigned production/api-7d9f8c6b5d-x2kqp to node-2
12m Warning FailedScheduling pod/worker-6f7d8b9c5-q4jzl 0/3 nodes are available: 3 Insufficient memory.
8m Warning Failed pod/web-5c8b7f9d4-mz8tw Error: ErrImagePull
2m Warning BackOff pod/api-7d9f8c6b5d-x2kqp Back-off restarting failed container api in pod api-7d9f8c6b5d-x2kqp_production

PowerShell window showing kubectl get events --sort-by=.lastTimestamp output with Normal and Warning events, including FailedScheduling, ErrImagePull, and BackOff reasons in chronological order

If your client or shell wrapper lacks kubectl events, the kubectl get events line works on every version; add --field-selector involvedObject.name=POD_NAME to narrow it to one pod.

Events are short-lived. The API server keeps them for 1 hour by default (the --event-ttl flag). If a pod failed overnight, the events may already be gone. Check them early.

Step 4: See what the crashed container printed with kubectl logs --previous

kubectl logs api-7d9f8c6b5d-x2kqp -n production --previous        # -p is the short form
kubectl logs api-7d9f8c6b5d-x2kqp -n production --previous -c api # -c picks a container in multi-container pods

Plain kubectl logs shows the current container instance. During CrashLoopBackOff, that instance is often brand new or waiting to restart. It has little or nothing to show. --previous returns the output of the instance that actually crashed.

If get pods shows Init:CrashLoopBackOff or Init:Error, the failing container is an init container, and the app container never started. Find its name under Init Containers: in describe pod (or initContainerStatuses in -o yaml), then run kubectl logs POD --previous -c INIT_CONTAINER_NAME.

2026-10-10T04:51:02Z INFO starting api v2.4.1
2026-10-10T04:51:02Z INFO loading config from /etc/api/config.yaml
2026-10-10T04:51:03Z FATAL required environment variable DATABASE_URL is not set

Terminal running kubectl logs POD_NAME --previous, with the --previous flag visible in the command line and the output ending in a FATAL error line from the crashed container

The official Debug Pods and Debug Running Pods pages cover the same flow in more detail.

Common Issues: Fix Kubernetes CrashLoopBackOff, ImagePullBackOff, and Pending Pods

Problem: Pod Shows CrashLoopBackOff

Symptoms:

  • STATUS cycles between Running, Error, and CrashLoopBackOff
  • RESTARTS keeps climbing
  • Events show Back-off restarting failed container

Why it happens: The container starts, its main process exits, and the kubelet restarts it. Each restart waits longer than the last. Per the Pod Lifecycle docs, the default delay starts at 10 seconds and doubles each time (10s, 20s, 40s, and so on). It caps at 5 minutes. It resets once the container runs cleanly for 10 minutes. Recent releases add feature gates that can shorten this curve, so check your version’s docs if your timing looks different.

In practice, after a handful of crashes you wait up to 5 minutes between attempts. A fixed pod can look “still broken” for a while unless you roll out a new spec.

Fix:

  • Read the Last State block:
kubectl describe pod api-7d9f8c6b5d-x2kqp -n production

Containers:
api:
Image: registry.example.com/team/api:2.4.1
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: OOMKilled
Exit Code: 137
Started: Sat, 10 Oct 2026 04:58:11 +0000
Finished: Sat, 10 Oct 2026 04:58:39 +0000
Ready: False
Restart Count: 6
Limits:
memory: 128Mi
Requests:
cpu: 100m
memory: 128Mi
Events:
Type Reason Age From Message
—- —— —- —- ——-
Normal Pulled 3m (x7 over 12m) kubelet Container image “registry.example.com/team/api:2.4.1” already present on machine
Warning BackOff 2m (x41 over 11m) kubelet Back-off restarting failed container api in pod api-7d9f8c6b5d-x2kqp_production

kubectl describe pod output for a CrashLoopBackOff pod with the Last State: Terminated block, Reason: OOMKilled, Exit Code: 137 visible, and the Events table at the bottom showing a BackOff warning
  • Match the exit code to its cause:
Exit CodeMeaningWhere to lookTypical fix
1The app hit an error and exitedkubectl logs --previousFix config, env vars, or the bug shown in the log
137 + Reason: OOMKilledThe container went over its memory limit and the kernel killed itLimits in describe outputRaise resources.limits.memory or fix a memory leak
137 without OOMKilledThe container got SIGKILL (128 + 9). Causes include a failed liveness probe, a missed termination grace period, node pressure, or an external killEvents (Liveness probe failed, Killing, eviction messages)Confirm the cause in Events first; for probe kills, add a startupProbe or loosen the liveness timing
127Command not found, usually inside a shell script or sh -ccommand/args in the spec and --previous logsFix the binary path or install the missing tool in the image
126The command was found but can’t be run (permissions or wrong format)--previous logschmod +x the entrypoint in the Dockerfile or fix the shebang
0 + Reason: CompletedThe process exited successfully, but the Deployment expects it to run foreverWorkload typeRun one-off tasks as a Job

One caveat: if the entrypoint binary itself is missing, many runtimes fail before the process starts. Describe then shows Reason: StartError with exit code 128 and a message like exec: "api-server": executable file not found in $PATH. It’s the same fix as 127.

  • Fix the owning workload, then watch the rollout. For an OOMKill:
# -c targets the container named "api"; requests drive scheduling, limits drive OOMKills
kubectl set resources deployment/api -n production -c api --requests=memory=256Mi --limits=memory=512Mi
kubectl rollout status deployment/api -n production

For a failing liveness probe on a slow-starting app, add a startupProbe. The kubelet holds off liveness checks until the startup probe passes:

# deployment.yaml — under spec.template.spec.containers[0]
startupProbe:
  httpGet:
    path: /healthz
    port: 8080
  failureThreshold: 30     # 30 x 5s = up to 150s to start
  periodSeconds: 5
livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
  periodSeconds: 10

If you deploy through GitOps (Argo CD, Flux) or Helm, put the change in the source manifests or values file. A kubectl set change gets reverted on the next sync.

Verification:

kubectl rollout status deployment/api -n production
kubectl get pods -n production -l app=api

deployment “api” successfully rolled out
NAME READY STATUS RESTARTS AGE
api-6b8c9d7f4-r7tnp 1/1 Running 0 94s

Watch the pod for a few minutes. A restart count that stays at 0 past your app’s normal crash window is the real confirmation.

Problem: CreateContainerConfigError From a Missing Secret or ConfigMap

Symptoms:

  • STATUS shows CreateContainerConfigError, often confused with a crash loop
  • Restart count stays at 0
  • Events show Error: secret "api-secrets" not found or configmap "api-config" not found

Why it happens: The pod spec references a Secret or ConfigMap (through env.valueFrom or envFrom) that doesn’t exist in this namespace. The kubelet can’t build the container config, so the container never starts. If the Secret exists but lacks a key your app needs, you get exit code 1 and a log line instead.

Fix:

kubectl get secret,configmap -n production                # does the object exist in THIS namespace?
kubectl describe secret api-secrets -n production         # shows key names and sizes, not values

Create the missing object in the right namespace, or fix the name in the Deployment. Secrets are namespace-scoped. A Secret in default does nothing for a pod in production.

Verification: kubectl get pods -n production shows the pod moving to Running. The kubelet retries on its own, so you don’t need to redeploy once the object and every key the pod references exist. If the status changes to a different error, read the new Events message.

Problem: Container Exits Immediately and Logs Show Nothing

Symptoms:

  • kubectl logs --previous is empty or shows only one unhelpful line
  • kubectl exec fails with container not found or unable to upgrade connection because the container is never running long enough

Why it happens: The process dies before it writes anything. Or the image is minimal (distroless, scratch) with no shell to exec into.

Fix: Use kubectl debug. Ephemeral containers have been stable since Kubernetes 1.25.

Option A: Make a copy of the pod with the command replaced by a shell. This is the best choice for crash-on-start problems. The copy runs sh instead of your entrypoint, so you can poke around at your own pace.

# --copy-to creates a new pod named api-debug from the original spec
# --container=api picks which container's command to override; "-- sh" is the new command
kubectl debug api-7d9f8c6b5d-x2kqp -n production -it --copy-to=api-debug --container=api -- sh

Inside the shell, check what the entrypoint would see:

ls -l /app                     # is the binary there and executable?
cat /etc/api/config.yaml       # did the ConfigMap mount where the app expects it?
printenv DATABASE_URL          # is the env var actually set?
/app/api-server                # run the real entrypoint by hand and watch it fail

If someone on your team already created api-debug, the command fails because the name is taken. Pick a unique name such as api-debug-yourname. Clean up when you’re done. The copy is a standalone pod, so no controller owns it:

kubectl delete pod api-debug -n production

Option B: Attach an ephemeral debug container to the running pod. This works when the app container stays up long enough and you need tools the image doesn’t ship.

# --target shares the process namespace with the "api" container
kubectl debug -it api-7d9f8c6b5d-x2kqp -n production --image=busybox:1.36 --target=api -- sh

From inside, ls /proc/1/root/ shows the app container’s filesystem while its process is alive.

Both options have catches. You can’t remove an ephemeral container once you add it. It stays in the pod spec until the pod is deleted. Option B also does little for a container that’s already dead, since there’s no process to attach to.

If the image has no shell at all (distroless), Option A’s -- sh will fail. Inspect the image on your workstation with docker image inspect registry.example.com/team/api:2.4.1 to check Entrypoint and Cmd. Or run Option A with --image=busybox:1.36 to swap in a debug image.

Verification: You can reproduce the crash by hand inside the debug shell. Then fix the image or Deployment, roll it out, and check kubectl rollout status.

Problem: Pod Shows ImagePullBackOff or ErrImagePull

Symptoms:

  • STATUS alternates between ErrImagePull and ImagePullBackOff
  • RESTARTS stays at 0
  • Events show Failed to pull image

Why it happens: The kubelet on the assigned node asked the container runtime to pull the image, and the pull failed. Pull retries follow the same exponential back-off as crash loops. That’s why the status flips between the two names.

Fix: Confirm the exact image reference, then read the pull error word for word. The message tells you which cause you have.

kubectl get pod web-5c8b7f9d4-mz8tw -n production -o jsonpath='{.spec.containers[*].image}'
kubectl describe pod web-5c8b7f9d4-mz8tw -n production

Events:
Type Reason Age From Message
—- —— —- —- ——-
Normal Pulling 7m (x4 over 8m) kubelet Pulling image “registry.example.com/team/web:2.4.l”
Warning Failed 7m (x4 over 8m) kubelet Failed to pull image “registry.example.com/team/web:2.4.l”: rpc error: code = NotFound desc = failed to pull and unpack image “registry.example.com/team/web:2.4.l”: not found
Warning Failed 7m (x4 over 8m) kubelet Error: ErrImagePull
Normal BackOff 2m (x22 over 8m) kubelet Back-off pulling image “registry.example.com/team/web:2.4.l”

kubectl describe pod Events section for an ImagePullBackOff pod, highlighting the Failed to pull image message containing "not found" for a mistyped tag

That’s a lowercase l where a 1 should be. Easy to miss at 2 a.m. Match the message to the cause:

Message containsCauseFix
not found, manifest unknownTypo in the name or tag, or the tag was never pushedFix the tag (above: 2.4.l instead of 2.4.1) and confirm the push
401 Unauthorized, 403 Forbidden, authorization failedPrivate registry with missing or wrong credentialsCreate imagePullSecrets (below)
pull access denied, repository does not exist or may require authorizationDocker Hub uses one message for both casesCheck the repo name first, then credentials
429 Too Many Requests, toomanyrequestsRegistry rate limit, common on Docker HubAuthenticate pulls, use a mirror, or a pull-through cache
no matching manifest for linux/arm64The image wasn’t built for the node’s CPU architectureBuild a multi-arch image

Typo vs. auth: Try docker pull on your workstation with the exact same reference. If it works logged in but fails logged out, it’s auth. If it fails either way, it’s the name or tag.

Private registry fix:

# Creates a kubernetes.io/dockerconfigjson Secret in the pod's namespace
kubectl create secret docker-registry regcred -n production \
  --docker-server=registry.example.com \
  --docker-username=your-username \
  --docker-password=YOUR_PASSWORD

Then reference it in the pod template:

# deployment.yaml — under spec.template.spec
imagePullSecrets:
  - name: regcred

Or attach it to the namespace’s default ServiceAccount so every pod in that namespace inherits it:

kubectl patch serviceaccount default -n production -p '{"imagePullSecrets": [{"name": "regcred"}]}'

The ServiceAccount patch only affects pods created after the change. Run kubectl rollout restart deployment/web -n production to pick it up.

Architecture mismatch: Check what your nodes run:

kubectl get nodes -L kubernetes.io/arch   # -L adds the label as a column

NAME STATUS ROLES AGE VERSION ARCH
node-1 Ready control-plane,master 41d v1.37.0+k3s1 arm64
node-2 Ready <none> 41d v1.37.0+k3s1 arm64
node-3 Ready <none> 12d v1.37.0+k3s1 amd64

Mixed clusters are common in homelabs, such as a few Raspberry Pi 5 boards next to an x86 mini PC. Build images with docker buildx build --platform linux/amd64,linux/arm64. A single-arch image for the wrong architecture sometimes pulls fine and then crashes with exec format error. That one shows up as CrashLoopBackOff instead.

Verification:

kubectl rollout status deployment/web -n production
kubectl describe pod -n production -l app=web

Look for Successfully pulled image in Events and State: Running.

Problem: Pod Stuck in Pending

Symptoms:

  • STATUS is Pending and NODE is <none>
  • No restarts, no logs (kubectl logs returns nothing or an error)
  • Events show FailedScheduling

Why it happens: The scheduler checked every node and none passed all its filters. The FailedScheduling message lists, node by node, why each one was rejected.

Fix: Read the scheduling message first.

kubectl describe pod worker-6f7d8b9c5-q4jzl -n production

Events:
Type Reason Age From Message
—- —— —- —- ——-
Warning FailedScheduling 15m default-scheduler 0/3 nodes are available: 1 node(s) had untolerated taint {node-role.kubernetes.io/control-plane: }, 2 Insufficient memory. preemption: 0/3 nodes are available: 1 Preemption is not helpful for scheduling, 2 No preemption victims found for incoming pod.

kubectl describe pod Events section for a Pending pod showing a FailedScheduling warning that lists untolerated taint and Insufficient memory reasons

The message tells you which category you’re in:

Phrase in FailedSchedulingCategoryNext command
Insufficient cpu / Insufficient memoryResourceskubectl describe node NODE_NAME
had untolerated taintTaintskubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints
didn't match Pod's node affinity/selectorSelectors / affinitykubectl get nodes --show-labels
unbound immediate PersistentVolumeClaims or volume node affinity conflictStoragekubectl describe pvc PVC_NAME

Resource shortage. The scheduler compares your pod’s requests against each node’s allocatable capacity, minus what’s already requested. It ignores actual usage. Check the Allocated resources section:

kubectl describe node node-2
kubectl top nodes   # actual usage; needs metrics-server

Allocated resources:
Resource Requests Limits
——– ——– ——
cpu 1850m (92%) 3 (150%)
memory 7012Mi (89%) 9Gi (117%)

You can lower the pod’s requests if they’re inflated, scale down something else, or add capacity. In a homelab, adding capacity usually means another node or a RAM upgrade for an existing one.

Taints. Control-plane nodes are tainted by default. If the pod really should run on a tainted node, add a matching toleration:

# deployment.yaml — under spec.template.spec
tolerations:
  - key: "dedicated"
    operator: "Equal"
    value: "gpu"
    effect: "NoSchedule"

Node selectors and affinity. A nodeSelector like disktype: ssd matches nothing if no node carries that label. Either fix the selector or label a node:

kubectl get nodes -L disktype                  # show the label as a column
kubectl label node node-3 disktype=ssd         # add it if the node really qualifies

Quota. A ResourceQuota usually blocks pod creation outright, so you won’t see a Pending pod at all. You’ll see fewer replicas than expected. Check the ReplicaSet instead:

kubectl describe replicaset -n production -l app=worker   # look for FailedCreate "exceeded quota"
kubectl get resourcequota -n production

Verification: kubectl get pods -n production -o wide shows a node name in the NODE column and the status moves past Pending.

Problem: Pending Pod Caused by an Unbound PersistentVolumeClaim

Symptoms:

  • Pod is Pending with pod has unbound immediate PersistentVolumeClaims
  • kubectl get pvc shows STATUS: Pending

Why it happens: The claim can’t find storage. The StorageClass may not exist, or no default StorageClass is set. No static PersistentVolume may match the size and access mode. Or the provisioner (CSI driver) isn’t running.

Fix:

kubectl get pvc -n production
kubectl describe pvc data-pg-0 -n production
kubectl get storageclass

NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
data-pg-0 Pending fast-ssd 14m

Events:
Type Reason Age From Message
—- —— —- —- ——-
Warning ProvisioningFailed 2m (x58 over 14m) persistentvolume-controller storageclass.storage.k8s.io “fast-ssd” not found

kubectl get pvc showing a claim with STATUS Pending and kubectl describe pvc Events showing a ProvisioningFailed warning that the StorageClass was not found

Common messages and what to do:

  • storageclass ... not found: Use a class that kubectl get storageclass actually lists. k3s ships local-path, minikube ships standard, and MicroK8s needs its storage addon enabled.
  • no persistent volumes available for this claim and no storage class is set: Set a default StorageClass or create a matching PersistentVolume.
  • waiting for first consumer to be created before binding: This is normal for WaitForFirstConsumer classes. The claim binds once a pod is scheduled. If the pod is also Pending, fix the pod’s scheduling problem first.

You can’t edit a PVC’s storageClassName or size in place the way you’d edit a Deployment. You usually have to delete and recreate the claim.

Warning: Deleting a PVC can delete its data, depending on the PersistentVolume’s reclaimPolicy. Only delete claims that never bound, or back up first.

For shared storage across nodes, many homelabs point an NFS provisioner at a NAS. That avoids the “volume node affinity conflict” you get when a local-path volume is pinned to one node.

Verification: kubectl get pvc -n production shows Bound, and the pod gets a node assignment.

Problem: Deleting the Pod Doesn’t Fix CrashLoopBackOff

Symptoms:

  • You run kubectl delete pod, a new pod appears within seconds, and it crashes the same way

Why it happens: A Deployment, StatefulSet, DaemonSet, Job, or Helm release owns the pod. Its controller recreates the pod from the same broken template. You reset the back-off timer, and that’s all you did.

Fix: Find the owner and fix the template.

kubectl get pod api-7d9f8c6b5d-x2kqp -n production -o jsonpath='{.metadata.ownerReferences[0].kind}/{.metadata.ownerReferences[0].name}'

ReplicaSet/api-7d9f8c6b5d

A ReplicaSet named api-7d9f8c6b5d belongs to the Deployment api. Edit the Deployment (or your Helm values or Git manifests), apply it, and use kubectl rollout status. If the latest rollout caused the problem, roll back:

kubectl rollout undo deployment/api -n production

Verification: kubectl rollout status deployment/api -n production reports success, and kubectl get pods shows new pod names with RESTARTS 0.

Error Messages Quick Reference

SymptomCommand to runLikely causeFix
CrashLoopBackOff, exit 1kubectl logs POD --previousApp error, missing env var or configFix config or code, then roll out
CrashLoopBackOff, exit 137, OOMKilledkubectl describe pod PODMemory limit too low or leakRaise limits.memory
CrashLoopBackOff, exit 137, no OOMKilledkubectl describe pod POD (Events)SIGKILL: often a liveness probe killing a slow start; confirm in EventsAdd startupProbe if Events show probe failures
CrashLoopBackOff, exit 127 / StartErrorkubectl describe pod PODCommand or binary not foundFix command/args or the image
CrashLoopBackOff, exit 126kubectl logs POD --previousEntrypoint not executablechmod +x in Dockerfile
CrashLoopBackOff, exec format errorkubectl get nodes -L kubernetes.io/archWrong-arch imageBuild multi-arch
CreateContainerConfigErrorkubectl describe pod PODMissing Secret or ConfigMapCreate it in the right namespace
ErrImagePull, not foundkubectl get pod POD -o jsonpath='{.spec.containers[*].image}'Typo or unpushed tagFix the image reference
ImagePullBackOff, 401/403kubectl describe pod PODMissing imagePullSecretsCreate and reference regcred
ImagePullBackOff, 429kubectl describe pod PODRegistry rate limitAuthenticate pulls or mirror
Pending, Insufficient memorykubectl describe node NODERequests exceed free capacityLower requests or add nodes
Pending, untolerated taintkubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taintsNo matching tolerationAdd a toleration
Pending, didn't match ... affinity/selectorkubectl get nodes --show-labelsSelector matches no nodeFix selector or label a node
Pending, unbound ... PersistentVolumeClaimskubectl describe pvc PVCBad StorageClass or no PVFix the class or provision a volume
Fewer replicas than expected, no Pending podkubectl describe replicaset RSResourceQuota exceededRaise quota or lower requests

Platform-Specific Issues

The kubectl commands are identical everywhere. The differences come from the shell around them.

On Windows

Install with winget, then check the client:

winget install -e --id Kubernetes.kubectl
kubectl version --client
Windows 11 desktop with Windows Terminal open on a PowerShell tab showing the completed winget install of Kubernetes.kubectl followed by kubectl version --client output

JSONPath quoting. In PowerShell, single quotes work as shown here. In cmd.exe, single quotes pass through literally and break the query. Use double quotes there: -o jsonpath="{.spec.containers[*].image}".

JSON patches. PowerShell mangles inline JSON for kubectl patch -p. Put the patch in a file and pass it with --patch-file:

# patch.json contains: {"imagePullSecrets": [{"name": "regcred"}]}
kubectl patch serviceaccount default -n production --patch-file patch.json

Filtering output. There’s no grep by default. Use Select-String instead:

kubectl describe pod api-7d9f8c6b5d-x2kqp -n production | Select-String "Exit Code","Reason"

Kubeconfig location. The default is $env:USERPROFILE\.kube\config. If $env:KUBECONFIG is set in your profile, it wins. That’s a common source of “wrong cluster” confusion.

On macOS

Install with Homebrew:

brew install kubectl
kubectl version --client
macOS desktop with Terminal open showing brew install kubectl completing and kubectl version --client printing the client version

zsh globbing. macOS uses zsh by default, and zsh treats [*] as a glob. An unquoted JSONPath fails with zsh: no matches found. Keep the single quotes.

Apple Silicon builds. A plain docker build on an M-series Mac produces linux/arm64 images. Push one to an x86 cluster and you’ll get no matching manifest for linux/amd64 (ImagePullBackOff) or exec format error (CrashLoopBackOff). Build for the cluster explicitly:

docker buildx build --platform linux/amd64,linux/arm64 -t registry.example.com/team/api:2.4.2 --push .

Docker Desktop’s context. If you enabled Kubernetes in Docker Desktop, it adds a docker-desktop context and may switch to it. Run kubectl config get-contexts before you debug a remote cluster.

On Web (Browser-Based Shells)

Browser-based terminals, such as cloud provider shells and Kubernetes training playgrounds, come with kubectl preinstalled. The triage commands are the same. Three things differ:

  • The kubectl version is set by the shell’s maintainer and may lag your cluster. Check kubectl version and stay within the supported skew.
  • Sessions time out. Long kubectl logs -f or kubectl debug -it sessions may disconnect. A debug copy pod (--copy-to) survives the disconnect, so remember to delete it.
  • The home directory may be ephemeral or small. Merged kubeconfig files and saved YAML can vanish between sessions.

Keep the official reference open in another tab while you work:

Kubernetes documentation Debug Running Pods page at the Debugging with an ephemeral debug container section

Configuration Issues

These settings are behind most of the failures above.

Wrong context or namespace. Set the namespace once instead of relying on memory:

kubectl config set-context --current --namespace=production

Requests and limits set to the wrong scale. Mi and M are different units. And m means millicores for CPU but milli-bytes for memory. memory: 512m means 0.512 bytes, effectively nothing, and the API server will happily accept it.

# Wrong — 512 millibytes
resources:
  limits:
    memory: 512m

# Right — 512 mebibytes
resources:
  requests:
    cpu: 250m
    memory: 256Mi
  limits:
    memory: 512Mi

Liveness probe without a startup probe. A liveness probe with initialDelaySeconds: 5 on an app that takes 60 seconds to warm up will kill it every time. Use a startupProbe, as shown in the CrashLoopBackOff section.

imagePullSecrets in the wrong namespace. The Secret must live in the same namespace as the pod. Copying the YAML from another namespace without changing metadata.namespace is a classic mistake.

command vs. args. In Kubernetes, command replaces the image’s ENTRYPOINT and args replaces CMD. Set command: ["--port=8080"] when you meant args and you’ll get a 127 or StartError.

Getting Help

When the four-command flow doesn’t explain it, collect more data:

  • kubectl’s own verbosity: add -v=6 to see API requests, or -v=8 to see request and response bodies. This helps with RBAC and auth errors.
  • Kubelet logs on the node: journalctl -u kubelet on kubeadm clusters, journalctl -u k3s (servers) or journalctl -u k3s-agent (agents) on k3s, and minikube logs on minikube.
  • Container runtime logs: journalctl -u containerd on most nodes.
  • Full cluster snapshot: kubectl cluster-info dump -n production --output-directory=./dump. Review it for secrets before you share it.
  • Termination messages: Set terminationMessagePolicy: FallbackToLogsOnError on the container. If the container exits with an error and wrote no termination message file, Kubernetes stores the last chunk of its log output (at most 2048 bytes or 80 lines, whichever is smaller) as the termination message, which describe pod shows under Last State. It’s a short tail, not a replacement for kubectl logs --previous.

Community and official resources:

If you’re tired of typing these commands, k9s shows pods, events, and logs in live terminal panes. It reads the same data kubectl does, so the reasoning here still applies.

Prevention Tips

  • Set requests and limits on every container. Requests keep the scheduler honest, which prevents surprise Pending pods. Size memory limits from real usage (kubectl top pods over a normal load cycle, plus headroom) to prevent OOMKills. A namespace LimitRange supplies defaults for anyone who forgets.
  • Add startup probes to anything slow to boot. JVM apps, databases, and apps that run migrations on start are the usual suspects.
  • Pin images. Never deploy :latest. Use an immutable version tag, or better, a digest (registry.example.com/team/api@sha256:...). That rules out typo’d tags and surprise upstream changes.
  • Build multi-arch images if your cluster mixes arm64 and amd64 nodes.
  • Mirror public images. A pull-through cache or private registry avoids Docker Hub rate limits during a big rollout or node replacement.
  • Gate rollouts. Run kubectl rollout status deployment/NAME --timeout=180s in CI so a crash loop fails the pipeline before it reaches users. Set progressDeadlineSeconds on Deployments so stuck rollouts get flagged.
  • Validate manifests before applying. kubectl apply --dry-run=server -f deployment.yaml catches schema errors and quota rejections without changing anything.
  • Protect your homelab control plane. Put nodes and storage on a UPS. Unclean power loss is a common cause of corrupted local-path volumes and the odd Pending pods that follow.
Help & Answers

Frequently Asked Questions

7 questions

What does CrashLoopBackOff’s exponential backoff mean for retry timing?

The kubelet waits 10 seconds after the first crash, then 20, 40, 80, and so on, capped at 5 minutes. The timer resets after the container runs for 10 minutes without crashing. Some recent Kubernetes releases add feature gates to tune these values, so check the Pod Lifecycle docs for your version.

Rolling out a fixed spec creates new pods with a fresh timer. That’s why kubectl rollout status shows results faster than waiting on the old pod.

How do I read exit codes 1, 137, 127, and 126 in kubectl describe pod?

Look under Last State: Terminated for Exit Code and Reason. 1 is an app error, so check the logs. 137 is SIGKILL.

With Reason: OOMKilled it’s the memory limit (our OOMKilled troubleshooting guide covers the fix). Without it, something else sent SIGKILL: a failed liveness probe, a missed grace period, node pressure, or an external kill. Check the Events table to see which.

127 means command not found. 126 means the command exists but can’t be executed. Codes above 128 are always 128 plus a signal number, so 143 is SIGTERM.

Why does kubectl logs show nothing useful, and what should I run instead?

Plain kubectl logs reads the current container instance, which may have just restarted. Run kubectl logs POD --previous to get the crashed instance’s output.

Add -c CONTAINER for multi-container pods, or -c INIT_CONTAINER_NAME if the status is Init:CrashLoopBackOff. If even --previous is empty, use kubectl debug --copy-to to run the entrypoint by hand.

How do I tell if ImagePullBackOff is a typo or a registry auth problem?

Read the Events message in kubectl describe pod. not found or manifest unknown points to the name or tag. 401, 403, or unauthorized points to credentials.

Docker Hub’s pull access denied ... may require authorization can mean either. Try docker pull on your workstation, logged in and logged out, to tell them apart.

How do I know if a Pending pod is a resource, taint/affinity, or storage problem?

The FailedScheduling event spells it out. Insufficient cpu or Insufficient memory is resources. untolerated taint is taints. didn't match Pod's node affinity/selector is labels. unbound immediate PersistentVolumeClaims is storage. One message can list several reasons across different nodes, so fix the one that applies to the nodes you actually want the pod on.

Why doesn’t deleting the pod fix CrashLoopBackOff?

A controller owns the pod and recreates it from the same template. Fix the Deployment, StatefulSet, or Helm values, then confirm with kubectl rollout status. Use kubectl rollout undo if the last change caused it.

How do I prevent these failures after the next deploy?

Set realistic requests and limits, add startup probes to slow-starting apps, pin images by version or digest, and gate CI on kubectl rollout status. Those four habits cover most CrashLoopBackOff, ImagePullBackOff, and Pending incidents.

Wrapping Up

Every broken pod gets the same four commands: get pods, describe, events, logs --previous. The exit code or event message tells you which fix applies, and it’s usually sitting in the Last State and Events lines of kubectl describe pod. Deleting pods or redeploying blind costs far more than the 30 seconds it takes to read those lines.

StepActionApplies To
1kubectl get pods -o wideAll failures
2kubectl describe pod POD (Last State, Exit Code, Events)All failures
3kubectl get events --sort-by=.lastTimestampPending, node-level issues
4kubectl logs POD --previousCrashLoopBackOff
5kubectl debug --copy-to ... -- shContainers that exit instantly
6Fix the Deployment, then kubectl rollout statusAll failures

Last updated: 2026-10-10 | Applies to kubectl (Kubernetes Command-Line Tool) v1.33–v1.37 on Windows, macOS, and browser-based shells