CKAD · 25 November 2026 · 8 min read

Kubernetes multi-container Pod patterns: sidecar, init, ambassador and adapter

Four proven ways to run a helper beside your app in one Pod: init containers, sidecars, ambassadors and adapters. Where they come from, how to choose one, the YAML, and what the CKAD asks.

Multi-container Pod patterns are proven ways to run a helper container beside your application container in one Kubernetes Pod. There are four to know. An init container runs setup before the app starts. A sidecar runs beside the app for the Pod's whole life. An ambassador proxies the app's connections to the outside world. An adapter reshapes the app's output for the systems that read it. All four work for the same reason: containers in a Pod share one network and can share volumes.

TL;DR

  • Containers in one Pod share an IP address (they talk over localhost), can mount the same volumes, and are scheduled onto one node as a unit.
  • Init container: runs to completion before the app starts. It goes in spec.initContainers.
  • Sidecar: runs beside the app for the life of the Pod. A native sidecar is an init container with restartPolicy: Always (on by default since Kubernetes 1.29, stable since 1.33).
  • Ambassador: the app talks to localhost and the helper reaches the world, for example the Cloud SQL Auth Proxy.
  • Adapter: the helper turns the app's output into a standard format, for example a Prometheus exporter.
  • One container per Pod is still the normal case. Use a pattern only for helpers that are tightly coupled to the app.
  • Exam: CKAD, "Understand multi-container Pod design patterns (e.g. sidecar, init and others)", in Application Design and Build (20%).

This is part 1 of the Kubernetes Pod Patterns series: what the four patterns are, where they come from and how to choose. Later parts take each pattern in turn.

Where the patterns come from

Brendan Burns, a Kubernetes co-founder, described the sidecar, ambassador and adapter on the Kubernetes blog in June 2015, in "The Distributed System ToolKit: Patterns for Composite Containers". In 2016 he and David Oppenheimer wrote them up for HotCloud '16 as "Design patterns for container-based distributed systems", which sorts patterns into single-container, single-node (closely cooperating containers) and multi-node groups.

The single-node group is what this series covers. In the paper's words, a sidecar "extend[s] and enhance[s] the main container", an ambassador "proxy[s] communication to and from a main container", and an adapter presents "the outside world with a simplified, homogenized view of an application". All of them need containers to be scheduled together "as an atomic unit, an abstraction Kubernetes calls 'Pods'".

Two details surprise people. The paper does not list the init container at all; it joined the CKAD's examples later. And the Kubernetes documentation covers only two of the four: init containers and sidecar containers have fields of their own, while "ambassador" and "adapter" appear only on the Kubernetes blog. In practice both are sidecars with a particular job.

The problem: one app, many jobs

A real application needs more than its own code. Its logs have to reach a log store. Its content or config has to come from somewhere. Its database connection may need a special login. Its metrics have to be in the format your monitoring system reads. Build all that into the app image and every team re-implements it, in every language, with a new build for every change to the plumbing.

The paper's answer is to put each job in its own container. It gives five reasons that apply to every pattern here: the container is the unit of resource accounting, of packaging, of reuse, of failure containment and of deployment. A log shipper written once can sit beside a Java app, a Go app and a Python app without any of them changing.

The solution: helpers in the same Pod

A Pod is the smallest thing Kubernetes schedules, and everything in it runs in a shared context. Three kinds of sharing make the patterns possible:

  • Network: every container in a Pod shares the network namespace, including the IP address and ports. Containers reach each other on localhost and must not listen on the same port.
  • Storage: all containers can mount the Pod's volumes. An emptyDir volume mounted into two containers is the usual way to hand files from one to the other.
  • Lifecycle: the containers are co-located and co-scheduled, start and stop with the Pod, and are replaced together.

Processes are not shared by default. If a helper needs to see or signal the app's processes, set shareProcessNamespace: true on the Pod.

The four patterns around one app, inside a Pod panel labeled one network (localhost), shared volumes. On the left, an init container runs first and exits, with an arrow to the app. Below the app, a sidecar extends the app through a shared volume. On the right, an ambassador is the app's way out, with arrows from the app through the ambassador to the outside world of databases, APIs and monitoring. An adapter is the world's view in, with arrows from the outside through the adapter to the app.

Each pattern puts the helper in a different place relative to the app:

  • Init container: before the app. It does setup and exits; the app does not start until it has succeeded. Part 2: init containers.
  • Sidecar: beside the app. It adds a capability the app needs all the time, such as syncing files or shipping logs. Part 3: sidecar containers.
  • Ambassador: between the app and the world. The app makes a simple call to localhost; the ambassador deals with discovery, login, encryption or sharding. Part 4: the ambassador pattern.
  • Adapter: between the world and the app. The world reads the adapter, which translates what the app produces into a standard format. Part 5: the adapter pattern.

In Kubernetes: where the helpers run

Helper containers in a real cluster. Readers send HTTP to Service web, which sends traffic on port 8080 to the app container in Pod web, on a worker node in the Kubernetes cluster. The Pod, labeled one IP and shared volumes, also holds an init container that waited for the database and exited, a sidecar log shipper that reads the app's log files from a volume and ships them to a log store outside the cluster, an ambassador database proxy that the app reaches on localhost:5432 and that connects over TLS to a database outside the cluster, and an adapter metrics exporter that reads the app's stats and is scraped at /metrics by a Prometheus Pod in the cluster.

