By the end you'll know
- The eight stages every app passes on its way to working, and how to tell which one it stopped at
- A checklist of commands, in order, that finds the cause instead of guessing
- Why "check the logs" is so often a dead end, and when logs do help
- What eleven common failures look like, seven in your apps and four in the cluster itself
- How to tell "my app is broken" from "the cluster is broken"
Where it stopped
When something's broken, the reflex is to read the logs. Often there aren't any: a pod that was never placed on a node, or whose image never downloaded, never ran a single line of code, so there's nothing to log. The logs aren't hiding the answer; you're looking in the wrong place.
Every app goes through the same stages, in the same order, on its way from your YAML to answering requests. When something's broken, it stopped at one of them, and each stage has its own place to look. Find the stage first, and the right command follows.
kubectl get pods is the tracking page.| Stage | Means | Done by |
|---|---|---|
| 1. Accepted | The API server took your YAML and stored it | API server |
| 2. Scheduled | A node was chosen for the pod | Scheduler |
| 3. Image pulled | That node downloaded the container image | Kubelet, on the node |
| 4. Container created | Its settings, Secrets and volumes were attached | Kubelet |
| 5. Running | The program started, and stayed up | Your code |
| 6. Ready | Its readiness check passes (Lesson 6) | Your code, and its probe |
| 7. Reachable inside | A Service finds it and sends it traffic (Lesson 8) | Service, endpoints |
| 8. Reachable outside | The Gateway and DNS route outside traffic to the Service (Lesson 12) | Gateway, DNS |
The checklist
Always in this order, and stop at the step that explains it.
| Step | Run | Answers |
|---|---|---|
| 1 | kubectl get pods | Which stage: the STATUS, READY and RESTARTS columns |
| 2 | kubectl describe pod NAME | Why, for stages 2 to 4: read the Events at the bottom, and Last State for a container that stopped |
| 3 | kubectl logs NAME, then --previous | Why, for stages 5 and 6: what the program said before it stopped |
| 4 | kubectl get events --sort-by=.lastTimestamp | The whole namespace's story, in order, when one pod's events aren't enough |
| 5 | kubectl get endpointslices -l kubernetes.io/service-name=NAME | Stage 7: whether the Service found any pods, and whether they're ready |
| 6 | A throwaway curl pod, then curl from outside | Stages 7 and 8: whether a real request works |
| 7 | kubectl get nodes, kubectl get pods -n kube-system | Whether the cluster itself is the problem. Go here first when several apps break at once. |
Step 2 is the one people skip. describe prints a lot, and the answer is in the last ten lines, under Events. Scroll to the bottom first, every time.
Seven broken apps
You'll need the kind cluster from Lesson 2, with its three nodes. If you deleted it, make it again with the same kind-learn.yaml:
kind create cluster --name learn --config kind-learn.yaml
kubectl wait --for=condition=Ready nodes --all --timeout=180s
kubectl wait matters here. A brand-new node refuses new pods for its first few seconds, until its networking is up, and in a first attempt at this lab, without the wait, every pod's first event was the same: 0/3 nodes are available: 3 node(s) had untolerated taint(s). That's a real failure you'll meet after adding nodes; here it would hide the ones you came for.
Save the seven apps as mysteries.yaml. Each one is broken in a different way; try not to read the comments too closely before you've diagnosed them.
mysteries.yaml: seven small apps, each broken on purpose
# 1. typo
apiVersion: apps/v1
kind: Deployment
metadata:
name: typo
spec:
replicas: 1
selector:
matchLabels: {app: typo}
template:
metadata:
labels: {app: typo}
spec:
containers:
- name: web
image: nginx:1.27-alpne
---
# 2. crash
apiVersion: apps/v1
kind: Deployment
metadata:
name: crash
spec:
replicas: 1
selector:
matchLabels: {app: crash}
template:
metadata:
labels: {app: crash}
spec:
containers:
- name: menu
image: busybox:1.37
command: ["sh", "-c", "echo 'starting the menu service'; echo 'error: MENU_DB is not set'; exit 1"]
---
# 3. greedy
apiVersion: apps/v1
kind: Deployment
metadata:
name: greedy
spec:
replicas: 1
selector:
matchLabels: {app: greedy}
template:
metadata:
labels: {app: greedy}
spec:
containers:
- name: report
image: python:3.13-alpine
command: ["python", "-c", "print('building the daily report', flush=True); x = bytearray(200 * 1024 * 1024); print('done')"]
resources:
requests: {memory: 32Mi}
limits: {memory: 64Mi}
---
# 4. too-big
apiVersion: apps/v1
kind: Deployment
metadata:
name: too-big
spec:
replicas: 1
selector:
matchLabels: {app: too-big}
template:
metadata:
labels: {app: too-big}
spec:
containers:
- name: web
image: nginx:1.27-alpine
resources:
requests: {cpu: "64"}
---
# 5. missing-config
apiVersion: apps/v1
kind: Deployment
metadata:
name: missing-config
spec:
replicas: 1
selector:
matchLabels: {app: missing-config}
template:
metadata:
labels: {app: missing-config}
spec:
containers:
- name: web
image: nginx:1.27-alpine
envFrom:
- configMapRef: {name: bakery-settings}
---
# 6. not-ready
apiVersion: apps/v1
kind: Deployment
metadata:
name: not-ready
spec:
replicas: 1
selector:
matchLabels: {app: not-ready}
template:
metadata:
labels: {app: not-ready}
spec:
containers:
- name: web
image: nginx:1.27-alpine
readinessProbe:
httpGet: {path: /ready, port: 80}
periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
name: not-ready
spec:
selector: {app: not-ready}
ports:
- port: 80
---
# 7. menu
apiVersion: apps/v1
kind: Deployment
metadata:
name: menu
spec:
replicas: 1
selector:
matchLabels: {app: menu}
template:
metadata:
labels: {app: menu}
spec:
containers:
- name: web
image: nginx:1.27-alpine
---
apiVersion: v1
kind: Service
metadata:
name: menu
spec:
selector: {app: menus}
ports:
- port: 80
Give them their own namespace, so cleaning up is one command, and wait a minute and a half for them to fail:
kubectl create namespace mysteries
kubectl apply -n mysteries -f mysteries.yaml
deployment.apps/typo created
deployment.apps/crash created
deployment.apps/greedy created
deployment.apps/too-big created
deployment.apps/missing-config created
deployment.apps/not-ready created
service/not-ready created
deployment.apps/menu created
service/menu created
Everything was accepted: stage 1 passed for all seven. A typo in the YAML's structure would have failed right here, with an error from kubectl apply. These are mistakes the API server can't see.
Step 1: which stage?
kubectl get pods -n mysteries
NAME READY STATUS RESTARTS AGE
crash-85f877779c-m9l5r 0/1 Error 3 (73s ago) 90s
greedy-75df67ffdd-kknvm 0/1 OOMKilled 3 (74s ago) 90s
menu-56cb4cc4c4-qg4qq 1/1 Running 0 90s
missing-config-7f5968cc5c-j5wwn 0/1 CreateContainerConfigError 0 90s
not-ready-84d768d7f7-vmwf4 0/1 Running 0 90s
too-big-58bfc7f87b-lnnvj 0/1 Pending 0 90s
typo-dbb9dc4d8-smncs 0/1 ImagePullBackOff 0 90s
One command, and six of the seven have already said which stage they stopped at:
| App | Status | Stopped at | So look at |
|---|---|---|---|
| too-big | Pending | 2. Scheduled | describe, Events |
| typo | ImagePullBackOff | 3. Image pulled | describe, Events |
| missing-config | CreateContainerConfigError | 4. Container created | describe, Events |
| crash | Error, restarts climbing | 5. Running | logs |
| greedy | OOMKilled, restarts climbing | 5. Running | describe, Last State; then logs |
| not-ready | Running, 0/1 | 6. Ready | describe, Events |
| menu | Running, 1/1 | Looks fine | The pod is fine. The problem is after it: stage 7. |
crash says Error, not CrashLoopBackOff. The status flips between the two: Error while the container has just exited, CrashLoopBackOff while Kubernetes waits, longer each time, before restarting it. The tell is the RESTARTS column climbing, not the exact word.
1. typo: the image doesn't exist
kubectl describe pod -n mysteries -l app=typo
The Events, at the bottom:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 90s default-scheduler Successfully assigned mysteries/typo-dbb9dc4d8-smncs to learn-worker
Normal BackOff 11s (x5 over 88s) kubelet Back-off pulling image "nginx:1.27-alpne"
Warning Failed 11s (x5 over 88s) kubelet Error: ImagePullBackOff
Normal Pulling 0s (x4 over 90s) kubelet Pulling image "nginx:1.27-alpne"
Warning Failed 0s (x4 over 89s) kubelet Failed to pull image "nginx:1.27-alpne": rpc error: code = NotFound desc = failed to pull and unpack image "docker.io/library/nginx:1.27-alpne": failed to resolve reference "docker.io/library/nginx:1.27-alpne": docker.io/library/nginx:1.27-alpne: not found
Warning Failed 0s (x4 over 89s) kubelet Error: ErrImagePull
Scheduled passed; the pull failed with not found. alpne for alpine. Read the From column too: default-scheduler did its part, and the kubelet on the node is the one reporting the problem. x5 over 88s means the same event happened five times; Kubernetes keeps trying, waiting longer each time, which is the "BackOff". Other messages at this stage mean other causes: unauthorized or pull access denied is a private image without credentials, and a timeout is a node that can't reach the registry.
Fix the image, and watch the Deployment replace the broken pod:
kubectl set image -n mysteries deploy/typo web=nginx:1.27-alpine
kubectl rollout status -n mysteries deploy/typo --timeout=120s
kubectl get pods -n mysteries -l app=typo
deployment.apps/typo image updated
Waiting for deployment "typo" rollout to finish: 1 old replicas are pending termination...
Waiting for deployment "typo" rollout to finish: 1 old replicas are pending termination...
Waiting for deployment "typo" rollout to finish: 1 old replicas are pending termination...
deployment "typo" successfully rolled out
NAME READY STATUS RESTARTS AGE
typo-5b74f56779-j6ccz 1/1 Running 0 3s
typo-dbb9dc4d8-smncs 0/1 Terminating 0 101s
In real life, fix it in the YAML file, not with set image, or the next kubectl apply puts the typo back.
2. crash: the program gives up
The Events only say it keeps restarting:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 90s default-scheduler Successfully assigned mysteries/crash-85f877779c-m9l5r to learn-worker2
Normal Pulled 49s (x4 over 88s) kubelet Container image "busybox:1.37" already present on machine and can be accessed by the pod
Normal Created 49s (x4 over 88s) kubelet Container created
Normal Started 49s (x4 over 88s) kubelet Container started
Warning BackOff 48s (x3 over 86s) kubelet Back-off restarting failed container menu in pod crash-85f877779c-m9l5r_mysteries(350ede8c-e647-41bb-81cf-eeb23d3e2350)
Stages 2 to 4 all passed: scheduled, pulled, created, started. This is the first app where the logs have the answer, because this is the first one where your program ran:
kubectl logs -n mysteries deploy/crash
kubectl logs -n mysteries deploy/crash --previous
starting the menu service
error: MENU_DB is not set
unable to retrieve container logs for containerd://052e80b4f365f5e6d6e3e96d3ea75633c941ec3633ebacced01b21130f5106a0
The plain kubectl logs had it: a setting called MENU_DB is missing. --previous, the usual advice for a crashing container, failed here, on both runs of this lab. While a crashed container is waiting to be restarted, plain logs already shows that last attempt; --previous asks for the one before it, which the node may have cleaned away. Try plain logs first, then --previous, and never decide there are no logs from one empty answer.
The fix is in the app's settings, not in Kubernetes: give it MENU_DB with an env entry or a ConfigMap (Lesson 7).
3. greedy: out of memory
kubectl describe pod -n mysteries -l app=greedy
This time the clue is higher up than the Events, under the container's Last State and Limits:
Last State: Terminated
Reason: OOMKilled
Exit Code: 137
Started: Sat, 14 Nov 2026 21:11:24 -0500
Finished: Sat, 14 Nov 2026 21:11:24 -0500
Ready: False
Restart Count: 3
Limits:
memory: 64Mi
OOMKilled, exit code 137: it used more memory than its 64 MiB limit, and the node's kernel stopped it (Lesson 9). OOM means out of memory. It started and finished in the same second. The logs show how far it got:
kubectl logs -n mysteries deploy/greedy
building the daily report
It printed its first line and was killed before it could print done, because it tried to hold 200 MB. There are two fixes, and choosing between them is the real work: raise the limit, if the app genuinely needs that much, or fix the app, if it shouldn't. Raising limits until the restarts stop is how clusters fill up.
4. too-big: no node has room
kubectl describe pod -n mysteries -l app=too-big
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 91s default-scheduler 0/3 nodes are available: 1 node(s) had untolerated taint(s), 2 Insufficient cpu. no new claims to deallocate, preemption: 0/3 nodes are available: 3 Preemption is not helpful for scheduling.
Stopped at stage 2, and the scheduler says why for every node: the control-plane node has a taint that keeps ordinary apps off it (Lesson 2), and the two workers don't have enough CPU. Preemption is not helpful means even evicting less important pods wouldn't make room. This pod asks for 64 CPUs. kubectl describe nodes shows what each node can offer; for each worker, the lines that matter are:
Allocatable:
cpu: 16
Sixteen, the CPUs Docker Desktop gives the kind nodes on this laptop; yours may differ. No node will ever fit 64, so the pod will wait forever without an error. Lower the request to what the app needs, as Lesson 9 measured, or add bigger nodes.
5. missing-config: a setting that isn't there
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 91s default-scheduler Successfully assigned mysteries/missing-config-7f5968cc5c-j5wwn to learn-worker2
Normal Pulled 12s (x8 over 89s) kubelet Container image "nginx:1.27-alpine" already present on machine and can be accessed by the pod
Warning Failed 12s (x8 over 89s) kubelet Error: configmap "bakery-settings" not found
Pulled, then stopped at stage 4: the container can't be created without the ConfigMap it names. The app never started, so there are no logs at all. Check the names with kubectl get configmaps -n mysteries: either create bakery-settings, or fix the name in the Deployment. The same error appears for a missing Secret, or a missing key inside one. Kubernetes keeps retrying, so the pod starts by itself once the ConfigMap exists.
6. not-ready: running, but no traffic
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 91s default-scheduler Successfully assigned mysteries/not-ready-84d768d7f7-vmwf4 to learn-worker
Normal Pulled 91s kubelet Container image "nginx:1.27-alpine" already present on machine and can be accessed by the pod
Normal Created 91s kubelet Container created
Normal Started 91s kubelet Container started
Warning Unhealthy 90s kubelet Readiness probe failed: Get "http://10.244.1.6:80/ready": dial tcp 10.244.1.6:80: connect: connection refused
Warning Unhealthy 3s (x19 over 89s) kubelet Readiness probe failed: HTTP probe failed with statuscode: 404
Two different failures, a second apart. The first check came before nginx was listening: connection refused, normal while an app starts. Every check after that got 404: nginx is up, and there's no page called /ready. The app is fine; the check is wrong (Lesson 6).
Now look at it from the Service's side. This is where it gets subtle:
kubectl get endpointslices -n mysteries -l kubernetes.io/service-name=not-ready
kubectl get endpointslices -n mysteries -l kubernetes.io/service-name=not-ready -o custom-columns='ADDRESS:.endpoints[*].addresses[0],READY:.endpoints[*].conditions.ready'
NAME ADDRESSTYPE PORTS ENDPOINTS AGE
not-ready-89zjm IPv4 80 10.244.1.6 91s
ADDRESS READY
10.244.1.6 false
The endpoint slice lists the pod's address, even though it's not ready; it's marked READY false, which the default view doesn't show. So "the Service has endpoints" doesn't mean it has any it will use. A request proves it, from a throwaway pod inside the cluster:
kubectl run curl0 -n mysteries --image=curlimages/curl:8.11.1 --restart=Never --rm -i --quiet -- curl -sS -m 5 http://not-ready
curl: (7) Failed to connect to not-ready port 80 after 10 ms: Could not connect to server
pod mysteries/curl0 terminated (Error)
7. menu: the pod is fine, the Service isn't
menu passed every check so far: Running, 1/1, no warnings. Stages 1 to 6 are fine. So test stage 7:
kubectl get endpointslices -n mysteries -l kubernetes.io/service-name=menu
kubectl get service menu -n mysteries -o wide
kubectl get pods -n mysteries -l app=menu --show-labels
NAME ADDRESSTYPE PORTS ENDPOINTS AGE
menu-vz844 IPv4 <unset> <unset> 95s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
menu ClusterIP 10.96.14.238 <none> 80/TCP 95s app=menus
NAME READY STATUS RESTARTS AGE LABELS
menu-56cb4cc4c4-qg4qq 1/1 Running 0 95s app=menu,pod-template-hash=56cb4cc4c4
No endpoints at all, because the Service looks for app=menus and the pod is labeled app=menu. One letter. Nothing anywhere reports an error: the Service is valid, the pod is healthy, they just never meet. A request fails in 2 ms:
kubectl run curl -n mysteries --image=curlimages/curl:8.11.1 --restart=Never --rm -i --quiet -- curl -sS -m 5 http://menu
curl: (7) Failed to connect to menu port 80 after 2 ms: Could not connect to server
pod mysteries/curl terminated (Error)
Fix the selector, and the pod appears straight away:
kubectl patch service menu -n mysteries -p '{"spec":{"selector":{"app":"menu"}}}'
kubectl get endpointslices -n mysteries -l kubernetes.io/service-name=menu
kubectl run curl2 -n mysteries --image=curlimages/curl:8.11.1 --restart=Never --rm -i --quiet -- curl -sS -m 5 http://menu
service/menu patched
NAME ADDRESSTYPE PORTS ENDPOINTS AGE
menu-vz844 IPv4 80 10.244.1.8 106s
<title>Welcome to nginx!</title>
The curl output above is trimmed to nginx's page title.
Empty endpoints means the selector matches nothing. Endpoints marked not ready means they match, and fail their readiness check. Between them, mysteries 6 and 7 cover most "the Service doesn't work" problems; the rest are a wrong port, so check that the Service's targetPort is the port the app listens on.
Step 4: the whole story
When one pod's events aren't enough, the namespace's events, oldest first, show everything that happened, across every object:
kubectl get events -n mysteries --sort-by=.lastTimestamp
A few of the 55 lines it printed:
LAST SEEN TYPE REASON OBJECT MESSAGE
98s Normal ScalingReplicaSet deployment/typo Scaled up replica set typo-dbb9dc4d8 from 0 to 1
98s Normal SuccessfulCreate replicaset/typo-dbb9dc4d8 Created pod: typo-dbb9dc4d8-smncs
98s Normal Scheduled pod/typo-dbb9dc4d8-smncs Successfully assigned mysteries/typo-dbb9dc4d8-smncs to learn-worker
8s Warning Failed pod/typo-dbb9dc4d8-smncs Failed to pull image "nginx:1.27-alpne": rpc error: code = NotFound desc = failed to pull and unpack image "docker.io/library/nginx:1.27-alpne": failed to resolve reference "docker.io/library/nginx:1.27-alpne": docker.io/library/nginx:1.27-alpne: not found
0s Warning FailedScheduling pod/too-big-58bfc7f87b-lnnvj 0/3 nodes are available: 1 node(s) had untolerated taint(s), 2 Insufficient cpu. no new claims to deallocate, preemption: 0/3 nodes are available: 3 Preemption is not helpful for scheduling.
The Deployment made a ReplicaSet, which made a pod, which was scheduled, which failed to pull. Add --field-selector type=Warning to see only the problems. Events are only kept for about an hour, so for a problem from last night, they're gone; that's what the logging and monitoring tools in other tracks are for.
Clean up the seven apps:
kubectl delete namespace mysteries
When the cluster itself is broken
So far, each app was broken in its own way. When several unrelated apps break at once, suspect the cluster, not the apps: a node, DNS, or a control-plane part. Check the cluster before opening any one app's logs:
kubectl get nodes
kubectl get pods -n kube-system
Every node should be Ready, and every pod in kube-system Running. The four scenarios below break a part of your kind cluster on purpose, show how it looks, then fix it. Give their test apps a namespace of their own:
kubectl create namespace cluster-mysteries
``` Each kind node is a Docker container, so `docker exec` reaches inside it the way SSH would reach a real server.
<Callout tone="warning" label="Only break a cluster you can throw away">
**Run these on your kind cluster, `learn`, and nowhere else.** They stop a node's kubelet, take DNS away and break the scheduler. Check `kubectl config current-context` says `kind-learn` before each one. If anything goes wrong, `kind delete cluster --name learn` and a new cluster put everything right.
</Callout>
### 8. A node goes NotReady
Stop the kubelet, the agent that runs pods on a node, as if the node had crashed or lost its network:
```bash
docker exec learn-worker systemctl stop kubelet
Wait a minute, then:
kubectl get nodes
kubectl describe node learn-worker
NAME STATUS ROLES AGE VERSION
learn-control-plane Ready control-plane 8m46s v1.35.0
learn-worker NotReady <none> 8m37s v1.35.0
learn-worker2 Ready <none> 8m37s v1.35.0
The node's Conditions, from describe:
Conditions:
Type Status LastHeartbeatTime LastTransitionTime Reason Message
---- ------ ----------------- ------------------ ------ -------
MemoryPressure Unknown Sat, 14 Nov 2026 21:11:37 -0500 Sat, 14 Nov 2026 21:13:53 -0500 NodeStatusUnknown Kubelet stopped posting node status.
DiskPressure Unknown Sat, 14 Nov 2026 21:11:37 -0500 Sat, 14 Nov 2026 21:13:53 -0500 NodeStatusUnknown Kubelet stopped posting node status.
PIDPressure Unknown Sat, 14 Nov 2026 21:11:37 -0500 Sat, 14 Nov 2026 21:13:53 -0500 NodeStatusUnknown Kubelet stopped posting node status.
Ready Unknown Sat, 14 Nov 2026 21:11:37 -0500 Sat, 14 Nov 2026 21:13:53 -0500 NodeStatusUnknown Kubelet stopped posting node status.
Every condition is Unknown, not False: the control plane hasn't heard from the node, so it doesn't know. "Kubelet stopped posting node status." The last heartbeat time says exactly when it went quiet. Kubernetes marks a node NotReady after about 40 seconds of silence, and about 5 minutes later starts moving its pods to other nodes, so a short blip doesn't reshuffle the cluster.
On a real server you'd SSH in and look at the kubelet, which is what this does:
docker exec learn-worker systemctl status kubelet
○ kubelet.service - kubelet: The Kubernetes Node Agent
Loaded: loaded (/etc/systemd/system/kubelet.service; enabled; preset: enabled)
Drop-In: /etc/systemd/system/kubelet.service.d
└─10-kubeadm.conf, 11-kind.conf
The empty circle means stopped. On a real node, journalctl -u kubelet would say why: an expired certificate, a full disk, a broken configuration file. Start it again:
docker exec learn-worker systemctl start kubelet
kubectl wait --for=condition=Ready node/learn-worker --timeout=120s
node/learn-worker condition met
The node keeps a record: its Events now include Node learn-worker status is now: NodeNotReady.
9. DNS stops working
Take away the cluster's DNS server, CoreDNS, by scaling it to zero:
kubectl -n kube-system scale deployment coredns --replicas=0
kubectl run dns-test -n cluster-mysteries --image=busybox:1.37 --restart=Never --rm -i --quiet -- nslookup kubernetes.default.svc.cluster.local
deployment.apps/coredns scaled
nslookup: write to '10.96.0.10': Connection refused
;; connection timed out; no servers could be reached
pod cluster-mysteries/dns-test terminated (Error)
Every pod is still Running, and nothing can find anything by name. That's what makes a DNS failure confusing: apps fail with "unknown host" or connection errors, and their pods look perfect. 10.96.0.10 is the cluster's DNS Service, and it has nothing behind it:
kubectl get pods -n kube-system -l k8s-app=kube-dns
kubectl get endpointslices -n kube-system -l kubernetes.io/service-name=kube-dns
No resources found in kube-system namespace.
NAME ADDRESSTYPE PORTS ENDPOINTS AGE
kube-dns-sd6cl IPv4 <unset> <unset> 21m
The same empty endpoints as mystery 7, this time on a system Service. Bring CoreDNS back:
kubectl -n kube-system scale deployment coredns --replicas=2
kubectl -n kube-system rollout status deployment coredns --timeout=120s
kubectl run dns-test2 -n cluster-mysteries --image=busybox:1.37 --restart=Never --rm -i --quiet -- nslookup kubernetes.default.svc.cluster.local
deployment.apps/coredns scaled
Waiting for deployment "coredns" rollout to finish: 0 of 2 updated replicas are available...
Waiting for deployment "coredns" rollout to finish: 1 of 2 updated replicas are available...
deployment "coredns" successfully rolled out
Server: 10.96.0.10
Address: 10.96.0.10:53
Name: kubernetes.default.svc.cluster.local
Address: 10.96.0.1
Wait a few seconds after a fix before deciding it didn't work. In one run of this lab, the lookup straight after the rollout was still refused; in another, it answered on the first try, 2 seconds later. Pods being ready and every node routing traffic to them are two steps, a moment apart. Use the full name, too: busybox's nslookup doesn't add the cluster's search domains, so kubernetes.default on its own fails even when DNS is fine, which an earlier version of this lab found the hard way.
10. The scheduler goes down
The control plane's own parts run as pods in kube-system, started from files on the control-plane node, called static pod manifests. The kubelet watches that folder and runs whatever's in it. Back up the scheduler's file, then put a one-word typo in it:
docker exec learn-control-plane cp /etc/kubernetes/manifests/kube-scheduler.yaml /root/kube-scheduler.yaml.bak
docker exec learn-control-plane sed -i 's/--leader-elect=true/--leader-elect=ture/' /etc/kubernetes/manifests/kube-scheduler.yaml
Wait 40 seconds, then create an app and look at it:
kubectl create deployment bread -n cluster-mysteries --image=nginx:1.27-alpine
kubectl get pods -n cluster-mysteries
kubectl describe pod -n cluster-mysteries -l app=bread
NAME READY STATUS RESTARTS AGE
bread-75cf68d78f-nrtxf 0/1 Pending 0 21s
And the Events, in full:
Events: <none>
Pending, with no events at all, and that silence is the clue. In mystery 4, the scheduler explained why it couldn't place the pod. Here, nothing has even tried. When a pod is Pending and no FailedScheduling event appears, check the scheduler:
kubectl get pods -n kube-system -l component=kube-scheduler
kubectl logs -n kube-system kube-scheduler-learn-control-plane --tail=5
NAME READY STATUS RESTARTS AGE
kube-scheduler-learn-control-plane 0/1 CrashLoopBackOff 3 (10s ago) 46s
-h, --help help for kube-scheduler
--version version[=true] --version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version
Error: invalid argument "ture" for "--leader-elect" flag: strconv.ParseBool: parsing "ture": invalid syntax
The checklist works on Kubernetes itself: the scheduler's pod is in CrashLoopBackOff, stage 5, so its logs have the answer, word for word. The fix goes in the file, not through kubectl: editing a static pod with kubectl doesn't stick, because the kubelet rebuilds it from the file.
docker exec learn-control-plane cp /root/kube-scheduler.yaml.bak /etc/kubernetes/manifests/kube-scheduler.yaml
kubectl rollout status deployment bread -n cluster-mysteries --timeout=180s
Waiting for deployment "bread" rollout to finish: 0 of 1 updated replicas are available...
deployment "bread" successfully rolled out
The waiting pod was scheduled as soon as the scheduler came back. If the API server itself goes down, kubectl can't answer at all; then you'd run crictl ps -a on the control-plane node, which talks to the container runtime directly.
11. Every node says keep out
Taint both workers, as you might to stop new work landing on them before maintenance:
kubectl taint nodes learn-worker bakery=closed:NoSchedule
kubectl taint nodes learn-worker2 bakery=closed:NoSchedule
kubectl create deployment rolls -n cluster-mysteries --image=nginx:1.27-alpine
kubectl describe pod -n cluster-mysteries -l app=rolls
node/learn-worker tainted
node/learn-worker2 tainted
deployment.apps/rolls created
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 15s default-scheduler 0/3 nodes are available: 3 node(s) had untolerated taint(s). no new claims to deallocate, preemption: 0/3 nodes are available: 3 Preemption is not helpful for scheduling.
The same message every pod got on a brand-new cluster, earlier in the lesson. "Untolerated taint" means a node has a keep-out sign the pod doesn't tolerate. kubectl describe nodes shows each node's taints, one line near the top:
Taints: node-role.kubernetes.io/control-plane:NoSchedule
Taints: bakery=closed:NoSchedule
Taints: bakery=closed:NoSchedule
The control plane's own taint, and the two you added. Remove them, with a minus sign on the end, and the pod starts:
kubectl taint nodes learn-worker bakery=closed:NoSchedule-
kubectl taint nodes learn-worker2 bakery=closed:NoSchedule-
kubectl rollout status deployment rolls -n cluster-mysteries --timeout=120s
node/learn-worker untainted
node/learn-worker2 untainted
Waiting for deployment "rolls" rollout to finish: 0 of 1 updated replicas are available...
deployment "rolls" successfully rolled out
In real clusters this happens after kubectl drain or kubectl cordon for maintenance, when someone forgets to uncordon afterwards, and on brand-new nodes, which carry node.kubernetes.io/not-ready until their networking is up.
Habits that save hours
- Find the stage before reading anything else.
kubectl get podsfirst, every time. - Read the whole event message. "Insufficient cpu" and "untolerated taint" are both
FailedScheduling; the fix is in the words after. - Ask what changed last. A new image, a new setting, a new node. Most outages follow a change, and
kubectl rollout historyshows a Deployment's. - Change one thing at a time, and check after each, or you won't know which change fixed it.
- Wait a few seconds after a fix, then check again. DNS answered 2 seconds after one rollout, and not straight away in another.
- Several things broken at once? Check the cluster first: nodes, then
kube-system. - Running isn't working.
menuwasRunning 1/1the whole time it was unreachable.
Clean up
kubectl delete namespace cluster-mysteries
kind delete cluster --name learn
That's the end of Kubernetes basics. You've gone from what Kubernetes solves to running apps, connecting them, letting the outside world in, and now finding out why when something doesn't work. The kubectl cheatsheet has this lesson's commands next to the rest of the track's.
Check yourself
A pod shows ImagePullBackOff. Why won't kubectl logs help?
A pod is Pending. Where do you look first?
kubectl logs --previous failed for a crashing app. What should you try?
A Service's endpoint slice lists a pod's address, but requests fail. Why might that be?
A new pod is Pending, and describe shows no events at all. What's the likely cause?
Every pod is Running, but apps fail with unknown host errors. What do you check?
A node's Ready condition says Unknown. What does that tell you?
Key terms
- Event: a short record of something that happened to an object, like a failed pull or a scheduling decision. Kept for about an hour.
- Last State: in
kubectl describe, how a container's previous run ended: its reason and exit code. - Exit code 137: a container killed by the system, usually for using too much memory (
OOMKilled). - Back-off: waiting longer between each retry, for image pulls and container restarts.
- EndpointSlice: the list of pod addresses behind a Service, each marked ready or not.
- Static pod: a pod the kubelet runs from a file on its node, like the control plane's own parts.
- Node condition: a node's health report: Ready, MemoryPressure, DiskPressure, PIDPressure.
- Taint: a node's keep-out sign; only pods that tolerate it can be scheduled there.
- CoreDNS: the cluster's DNS server, behind the
kube-dnsService.
Go deeper
- Networking track: When it doesn't connect: a troubleshooting checklist, the same method for networks, for stage 8.
- The kubectl cheatsheet, whose "When a pod won't start" table is this lesson on one page.
- Official docs: debug pods (opens in a new tab), debug Services (opens in a new tab), debug DNS (opens in a new tab), and troubleshooting clusters (opens in a new tab).
- Practice: troubleshooting is about a third of the CKA (Certified Kubernetes Administrator) exam. Break your kind cluster in your own ways, write down the symptom before you look anything up, and time how long the checklist takes you.