Definition:

  • special type of Kubernetes Init Container
  • the secondary containers that run along with the main application container within the same pod
    • such as logging, monitoring, security, proxy, reverse proxy or data synchronization
  • Use cases:
    • sidecar pattern:
      • log collection
      • monitoring
      • data synchronization
    • ambassador pattern:
      • SSL termination
      • API gateway
      • connection management
    • adapter pattern
      • metrics transform
      • log normalization

Sidecar containers in Kubernetes

  • can specify a restartPolicy for containers listed in a Pod’s initContainersfield.
    • These restartable sidecar containers are independent from other init containers and from the main application container(s) within the same pod.
    • these can be started, stopped or restarted without affecting the main application container and other Kubernetes Init Container

Sidecar containers and Pod lifecycle

Differents from application container

Resource sharing within containers