KCNA · Question #205
To run a startup task before a Pod's container starts up. What Kubernetes feature can help you ac-complish this?
The correct answer is A. Init container. Init containers are used to perform setup tasks that must complete successfully before the main application containers in a Pod start.
Question
To run a startup task before a Pod's container starts up. What Kubernetes feature can help you ac-complish this?
Options
- AInit container
- BSidecar container
- CStartup probe
- DDaemonSet
How the community answered
(27 responses)- A89% (24)
- C7% (2)
- D4% (1)
Why each option
Init containers are used to perform setup tasks that must complete successfully before the main application containers in a Pod start.
An init container runs to completion before any of the main application containers in the Pod start, making it ideal for performing required startup tasks like setting up permissions, waiting for a dependent service, or initializing data volumes. If an init container fails, Kubernetes restarts the Pod until it succeeds.
A sidecar container runs alongside the main application container throughout its lifecycle, typically providing auxiliary functions like logging or monitoring, not pre-startup tasks.
A startup probe is a type of liveness or readiness probe that indicates when a container has successfully started, preventing other probes from affecting application startup, but it does not execute a task itself.
A DaemonSet ensures that a copy of a Pod runs on all or selected nodes in a cluster; it is a controller for deploying pods, not a mechanism for pre-startup tasks within a single pod.
Concept tested: Init containers for startup tasks
Source: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
Topics
Community Discussion
No community discussion yet for this question.