A sidecar process runs beside the primary application in the same Kubernetes pod. Containers in that pod share networking and can share storage, enabling fast local assistance without additional services or network policies. section 4.2.2
Use a sidecar when a supporting container must work closely with the application:
- Collect or stream application logs: the main container writes to a shared volume, while the sidecar reads or forwards the data. section 4.2.2
- Define both containers in one Pod manifest and mount the same volume where data must pass between them. section 4.2.2
- Distinguish a continuously running sidecar from an initContainer, which completes setup before the main container starts. section 4.2.2
Inspecting a two-container pod
Create or apply a Pod containing a primary busybox container and a sidecar container, then verify it with `kubectl get po`. A healthy pod reports `2/2 Running`. Inspect one container with `kubectl logs busybox -c sidecar`, or stream both with `kubectl logs busybox --all-containers -f`. section 8.1.1
Figure 4.14 Adding an additional container to a pod, which will serve to read logs from the main application
Use the figure to visualize adding a log-reading container alongside the primary application in one pod. section 4.2.2










