CKAD Application Observability and Maintenance Practice Question
You want to ensure your application shuts down gracefully when a pod is terminated. The application needs 30 seconds to clean up. Which field should you set in the pod spec?
⚠ Common exam trap
CNCF often tests the misconception that a `preStop` hook alone guarantees graceful shutdown, but without adjusting `terminationGracePeriodSeconds`, the hook's execution time is counted against the default 30-second grace period, potentially causing a SIGKILL before cleanup completes.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
terminationGracePeriodSeconds: 30
`terminationGracePeriodSeconds` defines the time Kubernetes waits for a pod to shut down gracefully after sending a SIGTERM signal. Setting it to 30 seconds gives the application the required cleanup window before a SIGKILL is forced.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
spec.containers[].livenessProbe.initialDelaySeconds: 30
Why it's wrong here
This field controls how long the kubelet waits after a container starts before running its first liveness check. It is purely a probe scheduling parameter used to detect unhealthy containers during runtime, and it has no relationship to the shutdown sequence. Graceful termination is governed by the pod-level terminationGracePeriodSeconds, which gives the process time to clean up after SIGTERM, not by liveness probe timing.
- ✗
spec.containers[].lifecycle.preStop.exec.command: ["sleep", "30"]
Why it's wrong here
This is a valid preStop hook, but the question asks for the field that gives the container time to shut down gracefully, which is terminationGracePeriodSeconds. A preStop hook can run tasks but the grace period is the overall timeout.
- ✗
spec.containers[].readinessProbe.periodSeconds: 30
Why it's wrong here
This specifies the interval between successive readiness probe executions, determining how quickly the container's readiness state is refreshed for Service endpoint inclusion. It affects traffic routing during normal operation, not the termination procedure. When a pod is deleted, Kubernetes sends SIGTERM and starts the termination grace period countdown regardless of readiness probe frequency, so this field cannot influence how the app shuts down.
- ✓
terminationGracePeriodSeconds: 30
Why this is correct
This pod-level field defines the duration between when Kubernetes sends SIGTERM to the container's primary process and when it forcibly follows up with SIGKILL. Setting it to 30 seconds grants your application a full half-minute to finish in-flight requests, close connections, flush logs, and release external resources. Without this grace period, or if set too low, the kubelet will kill the process forcefully, likely causing data loss or incomplete cleanup.
Go deeper
Related to this question
About these practice questions
Courseiva writes every CKAD question from scratch — 160 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKAD practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKAD exam.