There are powerful use cases for multi container Pods, including:
- service meshes
- Helper services that initialize app environments
- Apps with tightly coupled helper functions (log scrapers)

Multi-container Pods also help us implement the single responsibility principle(SRP) where every container performs a single simple task.
ð AF01.1 - SOLID Principles
Example
the main app container might be serving a message queue or some other core application feature. Instead of adding the encryption and telemetry logic into the main app, we keep the app simple and implement it in the service mesh container running alongside it in the same Pod.

apiVersion: v1
kind: Pod
metadata:
name: simple-webapp
labels:
name: simple-webapp
spec:
containers:
- name: simple-webapp
image: simple-webapp
ports:
- ContainerPort: 8080
- name: log-agent
image: log-agentMulti Container Pods Design Patterns
Comparison Table
Pattern Purpose Common Use Cases Example Sidecar Extend or enhance functionality Logging, monitoring, configuration updates Fluentd for log collection, Envoy as a service mesh proxy Adapter Transform or normalize data Protocol conversion, metric normalization Converting metrics to Prometheus format Ambassador Proxy communication with external systems API gateway, service discovery, TLS termination Envoy or HAProxy for routing and load balancing

Sidecar
Secondary container that enhances or extends the functionality of the main application container.
ð 02.Areas/DevOps/0500 - Kubernetes/0550 - K8s-Extras/../../Kubernetes/K8s-Extras/K8s Sidecar Container
ð Sidecar Pattern & Sidecar Containers
Example:
- A main container running an application server.
- A sidecar container running Fluentd to collect and forward logs from the main container.
Adaptor
ð Adapter
The Adapter pattern involves a secondary container that transforms or normalizes input/output data between the main container and external systems.
- Protocol Conversion: gRPC â> REST
- Normalization: Transform raw metrics or logs into a specific format required by external systems.
Example:
- A main container exposing metrics in a custom format.
- An adapter container translating the custom metrics into Prometheus-compatible metrics ð Observability
Ambassador Pattern
The Ambassador pattern involves a secondary container that acts as an intermediary between the main container and external services.
It abstracts and simplifies communication by handling tasks like authentication, routing, and API requests.
- API Discovery
- Service Discovery
- TLS Termination: The ambassador container terminates SSL/TLS connections before forwarding requests to the main container.
SSL/TLS termination
is the process of decrypting traffic when it enters the network and encrypting traffic when it leaves the network.
A TLS termination proxy used to SSL/TLS termination process.
TLS termination proxy - Wikiwand
What is SSL/TLS termination?
Example:
- A main container running an application server.
- An ambassador container running Envoy as a proxy to handle API Init Containersthe main container. ð Envoy
05309 [[Init Containersnetes Init Containers A Complete Guide]]
06. Containerizing