DEV Community

Cover image for Does Sidecar really matter in Kubernetes?
Gitlab Meetup Community
Gitlab Meetup Community

Posted on • Edited on

Does Sidecar really matter in Kubernetes?

Sidecars and Kubernetes have been going hand in hand since a long time now, for they have become an increasingly booming topic in the container world for its functional utility. It is an interestingly essential aspect of the Kubernetes containers that helps skyrocket your business to the next level.

Let's dive into the topic!

Alt Text

  • We would have come across the mastermind of Kubernetes - The Pods. Pods are those single deployments of Kubernetes which consists of the container. Pods can hold multiple containers but these containers run on the shared volume and network.
  • Sidecars can be considered a sibling of Pods that help ease the tasks of the container and so use its resources. Though used over a long period, the pattern of sidecars was not supported as the Kubernetes built-in feature. When more containers started embracing the pod, it was only then that the Sidecars pattern was considered.

Instances of Sidecar Container usage

  • When you need access to the past 24 hours' error logs, you need to lend access to the webserver for a log-aggregation service. This shipping process is carried out by the Sidecars, post their deployment. Note that, it deploys two containers to the same pod. Hence, when you target to use the kubectl command, you also target the main Container by default.

  • Another established use case of Sidecar is the Proxies in a Service mesh architecture. A service mesh can be deployed in two patterns: Per-host Proxy deployment and Sidecar Proxy deployment. When we consider the Sidecar proxy deployment, one sidecar proxy would be deployed per service container which is useful in the case of Kubernetes pods.

Challenges 🤯

Container life cycle dependencies are the major challenge for the Sidecar. Since there is no difference between the Pod containers, it is difficult to determine which Container start first and which one wraps up in the last. So the efficient running of the Sidecar container is essential in order to meet the requirements of the main application.

Take away for today



Follow our community for more goodies, stickers, t-shirts 😉

Twitter

Meetup Group

LinkedIn Group

Top comments (2)

Collapse
 
downey profile image
Tim Downey

Container life cycle dependencies are the major challenge for the Sidecar. Since there is no difference between the Pod containers, it is difficult to determine which Container start first and which one wraps up in the last.

This is a big issue -- particularly with the service mesh use case. 😔

I really hope the KEP for first class sidecar containers makes its way into Kubernetes one day.

Collapse
 
gitlabc profile image
Gitlab Meetup Community

Yes , 200 percent 👍🏼