Sidecar
Also called: sidecar container, sidecar proxy.
A second container that runs in the same pod as your app and helps it, for example by shipping logs or traces, or by acting as a proxy. The two share the network, so the app just talks to localhost. The helper can be updated, limited or restarted on its own, without changing the app's code.
The app and its helper share one pod. The app only talks to localhost; the sidecar ships the traces. Stop the backend and watch the app stay fast.
Answered: 0 · App time: 40 ms · Buffered: 0 · Shipped: 0 · Dropped: 0
No requests yet. The tracing backend is up.
Say it in a prompt
Run an OpenTelemetry Collector as a sidecar container in the checkout pod. The app sends its spans over OTLP to localhost:4317; the collector batches them and exports them to the tracing backend. If the backend is down, the collector keeps data in a bounded sending_queue and retries with retry_on_failure; when the queue is full, new data is dropped instead of slowing the app. The backend address and API key live only in the collector config. Give the sidecar its own CPU and memory limits. Vague vs precise prompt
Vague prompt
send our traces to the tracing tool Typical resultAdds the vendor's exporter to every service, with the backend address and API key in each app's config. Retries and buffering differ per language, spans kept in the app's memory are lost when it restarts, and changing the tracing backend means a new release of every service.
Precise prompt
Add an OpenTelemetry Collector sidecar to the checkout pod. The app exports spans to localhost:4317; the collector batches them, retries with backoff while the backend is down (bounded sending_queue), and holds the backend address and key. Typical resultThe app only knows localhost. Batching, retries and the backend settings live in the collector, so a backend outage or a switch to another backend is handled in the sidecar without a new release of the app.
Seen on
- Kubernetes docs: Sidecar containers run next to the main app container in the same Pod and add things like logging, monitoring or data sync without changing the app's code; they share its network and storage.
- Azure Architecture Center: Describes the Sidecar pattern: helper tasks such as monitoring, logging and proxies run in a separate container next to each app instance and share its life cycle.
- OpenTelemetry docs: The agent pattern runs a Collector next to the app, for example as a sidecar; the app sends its telemetry to the Collector, which sends it on to one or more backends.
You might describe it as
- a helper container that rides along with the app
- the app talks to localhost and the helper does the rest
- ship the logs without touching the app's code
Not to be confused with
- Container image
A container image is what a container starts from; a sidecar is a second container in the same pod that helps the main one.