Sidecar pattern vs ambassador pattern


Sidecar is one of the important patterns in today’s world of containerization and Kubernetes. Sidecar is a single node pattern and when we talk about a single node pattern we have another major pattern which is called ambassador pattern. In this article, we will talk about the difference between the sidecar pattern vs ambassador pattern.

Well, let’s first understand the single-node patterns and then we will see sidecar pattern vs ambassador pattern.

Single Node Patterns

In single-node patterns, you schedule all the related workload or containers on the same node. This is the reason it is called a single node pattern.

Now let’s see what are sidecar and ambassador pattern and what is the difference between these two.

Sidecar pattern: 

In this pattern, we schedule a workload on the same hosts which is intended for specific things that don’t concern your application. One of the use cases can be log shipping.

Example: Your application container is scheduled alongside a container is scheduled to take care of the logs generated by the application container. One of the other use cases can be exposing the system metrics by running a different container on the same host.

sidecar pattern

Ambassador pattern:

This pattern is almost the same as sidecar pattern the difference is that in ambassador pattern every interaction to the world goes through the ambassador container. Here the containers are coupled means without ambassador pattern, the application cannot contact the outside world.

Example: Proxy where all the requests to the container go through an ambassador running alongside it. The main container can be accessed by the ambassador using local interfaces like the localhost.

Ambassador Pattern

These are two very famous design patterns that are used in container deployments.

You can read about other patterns like reconciler pattern and server launch patterns and antipatterns.

If you like the article please share and subscribe.


Gaurav Yadav

Gaurav is cloud infrastructure engineer and a full stack web developer and blogger. Sportsperson by heart and loves football. Scale is something he loves to work for and always keen to learn new tech. Experienced with CI/CD, distributed cloud infrastructure, build systems and lot of SRE Stuff.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.