Skip to content
ohsudo, Home

Troubleshooting guide

Kubernetes pod not running? Find the cause, step by step

Pending, CrashLoopBackOff, ImagePullBackOff, or kubectl itself failing.

What does the STATUS column show?

kubectl get pods -n <namespace>

Likely cause

No node can take the pod

The scheduler found no node with enough requested CPU or memory, or the pod asks for something the nodes don't have (a selector, a taint, a volume). The events say which, node by node.

Check it

kubectl describe pod <pod> | sed -n "/^Events:/,$p"
Read the fix: Kubernetes pod stuck in Pending: "0/3 nodes are available: Insufficient cpu"

Not this?Start over

Likely cause

The node can't download the image

A wrong name or tag, missing registry credentials, Docker Hub's rate limit, the network, or an image built for another CPU. The pod's events have the exact pull error.

Check it

kubectl describe pod <pod> | sed -n "/^Events:/,$p"
Read the fix: Kubernetes ImagePullBackOff and ErrImagePull: find out why the image won’t pull

Not this?Start over

Likely cause

The container starts, then exits, again and again

Kubernetes keeps restarting it and waits longer each time. The logs of the previous run and the last exit code (1, 137 for out of memory, 0 for a program that just ends) tell you why.

Check it

kubectl logs <pod> --previous
kubectl describe pod <pod> | grep -A3 "Last State"
Read the fix: Kubernetes CrashLoopBackOff: 7 causes and how to find yours

Not this?Start over

What do the pod's events say?

kubectl describe pod <pod> | sed -n "/^Events:/,$p"

Start over

Likely cause

The node removed the pod to save itself

The node ran low on disk, memory or process IDs and evicted pods. The pod's status says which pressure.

Check it

kubectl get pod <pod> -o jsonpath="{.status.message}"
Read the fix: Kubernetes pods "Evicted": find the pressure on the node, and stop it from coming back

Not this?Start over

What does kubectl say?

Start over

Likely cause

A Secret or ConfigMap the pod needs is missing

The pod takes environment variables from a Secret or ConfigMap that doesn't exist in its namespace, or from a key it doesn't have.

Check it

kubectl get secret,configmap -n <namespace>
Read the fix: Kubernetes CreateContainerConfigError: a missing Secret or ConfigMap, and how to find it

Not this?Start over

Likely cause

The pod must run as non-root, and the image runs as root

A security setting (runAsNonRoot, often from a policy) refuses an image whose user is root, or a name instead of a number. Fix the image's USER, or set runAsUser.

Read the fix: Kubernetes "container has runAsNonRoot and image will run as root": fix the image or the pod

Not this?Start over

Likely cause

kubectl has no kubeconfig

localhost:8080 is what kubectl tries when it found no configuration at all: no ~/.kube/config, the wrong KUBECONFIG, or a command run with sudo.

Check it

kubectl config view --minify
Read the fix: kubectl "The connection to the server localhost:8080 was refused": your kubeconfig is missing

Not this?Start over

Likely cause

kubectl doesn't trust the cluster's certificate

Your kubeconfig has another CA than the cluster now uses (a recreated cluster), or a proxy inspects TLS on the way.

Read the fix: kubectl "x509: certificate signed by unknown authority": your kubeconfig doesn't trust this cluster

Not this?Start over

Likely cause

You're logged in, and RBAC says no

The cluster knows who you are, and no Role or ClusterRole lets you do that. Ask the cluster what you may do, then grant exactly that.

Check it

kubectl auth can-i list pods -n <namespace>
Read the fix: Kubernetes "Forbidden: User cannot list resource": give exactly the rights it needs with RBAC

Not this?Start over

Have an exact error message? Paste it into search instead.

Every cause this guide covers

The same answers, all on one page, if you would rather scan them.

All troubleshooting guides →