# Sidecar

> Extend container functionality with companion containers

- **Category**: Cloud
- **Subcategory**: Structural
- **Canonical URL**: https://designpattern.fyi/patterns/k8s_sidecar/

---

## Description
The Sidecar pattern extends the functionality of a primary container by running companion containers in the same pod. Sidecar containers can add features like logging, monitoring, synchronization, or networking without modifying the main application. They share the same network namespace and can communicate via localhost.


## Use Cases
Use when you need to add cross-cutting concerns without modifying the main application or when you want to extend functionality with companion processes.





## Trade-offs


### Advantages

- Extends functionality without app changes

- Shared network namespace

- Independent lifecycle and scaling

- Enables modular architecture




### Considerations & Drawbacks

- Increased resource consumption

- Shared pod lifecycle

- Potential coupling between containers







---
**Reference**: [Original Source](https://github.com/k8spatterns/examples/tree/master/structural/Sidecar)

