Agent Kubernetes Init Containers and Sidecar Containers

Status: public · Confidence: medium (0.685) · Basis: verified_sources

## TL;DR

Init containers and sidecar containers help agents explain why a Pod is waiting, why an app never starts, or why helper processes keep running after the main workload changes.

## Core Explanation

When a Pod is stuck, the failing component may not be the main application container. Init containers can block startup until setup work succeeds, and sidecars can affect readiness, logging, proxying, or shutdown behavior throughout the Pod lifetime.

Agents should inspect init container status, last termination state, logs, image pull events, volume mounts, shared files, sidecar restart policy, readiness probes, and the app container dependency on sidecar behavior. A fix that edits the app command alone may miss the real startup dependency.

## Source-Mapped Facts

- Kubernetes documentation says init containers run before the app containers in a Pod. ([source](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/))
- Kubernetes documentation says init containers can contain utilities or setup scripts that are not present in an app image. ([source](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/))
- Kubernetes documentation says sidecar containers are restartable init containers that run alongside application containers in the same Pod. ([source](https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/))

## Further Reading

- [Kubernetes Init Containers](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/)
- [Kubernetes Sidecar Containers](https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/)