Skip to main content
Cloud / DevOpsContainers & OrchestrationDiagramIntermediate

Sidecar Pattern

KO: 사이드카 패턴·EN: Sidecar Pattern·JA: サイドカーパターン

A container design pattern that co-locates a helper container alongside the main application container in the same Pod to offload cross-cutting tasks like mTLS proxying, logging, and secret syncing

Table of Contents

Structure Diagram

Sidecar Pattern (Main App + Co-Located Helper Containers)Tap a node
mTLSlocalhostOTLPShared VolIncoming …Sidecar P…Main AppTelemetry…Secret Ag…
ROOTIncoming Traffic
1 link
Quick Answer

What is Sidecar Pattern?

A container design pattern that co-locates a helper container alongside the main application container in the same Pod to offload cross-cutting tasks like mTLS proxying, logging, and secret syncing. It is a core concept in Containers & Orchestration within Cloud / DevOps.

Core Principles

Named after a motorcycle sidecar, the Sidecar Pattern co-locates a helper container inside the same Pod as the main application container, sharing the same network namespace (localhost) and storage volumes.

This cleanly separates infrastructure concerns—mTLS encryption, traffic routing, log shipping, secret rotation, and database auth proxying—from business logic, allowing teams to apply uniform operational capabilities across polyglot applications without modifying app code.

Practical Takeaways

  • Use Kubernetes Native Sidecars: Define sidecars in initContainers with restartPolicy: Always (K8s 1.29+) so they start before the main app, stay running alongside it, and terminate cleanly when batch Jobs finish.
  • Account for fleet-wide resource cost: A sidecar consuming 100MB per Pod adds 50GB across 500 Pods. Use a node-level DaemonSet instead of per-Pod sidecars whenever shared node collection suffices (e.g., stdout log shipping).
  • Isolate resource limits: Give sidecars dedicated CPU and memory bounds so log bursts or proxy spikes never starve the main application container.

Notable Examples

  • Envoy / Istio Service Mesh: Intercepts Pod traffic transparently for mTLS, retries, and observability.
  • Google Cloud SQL Auth Proxy & HashiCorp Vault Agent: Provides automatic IAM-authenticated DB tunnels and rotated secret files via local sockets or shared volumes.
  • OpenTelemetry Collector Sidecar: Buffers and exports traces and metrics without adding heavy telemetry overhead to the app process.