100-Days-Of-DevOps-Challenge-KodeKloud

Init Containers in Kubernetes

There are some applications that need to be deployed on Kubernetes cluster and these apps have some pre-requisites where some configurations need to be changed before deploying the app container. Some of these changes cannot be made inside the images so the DevOps team has come up with a solution to use init containers to perform these tasks during deployment. Below is a sample scenario that the team is going to test first.

Note: The kubectl utility on jump_host has been configured to work with the kubernetes cluster.

Steps

  1. Create the k3s-deployment.yaml using the content from this YAML file

  2. Run deployment:

     kubectl apply -f k3s-deployment.yaml
    
  3. Verify resuls:

     kubectl get deployments.apps
     kubectl get pods
    

Good to Know?

Init Containers

Use Cases

Init Container Behavior

Best Practices