Why it will not run: scheduling, quotas, images, crashes and evictions
Diagnose five broken workloads on your kind cluster, one per failure mode, using get, describe, events, logs, exec and debug; then learn how node-pressure evictions differ from all of them.
Contentsand lesson path
On this page
- The problem
- Step 1: Read the STATUS column, but know what it is
- Step 2: Pending and ImagePullBackOff
- Step 3: Two kinds of CrashLoopBackOff
- Step 4: A Pod that never existed
- Step 5: Look inside with exec and debug
- Evictions and node pressure
- Check your understanding
- Apply it
- Review prompt
Lessons of Kubernetes Fundamentals
- Desired state: controllers, built-in objects and custom resources Concept · 20 min
- Lab: deploy, configure and expose a service with honest probes, requests and limits Lab · 40 min
- Lab: rollouts, rollbacks, autoscaling and environment overlays Lab · 30 min
- Lab: Jobs, StatefulSets and persistent volumes Lab · 30 min
- Why it will not run: scheduling, quotas, images, crashes and evictions Worked example · 25 min
- Check: repair broken workloads against the clock Knowledge check · 10 questions
What you will learn
- Debug Pending, CrashLoopBackOff and ImagePullBackOff workloads using describe, logs, events and exec.
Prerequisites: Containerization
01. The problem
Five Deployments will not run, each for a different reason. Your job is to name the state, find the evidence that proves the cause, and state the fix, without restarting anything at random. You need the kind cluster from lesson 2, with its web Deployment still running in default.
Save the manifest below as broken.yaml; case 5 adds two small files of its own. Cluster outputs in this lesson are illustrative and long lines are cut with an ellipsis; the one log line in case 3 is what Python prints for that error.
apiVersion: v1
kind: Namespace
metadata:
name: triage
---
apiVersion: apps/v1
kind: Deployment
metadata: {name: bad-tag, namespace: triage}
spec:
selector: {matchLabels: {app: bad-tag}}
template:
metadata: {labels: {app: bad-tag}}
spec:
containers:
- name: app
image: docker.io/library/python:3.31-alpine
command: ["sleep", "3600"]
---
apiVersion: apps/v1
kind: Deployment
metadata: {name: no-node, namespace: triage}
spec:
selector: {matchLabels: {app: no-node}}
template:
metadata: {labels: {app: no-node}}
spec:
nodeSelector: {disktype: ssd}
containers:
- name: app
image: docker.io/library/python:3.13-alpine
command: ["sleep", "3600"]
---
apiVersion: apps/v1
kind: Deployment
metadata: {name: oom, namespace: triage}
spec:
selector: {matchLabels: {app: oom}}
template:
metadata: {labels: {app: oom}}
spec:
containers:
- name: app
image: docker.io/library/python:3.13-alpine
command: ["python", "-c", "import time; b = b'x' * 2**28; time.sleep(3600)"]
resources:
requests: {memory: 64Mi}
limits: {memory: 64Mi}
---
apiVersion: apps/v1
kind: Deployment
metadata: {name: no-env, namespace: triage}
spec:
selector: {matchLabels: {app: no-env}}
template:
metadata: {labels: {app: no-env}}
spec:
containers:
- name: app
image: docker.io/library/python:3.13-alpine
command: ["python", "-c", "import os; print(os.environ['DATABASE_URL'])"]02. Step 1: Read the STATUS column, but know what it is
kubectl apply -f broken.yaml
sleep 60
kubectl get pods -n triage
kubectl get pods -n triage -o custom-columns=NAME:.metadata.name,PHASE:.status.phaseNAME READY STATUS RESTARTS AGE
bad-tag-6c8f9d7b4-k2x9p 0/1 ImagePullBackOff 0 61s
no-env-5d7b8c9f6-m4q7z 0/1 CrashLoopBackOff 3 (24s ago) 61s
no-node-7f9c6d5b8-r8t2v 0/1 Pending 0 61s
oom-84d6c7b9f5-w3n6j 0/1 CrashLoopBackOff 3 (19s ago) 61s
NAME PHASE
bad-tag-6c8f9d7b4-k2x9p Pending
no-env-5d7b8c9f6-m4q7z Running
no-node-7f9c6d5b8-r8t2v Pending
oom-84d6c7b9f5-w3n6j RunningThe STATUS column is a summary that kubectl builds from container states; it is not the Pod phase. A Pod phase is only ever Pending, Running, Succeeded, Failed or Unknown. Pending covers both "not scheduled yet" and "scheduled, but images not pulled or containers not started". A crash-looping Pod is Running: its container has run and keeps being restarted. Alerts and field selectors work on phases, so status.phase=Running happily includes crash loops.
The order of work that follows is the same every time: get to see which state, describe to read the events and container states, logs --previous once a container has run, exec or debug to look inside, and for anything that never became a Pod, the events of the owner.
03. Step 2: Pending and ImagePullBackOff
kubectl describe pod -n triage -l app=no-node | sed -n '/^Events:/,$p'
kubectl describe pod -n triage -l app=bad-tag | sed -n '/^Events:/,$p'Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 75s default-scheduler 0/1 nodes are available: 1 node(…
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Pulling 74s kubelet Pulling image "docker.io/library/python:3.31-alpine"
Warning Failed 72s kubelet Failed to pull image "docker.io/library/python:3.3…
Warning Failed 72s kubelet Error: ErrImagePull
Normal BackOff 20s kubelet Back-off pulling image "docker.io/library/python:3…
Warning Failed 20s kubelet Error: ImagePullBackOffCase 1, no-node. The full event reads 0/1 nodes are available: 1 node(s) didn't match Pod's node affinity/selector. A FailedScheduling event means the scheduler found no node that satisfies everything the Pod demands: resource requests, node selector or affinity, untolerated taints, or volume constraints such as a claim that cannot bind. The message counts nodes per reason, so read it to the end. There are no logs, because no container ever started. Fix: correct the selector, or label a node that really has the property (kubectl label node k8s-lab-control-plane disktype=ssd).
Case 2, bad-tag. The kubelet tried to pull and the registry answered not found. The Pod stays Pending and the kubelet retries with a growing back-off, shown as ImagePullBackOff. not found points to a wrong name or tag; pull access denied or unauthorized points to a private registry without credentials, fixed with imagePullSecrets on the Pod or its service account; a timeout points to node networking or DNS. Fix: use a tag that exists, ideally one you have pulled yourself.
04. Step 3: Two kinds of CrashLoopBackOff
kubectl logs -n triage deploy/no-env --previous | tail -n 1
kubectl describe pod -n triage -l app=oom | grep -A6 '^ State:'KeyError: 'DATABASE_URL' State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: OOMKilled
Exit Code: 137
Started: Fri, 30 Oct 2026 10:02:11 +0000
Finished: Fri, 30 Oct 2026 10:02:12 +0000Case 3, no-env. CrashLoopBackOff means the image is fine and the process started, then exited, and the kubelet is waiting longer before each restart (10 s, 20 s, 40 s and so on, up to five minutes). The current container may have only just started, so read the one that died with --previous. Its last line names a missing variable, and describe shows Last State: Terminated, Reason: Error, Exit Code: 1. Fix: supply DATABASE_URL, usually from a Secret with secretKeyRef.
Case 4, oom. Same STATUS, different cause. Reason: OOMKilled with exit code 137 means the kernel killed the container for using more memory than its limit; the program tried to hold 256 MiB under a 64 MiB limit. Exit code 137 alone only means SIGKILL (128 + 9), which also happens when a container ignores SIGTERM until the grace period ends, so confirm the reason before you touch limits. Fix: measure real usage (kubectl top pod) and set the limit above it, or fix the leak.
05. Step 4: A Pod that never existed
Case 5, capped. A ResourceQuota is checked by the API server when an object is created. A Pod that would exceed it is refused with 403 Forbidden, so it never exists: there is no Pending Pod to describe. The ReplicaSet controller keeps trying and records FailedCreate events on the ReplicaSet. The quota lives in its own namespace here, because a CPU quota also refuses Pods that set no CPU request.
apiVersion: v1
kind: Namespace
metadata:
name: quota-demo
---
apiVersion: v1
kind: ResourceQuota
metadata: {name: cpu-cap, namespace: quota-demo}
spec:
hard:
requests.cpu: 200mapiVersion: apps/v1
kind: Deployment
metadata: {name: capped, namespace: quota-demo}
spec:
replicas: 3
selector: {matchLabels: {app: capped}}
template:
metadata: {labels: {app: capped}}
spec:
containers:
- name: app
image: docker.io/library/python:3.13-alpine
command: ["sleep", "3600"]
resources:
requests: {cpu: 100m, memory: 32Mi}
limits: {memory: 32Mi}kubectl apply -f quota.yaml
sleep 5
kubectl apply -f capped.yaml
sleep 20
kubectl get deployment capped -n quota-demo
kubectl get events -n quota-demo --field-selector reason=FailedCreate \
-o custom-columns=OBJECT:.involvedObject.name,MESSAGE:.message
kubectl describe resourcequota cpu-cap -n quota-demoNAME READY UP-TO-DATE AVAILABLE AGE
capped 2/3 2 2 20s
OBJECT MESSAGE
capped-5c9d8f7b6 Error creating: pods "capped-5c9d8f7b6-x2p9l" is forbidden: exceed…
Name: cpu-cap
Namespace: quota-demo
Resource Used Hard
-------- ---- ----
requests.cpu 200m 200mThe full message ends with exceeded quota: cpu-cap, requested: requests.cpu=100m, used: requests.cpu=200m, limited: requests.cpu=200m. A Deployment that shows fewer ready replicas than desired, with no Pending Pods, is the signature of this case; kubectl describe rs or the namespace events show it. Fix: lower the requests, remove unused workloads from the namespace, or ask for a larger quota.
06. Step 5: Look inside with exec and debug
When a Pod runs but behaves wrongly, check what the process actually sees. kubectl exec runs a command in a running container; it needs a shell or tool inside the image. The first four lines below are typed one after another: the second and third run inside the web container. Many production images have no shell at all (distroless images, for example). kubectl debug then adds an ephemeral container with your tools to the running Pod; --target shares the process namespace of the named container, so ps shows its processes.
kubectl exec -it deploy/web -- sh
env | grep -E 'GREETING|APP_VERSION'
wget -qO- localhost:8080/ready
exit
POD=$(kubectl get pods -l app=web -o jsonpath='{.items[0].metadata.name}')
kubectl debug -it "$POD" --image=busybox:1.37 --target=app -- psGREETING=hello
APP_VERSION=v1
ok
PID USER TIME COMMAND
1 root 0:00 python /app/app.py
14 root 0:00 psYou cannot exec into a container that exits within a second. For case 3, make a copy of the Pod with the command replaced by a shell, inspect it, then delete the copy:
NOENV=$(kubectl get pods -n triage -l app=no-env \
-o jsonpath='{.items[0].metadata.name}')
kubectl debug -n triage "$NOENV" -it --copy-to=no-env-debug --container=app -- sh
env | grep DATABASE_URL || echo "DATABASE_URL is not set"
exit
kubectl delete pod -n triage no-env-debug07. Evictions and node pressure
An Evicted Pod was running fine until its node ran short of a resource. The kubelet watches eviction signals; the default hard thresholds on Linux are memory.available<100Mi, nodefs.available<10%, imagefs.available<15%, nodefs.inodesFree<5% and imagefs.inodesFree<5%. When one is crossed, the node reports MemoryPressure or DiskPressure, the kubelet first tries to reclaim node-level resources (for disk, it deletes unused images and dead containers), and then evicts Pods. It picks first the Pods whose usage of that resource exceeds their requests, ordered by priority and then by how far over they are. BestEffort Pods have no requests, so they are usually first; Guaranteed Pods are rarely chosen but are not exempt.
Do not confuse this with image garbage collection. imageGCHighThresholdPercent (85% by default) makes the kubelet delete unused images when image disk usage goes above it; it does not evict Pods. To avoid disk evictions, set ephemeral-storage requests and limits, keep logs on stdout so the kubelet rotates them, and do not write large files into the container filesystem.
When many Pods fail at once, check what they share before blaming a node. If they share a node (kubectl get pods -A -o wide), run kubectl describe node and read its conditions. If they are spread across nodes, suspect a shared dependency: cluster DNS, a database, a recently changed Secret or ConfigMap, a NetworkPolicy, or expired registry credentials.
08. Check your understanding
09. Apply it
Fix all five workloads and confirm each one reaches 1/1 Running (or 3/3 for capped, after raising the quota). Then prepare for the skill project, where a setup script breaks three workloads for you: write a one-page runbook with the order of commands from step 1, the event or field that proves each cause, and the fix. Clean up with kubectl delete namespace triage quota-demo.
10. Review prompt
Without looking back, explain: the five Pod phases and why STATUS is not one of them; which events prove a scheduling failure, a bad image reference and a missing credential; why --previous matters for crash loops; how to tell an OOM kill from another SIGKILL; where to look when a quota refuses Pods; when to use exec, an ephemeral debug container and a debug copy; and what triggers a node-pressure eviction compared with image garbage collection.
References
Your progress
Reading state
Sign in to save that you finished reading this lesson.
Prove this skill
10 questions · about 8 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.