DEV Community

Cover image for Understanding Kubernetes: part 56 – Native Sidecar Containers
Aurélie Vache
Aurélie Vache

Posted on

35 2

Understanding Kubernetes: part 56 – Native Sidecar Containers

Understanding Kubernetes can be difficult or time-consuming. In order to spread knowledges about Cloud technologies I started to create sketchnotes about Kubernetes. I think it could be a good way, more visual, to explain Kubernetes (and others technologies).

We continue the serie of Sketchnotes about Kubernetes, with a focus on native sidecar containers.

Sidecar Containers
Sidecar Containers
Sidecar Containers

If you are interested, I published an entire illustrated book about Kubernetes, available in paperback on Amazon and in digital version on GumRoad: "Understanding Kubernetes in a visual way".

As usual, if you like theses sketchnotes, you can follow me, and tell me what do you think. I will publish others sketchs shortly :-).

Dynatrace image

Observability should elevate – not hinder – the developer experience.

Is your troubleshooting toolset diminishing code output? With Dynatrace, developers stay in flow while debugging – reducing downtime and getting back to building faster.

Explore Observability for Developers

Top comments (11)

Collapse
 
drdavemckay profile image
Dave McKay

Literally googled this today and got very confused!
Great post, I'll check out your book!

Collapse
 
aurelievache profile image
Aurélie Vache

thanks :)

Collapse
 
lateeftaiwo profile image
lateef-taiwo

Nice article

Collapse
 
citronbrick profile image
CitronBrick

Had been wondering how to find the sketchbook for a looong time ! Happy to see this series & learn new things.

Collapse
 
iosonobenny profile image
Benny Evangelista

Nice sketches :) there's something I don't understand about sidecar containers: they have to be init containers or they could just be additional containers listed with the main container in the "containers" section of the yaml?

Collapse
 
sudharsansadasivam profile image
Sudharsan Sadasivam

@iosonobenny Does not need to be init containers , it can be spec.containers as well instead of init containers.

Sidecar containers - Start with main containers, run concurrently

init containers - Run before main containers

Collapse
 
lateeftaiwo profile image
lateef-taiwo

side car containers are init containers with restartPolicy: Always.
Note the restartPolicy must be Always as this is what makes it a sidecar container

Collapse
 
aurelievache profile image
Aurélie Vache

Yes, in order to define a sidecar, it has to be an init container with restartPolicy equals to Always :).

I know it can be confusing, having a sidecarContainers could be easier to understand but now it is stable so i don't think it will change in the future.

Thread Thread
 
iosonobenny profile image
Benny Evangelista

Technically speaking it's 100% clear. I don't understand why a "simple" container (not an init one) providing additional functions to the "main" container in the same pod, couldn't be considered a sidecar. Just a personal overthinking :)

Collapse
 
vini_vas profile image
Vini Vas

Thanks for sharing this sketchnote! It's a great series for visualizing Kubernetes concepts.

I am kind of confused here. Usually I use sidecars as proxies, monitoring etc running along with the main containers. Eg linkerd has a sidecar injector which adds an init container and a proxy container(non-init container)

My understanding
Init Containers run to completion before the main application containers start. They are used for setup tasks.

  • Sidecar Containers run concurrently alongside the main application container throughout its lifecycle, augmenting its functionality (e.g., logging, proxies, monitoring). While sidecars often have a restartPolicy: Always (the default for regular containers), this doesn't make them init containers. Init containers are designed to finish their job and exit, whereas sidecars are meant to run continuously with the main application. Thanks
Collapse
 
aurelievache profile image
Aurélie Vache

Yes init containers are used, as their names suggests, in order to initialize things.
It's confusing to use the same name but for sidecar container.

ITRS image

See What Users Experience in The Browser — Anywhere, Anytime

Simulate logins, checkouts, and payments on SaaS, APIs, and internal apps. Catch issues early, baseline web performance, and stay ahead of incidents. Easily record user journeys right from your browser.

Start Free Trial

Zero to Live in Seconds: Netlify for Builders

Join us live with Netlify as we explore how modern devs are building, deploying, and scaling full-stack apps at lightning speed. We’ll cover everything from instant deploys to edge functions and what makes Netlify the go-to platform for frontend-first workflows. Perfect for builders who want more shipping, less setup.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️