Init Containers
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:
- Cause a pod to wait for another Kubernetes resource to be created before finishing startup.
- Perform sensitive startup steps securely outside of app containers.
- Populate data into a shared volume at startup.
- Communicate with another service at startup.
Lets understand the concept of Init containers by means of a demo:
- Create a pod definition with ‘initContainers’
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!