DevOps Practitioner · Module 1: Kubernetes workload management · Lab
Find the Config Cause of a CrashLoopBackOff
45 min hands-on · Core
A local KinD or k3d cluster on a machine you own, with a demo namespace for this lab.
Local guide: run the steps below on your own machine in order, then check the validation list.
Objectives
- Walk the owner chain from pod to ReplicaSet to Deployment
- Separate image, command and config causes from the event and log text
- Fix the config cause in the manifest and show a stable running pod
Step 1
Deploy the broken fixture
Save this as broken.yaml and apply it (kubectl apply -f broken.yaml -n demo). The fault is deliberate: the app requires /etc/app/config.yaml but the volume mounts the ConfigMap at /etc/wrong. Watch the pod enter CrashLoopBackOff and record the restart count rising. Reset: kubectl delete -f broken.yaml -n demo. Fixture: apiVersion apps/v1 Deployment web-broken, one replica, image busybox:1.36, command sh -c cat /etc/app/config.yaml && sleep 3600, volumeMount config-vol at /etc/wrong from ConfigMap app-config (key config.yaml: mode=prod). Expected error: cat: /etc/app/config.yaml: No such file or directory.
Step 2
Trace the owner chain
From the pod, read the ownerReference to the ReplicaSet and from there to the Deployment. Quote the event text and the last log lines, and name the cause class: the image pulls, the command starts, the required file is absent.
Step 3
Fix the manifest and prove stability
Copy broken.yaml to fixed.yaml, change the mountPath to /etc/app, reapply from the file (not with a live edit), and show the new pod running with zero restarts over two minutes (kubectl get pods -n demo -w). Verify: kubectl exec -n demo deploy/web-broken -- cat /etc/app/config.yaml shows mode=prod. Keep the broken and fixed manifests as the deliverable pair.
How to confirm it worked
- Owner chain quoted from pod to ReplicaSet to Deployment
- Cause class named from event plus log evidence, not from restarting
- Fixed pod running with zero restarts over the observation window
- Broken and fixed manifests kept as the deliverable pair