Certified Kubernetes Administrator (CKA) — Tips and Tricks — Part 5

Init Container is the way to do some setup task before the actual container starts 🏄‍♀

Some Facts

Below are some of the facts that we should know about init container.

  • We can have more than one init container in a pod
  • Init Containers always run to completion
  • Init Container executes in the order they are specified within the YAML definition
  • Each Init Container must complete successfully before the next one starts
  • If an init container fails, Kubernetes repeatedly restarts the Pod until the init container succeeds
  • Init containers do not support readiness probes because they must run to completion before the Pod can be ready.

Shared Volume

For most of the requirements with Init Container, a shared volume between init container and application container is a key. In the exam, you may get a similar question involving shared volume. Let’s take a look at an example

Validation

Once you can create the Pod, we should validate if the pod is running and init container completed its task

Debugging Errors

You may end up in errors, let’s see how to debug that. Update the in YAML @ init container section with the below line

command: ['sh', '-c', 'mkdir1 /work; echo>/work/sharedfile1.txt']

--

--

#ContinuousDevOps #Kubernetes #Microservices #CloudNativeApps #DevOps #Agile

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Arun Ramakani

#ContinuousDevOps #Kubernetes #Microservices #CloudNativeApps #DevOps #Agile