Explain init containers and sidecars with a real use.
IntermediateScenarioHelm, operators and GitOps
Answer
Situation read → An app must wait for a DB, and logs must be shipped.
What I'd do →
- Init containers run to completion in order before the app, for waiting or migrations
- Sidecars run alongside, for log shipping or proxies
- Native sidecars (init containers with
restartPolicy: Always) start before and stop after the app - Check
kubectl get podforInit:0/1 - Read init logs with
kubectl logs pod -c init
Why → Native sidecars fix ordering problems, such as Jobs that never finish because of a sidecar.
Interview tip → Mention native sidecars GA in 1.33.
More on Helm, operators and GitOps
A `helm upgrade` failed halfway. How do you see state and recover?BeginnerHelm says `cannot re-use a name that is still in use` or `another operation is in progress`. What now?IntermediateHow do you review what a Helm upgrade will change before running it?IntermediateWhere do you keep chart values for multiple environments?BeginnerWhat does `helm template` do and how is it different from `helm install`?BeginnerA Helm chart upgrade changed an immutable field and failed. How do you proceed?Advanced