Sidecar Concept In 3 Minutes

What is sidecar pattern?

Similar to a sidecar attached to a motorcycle, A sidecar component provides the main service or application with supportive features. It is not part of the code and never share the application’s process or container. However, It share the same lifecycle of its parent (the main app or service).

Logging, monitoring, encrypting and configuration are common features which we need to implement into any service in a distributed system (microservices, cloud native…). It is the best use case of the sidecar!

We may ask: Why not to integrate these functionalities into my code? Well, You can but think about loose coupling and resiliency ! If all the components share the same resources (processes or containers), an outage in one of these components may affect the entire system.

But why not to implement the infrastructure features as standalone microservices? Here you may think about the complexity of deployment especially if multiple teams implement multi-language services where each service has its own dependencies (We don’t need a sidecar for small applications)

Why to use it?

We need a tradeoff between a tightly coupled, efficient solution and a decomposed solution but heterogeneous and less performant (latency). Sidecar pattern is that solution!

It is mainly applied in Kubernetes deployment. However, we can use it in a non-containerized architecture. A sidecar is independent from its primary application in terms of runtime environment and programming language. Nevertheless, It is connected to it. It goes wherever the parent application goes. For each instance of the application, an instance of the sidecar is deployed and hosted alongside it.

Use cases

Service Mesh

Service mesh is a way to control how different parts of an application share data with one another. It providers a configurable infrastructure layer to handle network‑based inter-process communication among services using (APIs). A service mesh is deployed as a service proxy or sidecar in the same K8s pod of an application container. Nginx, Consul and Envoy are some examples of open source service meshes.



K8s documentation is a great start for loggings patterns in distributed system using sidecar.



Both Prometheus and Sensu can be deployed as a sidecar to monitor the health of your K8s pods or nodes.



Sidecars is a deployment pattern where common features like logging and service 2 service communication can be attached to your service without sharing the resources. It ‘s a formal convention of K8s, but they’ve picked up speed as the K8s community experiments and figure out what works. Sidecars are: Modular, Composable and Reusable.




Code Factory Berlin is building tailored made DevOps and developers tools for the enterprise. We love & do open source.

Recommended from Medium

Docker Adoption Pathway — Part 1

How do generators work?

Migrate MongoDB GridFS Data to AWS S3

The power of integration in API-first referral marketing

A brief overview of Energy 8 Project 2021 achievements and some plans for the future

Why I got into Software Engineering!

Create GCP VM instance using Terraform

How to Source Candidates on WordPress

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Soulaiman Ghanem

Soulaiman Ghanem

Writes about technology, products and productivity

More from Medium

Deep Dive Into Workflows in WSO2 API Manager

AKS Features That May Intrigue You

Continuous Integration of Github Releases with Jenkins

Integration Testing