Skip to content

Sidecar Pattern

In one line

Sidecar pattern: a helper container runs alongside the main app — handles logging, monitoring, proxying without coupling.

In simple words

The sidecar pattern runs a helper container next to your main application container, within the same pod. The sidecar handles cross-cutting concerns like logging, monitoring, or network proxying — without the main app needing to know.

Benefits: 1. Separation of concerns 2. Reusability 3. No code changes 4. Same lifecycle

Common uses: Log forwarding (Fluentd), service mesh proxy (Envoy), config sync (git-sync).

Example

yaml
containers:
- name: main-app
  image: my-app:1.0
- name: log-forwarder     # sidecar
  image: fluentd:1.14
  volumeMounts:
  - name: shared-logs
    mountPath: /var/log/app

The main app writes logs to a shared volume. The Fluentd sidecar reads and forwards them. The app does not know about log forwarding.

Common confusions

  • Confused with: Ambassador Pattern

    The difference: A sidecar is a general helper container. An ambassador is a specific sidecar that acts as a proxy to external services. All ambassadors are sidecars, but not all sidecars are ambassadors.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary