Certified Kubernetes Application Developer (CKAD) · Section 3 · 15% of the exam
Debugging in Kubernetes
One of the objectives of the Certified Kubernetes Application Developer (CKAD) exam, in the section “Application Observability and Maintenance”. Here is what it covers, the points to remember and a question to try.
What it covers
A systematic method for finding out why a Pod will not start, keeps crashing, is not reachable or fails a rollout. You will map Pod statuses and exit codes to causes, check Services and endpoints, and use exec, port-forward and ephemeral debug containers.
Points to remember
- Method:
get, thendescribe(events, last state), thenlogs(and--previous), thenexecordebug. Pendingis a scheduling problem;ImagePullBackOffan image or registry problem;CreateContainerConfigErrora missing ConfigMap, Secret or key.CrashLoopBackOffis a symptom; read the exit code (137 OOM or SIGKILL, 143 SIGTERM, 127 command not found).READY 0/1withRunningmeans the readiness probe fails or the app is not listening.- Empty
kubectl get endpointsmeans label/selector mismatch or unready Pods; refused connections suggest a wrongtargetPort.
Try a question
A Pod crash-loops immediately after a command change. The team wants to explore the filesystem of the same container image, with the original command replaced by sleep, without touching the running Pod. Which approach is best?
- A
kubectl debug <pod> -it --copy-to=<pod>-debug --container=app -- sleep 3600 - B
kubectl exec <pod> -it -- sleep 3600inside the crash-looping container - C
kubectl patch pod <pod>to changespec.containers[0].commandtosleep - D
kubectl rollout restartwith a new image that sets thesleepcommand
Show the answer
A. kubectl debug --copy-to creates a new Pod from the original spec with modifications such as a different command or image. It is the right tool for crash-looping containers; delete the copy when finished.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson Debugging Applications in Kubernetes teaches this objective (about 45 minutes), and 11 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.