← Back to microservices patterns map
Microservices Pattern

Sidecar Pattern

Run a helper container beside the app to handle cross-cutting infrastructure concerns.

infra

Detailed Description

Sidecars move infrastructure behavior out of application code. The main service stays focused on business behavior.

This is common for proxies, log collectors, telemetry agents, and certificate rotation.

Visual Diagram

Kubernetes Pod
  ┌─────────────────────────────────┐
  │  Pod                             │
  │  ┌────────────┐ ┌─────────────┐ │
  │  │  Main App  │ │   Sidecar   │ │
  │  │  :8080     │ │  Envoy Proxy│ │
  │  │            │ │  Log Agent  │ │
  │  └────────────┘ └─────────────┘ │
  │  shared network + storage       │
  └─────────────────────────────────┘

Tradeoffs

Pros

Language agnostic, no app-code changes

Cons

Extra resources and operational moving parts

Examples: Istio Envoy sidecar, Datadog agent, Fluentd

Comments

Sign in to leave a comment. Your name and photo come from Google; nothing else is shared.

Loading comments...