The picture shows all four helpers in one Pod so you can see what each talks to; real Pods rarely need all of them. What follows from the way Kubernetes runs Pods:

  • The whole Pod lands on one node. The helpers cannot be spread out; they share the node's CPU and memory with the app.
  • Every replica gets its own helpers. Three replicas means three Pods, each with its own sidecar, ambassador and adapter.
  • A Service routes to the Pod, not to a container. Traffic arrives at the Pod's IP and the port decides which container answers.
  • Only two patterns have fields. Init containers and sidecars live in spec.initContainers. An ambassador or adapter is just another container: a native sidecar if it must start first and stop last, or an entry in spec.containers.

Here is one common real case for each pattern, and what it buys you:

A common real case for each pattern, in four panels. Init container: wait for the database Service, then render the config file, so the app starts only when its preconditions hold. Sidecar: git-sync keeps a web server's files current from Git, giving new content without rebuilding the app image. Ambassador: Cloud SQL Auth Proxy, where the app connects to 127.0.0.1, giving IAM login and encryption with no code in the app. Adapter: redis_exporter turns Redis stats into Prometheus metrics, giving one monitoring format with Redis unchanged.

The YAML

This Pod uses the two patterns that have their own fields. An init container waits until a Service called db resolves; a native sidecar, git-sync, keeps a web site's files current from Git; and nginx serves them.

YAML
apiVersion: v1kind: Podmetadata:  name: webspec:  initContainers:  - name: wait-for-db                  # init container: runs once, must exit 0    image: busybox:1.36    command: ['sh', '-c', 'until nslookup db.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do sleep 2; done']  - name: git-sync                     # sidecar: keeps running beside the app    image: registry.k8s.io/git-sync/git-sync:v4.8.0    restartPolicy: Always    args:    - --repo=https://github.com/example-org/website    - --root=/usr/share/nginx    - --link=html    - --period=30s    volumeMounts:    - name: content      mountPath: /usr/share/nginx  containers:  - name: nginx                        # the app    image: nginx:1.27    ports:    - containerPort: 80    volumeMounts:    - name: content      mountPath: /usr/share/nginx  volumes:  - name: content    emptyDir: {}

Replace the repository with your own. The init container runs first and exits. Then git-sync starts; because it has restartPolicy: Always, Kubernetes does not wait for it to exit, and nginx starts next. Both mount the same emptyDir at the same path, so the html link git-sync maintains is exactly where nginx looks for its files. When the Pod is deleted, nginx stops first and git-sync after it.

With kubectl get pod web -w the status stays at Init:0/2 until the name db resolves, then READY shows 2/2: native sidecars count. Read one container's log with kubectl logs web -c git-sync.

When not to use a multi-container Pod

  • Most Pods need one container. The Kubernetes docs call one container per Pod the most common case, and several containers "a relatively advanced use case" for containers that are tightly coupled.
  • Not for scale or resilience. Replicas are separate Pods managed by a Deployment, never extra containers in one Pod.
  • Every helper has a cost. The Kubernetes blog warns that a sidecar "increases complexity, resource consumption, and potential network latency", and suggests a built-in library or shared infrastructure first. The paper adds that containers in a Pod can't be upgraded atomically, so you test more combinations.
  • Check whether the platform does it now. Since Kubernetes 1.37, Pod certificates let a signer issue and refresh a Pod's certificates without a refresher sidecar. Istio's ambient mode, stable since Istio 1.24, gives mesh encryption with no proxy per Pod (part 6).
  • Loosely coupled services belong in their own Pods, connected by a Service.

For the exam

The CKAD curriculum (v1.37) lists "Understand multi-container Pod design patterns (e.g. sidecar, init and others)" under Application Design and Build, worth 20%. The wording changed with v1.22: before that, multi-container Pods were their own 10% domain, and the named examples were ambassador, adapter and sidecar. Today the named ones are sidecar and init, so expect hands-on tasks such as adding an init container that prepares a file, or adding a sidecar that shares a volume with the app and reads its logs.

The CKA names no patterns, but a Pod stuck in Init is a fair Troubleshooting task (30%). For both, practice kubectl logs <pod> -c <container> and kubectl describe pod.

Common questions

Are ambassador and adapter official Kubernetes terms?

Not in the documentation. Only init containers and sidecar containers are documented concepts with their own fields. Ambassador and adapter come from Brendan Burns' 2015 blog post and the 2016 paper, and the Kubernetes blog still uses them. In a manifest, both are ordinary containers or native sidecars.

Do containers in the same Pod share an IP address?

Yes. They share the Pod's IP address and ports, so they reach each other on localhost and two of them can't listen on the same port.

What about patterns across several Pods?

The paper's multi-node patterns, such as leader election, work queues and scatter/gather, coordinate many Pods rather than containers in one. They are a topic for a later series.

Keep going

The rest of the Kubernetes Pod Patterns series:

Patterns stick once you have built them. The Pods and multi-container patterns module of the Gazeek CKAD course gives you a real cluster for each lab, from a first multi-container Pod to init containers, sidecars and adapters on your own, with checks that tell you when you have it right. For exam-style tasks, try the CKAD practice questions with answers, and keep field names fresh with the free Gazeek Memory Gym.

More from the blog