Interview Prep/Kubernetes/Helm, operators and GitOps

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 →

  1. Init containers run to completion in order before the app, for waiting or migrations
  2. Sidecars run alongside, for log shipping or proxies
  3. Native sidecars (init containers with restartPolicy: Always) start before and stop after the app
  4. Check kubectl get pod for Init:0/1
  5. 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.

All Kubernetes questions Roadmap: Platform engineering

More on Helm, operators and GitOps