Question 7
Kubernetes FundamentalsWhich pod construct runs to completion before the main application containers start, and blocks the pod from starting if it fails?
Correct answer: B
Explanation
An init container runs before the main application containers and must finish successfully first. Kubernetes defines init containers as containers that "run to completion" and, if one fails, the pod does not proceed to start the app containers.
Why each option is right or wrong
A. Sidecar container
B. Init container
Kubernetes Pod lifecycle rules in the official documentation distinguish init containers from regular app containers: init containers are executed sequentially before any application container is started, and each one must complete successfully before the Pod can proceed. If an init container exits non-zero, the Pod remains in an Init:Error/CrashLoopBackOff-type state and the main containers are not launched until the failure is resolved.
C. Ephemeral container
D. postStart lifecycle hook