Multi-container patterns

There are a number of accepted patterns for using multiple containers within a pod.

Initialisation pattern

The initialisation pattern uses initContainers to initialise an application's environment before the application starts. Not that more complex orchestration operations are a better fit for operators.

Sidecar pattern

In the sidecar pattern a secondary container runs alongside the application container, providing a supporting function tightly coupling it. Istio's proxy is a good example, as is git-sync for keeping static files up to date.

Adapter pattern

A specialised variant of the sidecar pattern, the adapter pattern ships a sidecar container that takes some output from the application container and reformats it for consumption by another, incompatible, service. This is commonly appropriate for log and metrics collection agents: e.g. Prometheus exporters.

Ambassador pattern

Ambassador containers sit between the application container and external systems, brokering connections. These are useful for abstracting away frequently changing address configuration.