Courseiva

CKAD Application Design and Build Practice Question

You have a multi-container pod with a main container and a sidecar container that collects logs. The sidecar container should start before the main container and must complete initialization tasks before the main container starts. Which type of container should you use for this purpose?

⚠ Common exam trap

Init containers are a key concept in CKAD. Candidates often mistakenly think a regular sidecar container can be configured to start before the main container, but Kubernetes does not support ordering among regular containers in a pod. Only init containers guarantee completion before other containers start.

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 to completion before any regular containers in the pod start, making them ideal for prerequisites like initialization tasks or log setup. In this scenario, the sidecar must complete its initialization before the main container begins, which is exactly the behavior of an init container. Regular sidecar containers run concurrently with the main container, not before it.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Ephemeral container

    Why it's wrong here

    Ephemeral containers are temporary containers dynamically injected into an existing pod for interactive debugging or troubleshooting, often when the regular containers are missing tools or are unavailable. They are not part of the pod's startup lifecycle and do not run before the main container; they are added at runtime after the pod is already running. Because they are not defined in the pod's initial startup sequence, they cannot perform initialization tasks that must complete before the main container starts.

  • ✓

    Init container

    Why this is correct

    Init containers are special containers that run to completion sequentially before any regular containers in the pod start. Each init container must finish successfully before the next one begins, and the main container is only started after all init containers have succeeded. This makes them the correct choice for initialization tasks such as setting up volumes, waiting for dependencies, or performing migrations. If an init container fails, it is retried according to the pod's restartPolicy, ensuring the main container never starts prematurely.

  • ✗

    Job

    Why it's wrong here

    A Job is a Kubernetes workload resource that manages a separate set of Pods that run a batch task to completion, but it is not a container type within a pod. A Job creates its own Pods with their own containers, completely decoupled from the pod running the main application. Because it is a distinct resource outside the pod, it cannot run before the main container inside the same pod or gate the startup of that container. Thus, a Job cannot fulfill the requirement of initializing prerequisites within the same pod as the main container.

  • ✗

    Regular sidecar container

    Why it's wrong here

    Regular containers in a pod, including sidecar containers, are all started concurrently when the pod is scheduled; Kubernetes does not guarantee an ordering between them. A regular sidecar (e.g., a logging agent or network proxy) provides supporting services alongside the main container, but it starts in parallel, so it cannot ensure that prerequisites are set up before the main container begins. Unlike init containers, regular sidecars are not designed to run to completion before other containers, and they do not block the main container's startup. Therefore, they are not a valid mechanism for pre-start initialization.

Go deeper

Related to this question

About these practice questions

This CKAD question is part of Courseiva's 826-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.