What’s the deal with initContainers and sidecars in Kubernetes?

0
24
Asked By BreezyCloud9 On

I'm curious about the differences and similarities between initContainers and sidecars in Kubernetes. Specifically, why not just use a spec.sideCar instead of having to set initContainers with a restartPolicy of always? From my understanding, setting an initContainer to restartPolicy: always means it keeps restarting on its own—am I missing something?

2 Answers

Answered By CuriousCoder42 On

There was a lot of back-and-forth on this topic when they were designing the API. There really isn't a perfect solution because each option has its nuances and use cases.

Answered By TechieTom84 On

So, with an init container set to restartPolicy: Always, it runs continuously for the pod's lifecycle. This can be useful for supporting services, but it's pretty much like a sidecar in that regard.

JumpingJackFlash -

But how does this differ from just having another container running in the same pod?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

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