CKAD Application Design and Build Practice Question
You need to run a database migration as a container before the main application container starts. Which Kubernetes concept should you use?
⚠ Common exam trap
Candidates often confuse init containers with Jobs, thinking both run to completion, but Jobs are independent objects while init containers are tightly coupled to a Pod's lifecycle and must complete before the main container starts.
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
✓
Init container
Init containers run sequentially before the main application container starts and are designed for setup tasks like database migrations. They complete successfully before any regular containers in the Pod begin, ensuring the migration finishes before the main app starts.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Job
Why it's wrong here
A Job is a standalone Kubernetes object that manages a pod to completion, but it is not part of the target application's pod spec. Because a Job runs as an independent, separate pod, the main application container can start or become ready without any dependency on the Job's status. For a migration that must finish before the app process begins, you need an in-pod mechanism with lifecycle ordering, which a Job cannot provide.
- ✓
Init container
Why this is correct
An init container is defined in the same pod spec as the application and runs sequentially to completion before any main container starts. The kubelet executes init containers in order, and the main containers are blocked until all init containers exit successfully. This makes it the correct, native way to run a database migration as a prerequisite: the app container does not even start until the migration container finishes.
- ✗
Sidecar container
Why it's wrong here
A sidecar container is a regular container that runs concurrently with the main container for the entire lifetime of the pod, providing supporting services like log shipping or a network proxy. It is not subject to any ordering constraint — all regular containers in a pod start simultaneously, so a sidecar cannot guarantee a migration completes before the main process begins.
- ✗
Ephemeral container
Why it's wrong here
An ephemeral container is a temporary container injected into an already-running pod solely for interactive debugging, such as inspecting filesystem or network state. It is not part of the original pod spec, cannot be declared at pod creation time, and has no lifecycle ordering relative to main containers. Therefore it is fundamentally unsuitable for running a one-time migration before application startup.
Go deeper
Related to this question
About these practice questions
Courseiva writes every CKAD question from scratch — 826 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.