Init Containers

Gaurav Kaushik
2 min readMay 19, 2021

Init containers are the containers that run once during the startup process of a pod. A Pod can have any number of init containers, & they will each run once(in order) to completion.

Practically, the user can use init containers to perform a variety of startup tasks. They can contain & use software and setup scripts that are not needed by the main containers.

Some of the Use cases for Init Containers can:

  1. Cause a pod to wait for another Kubernetes resource to be created before finishing startup.
  2. Perform sensitive startup steps securely outside of app containers.
  3. Populate data into a shared volume at startup.
  4. Communicate with another service at startup.

Lets understand the concept of Init containers by means of a demo:

  1. Create a pod definition with ‘initContainers’
Delay of 30s given using init container

2. This can be observed that init-pod will start only after a sleep of 30 seconds is executed, after that any other containers can be started.

So, above was a simple demonstration of init containers.
Thank You!

--

--