Sidecars versus Kubernetes Native Sidecars
Traditionally, sidecars in Kubernetes have been regular containers deployed alongside the main application in a Pod, as we learned in the previous sections. This approach offers additional functionalities but has limitations. For instance, sidecars might continue running even after the main application exits, wasting resources. Additionally, Kubernetes itself isn’t inherently aware of sidecars and their relationship with the primary application.
To address these limitations, Kubernetes v1.28 introduced a new concept: native sidecars. These leverage existing init
containers with special configurations. This allows you to define a restartPolicy
for containers within the Pod’s initContainers
section. These special sidecar containers can be independently started, stopped, or restarted without affecting the main application or other init containers, offering more granular control over their life cycle.
The following Deployment...