Kubernetes — Learn Sidecar Container Pattern

Understanding Sidecar Container Pattern With an Example Project

Bhargav Bachina
Bachina Labs
Published in
6 min readSep 7, 2020


Photo by hidde schalm on Unsplash

Kubernetes is an open-source container orchestration engine for automating deployment, scaling, and management of containerized applications. A pod is the basic building block of kubernetes application. Kubernetes manages pods instead of containers and pods encapsulate containers. A pod may contain one or more containers, storage, IP addresses, and, options that govern how containers should run inside the pod.

A pod that contains one container refers to a single container pod and it is the most common kubernetes use case. A pod that contains Multiple co-related containers refers to a multi-container pod. There are few patterns for multi-container pods one of them is the sidecar container pattern. In this post, we will see this pattern in detail with an example project.

  • What are Sidecar Containers
  • Other Patterns
  • Example Project
  • Test With Deployment Object
  • How to Configure Resource Limits
  • When should we use this pattern
  • Summary
  • Conclusion

What are Sidecar Containers

Sidecar containers are the containers that should run along with the main container in the pod. This sidecar pattern extends and enhances the functionality of current containers without changing it. Nowadays, We know that we use container technology to wrap all the dependencies for the application to run anywhere. A container does only one thing and does that thing very well.

Imagine that you have the pod with a single container working very well and you want to add some functionality to the current container without touching or changing, how can you add the additional functionality or extending the current functionality? This sidecar container pattern really helps exactly in that situation.

Sidecar Container Pattern

If you look at the above diagram, you can define any number of containers for…