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.
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.
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.
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.