β Back to microservices patterns mapinfra
πΈ
Microservices Pattern
Sidecar Pattern
Run a helper container beside the app to handle cross-cutting infrastructure concerns.
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