Identifying Pods and Their Container Configurations
Begin by listing all pods in your cluster. In this lab, there are three pods: red, green, and blue.Detailed Pod Descriptions
Retrieve a detailed description of the pods to uncover specific container configurations:kubectl describe pod command, you can view sections such as command, state, mounts, conditions, volumes, and events. Regular containers are listed under the “Containers” section, while init containers appear separately under “Init Containers”.
For example, reviewing the blue pod displays the following snippet:
Inspecting Specific Pods
The “red” Pod
The red pod runs a single container. Its configuration is shown below when describing the pod:Since no “Init Containers” section is present, this pod does not include an init container.
The “blue” Pod
The blue pod, on the other hand, includes at least one init container:Deploying a New Pod: “purple”
A new pod named purple is deployed with one container and two init containers. First, verify the pod’s status:The main purple application container will not start until both init containers complete their execution. In this example, the total wait time is 30 minutes (10 minutes + 20 minutes).
Updating a Pod to Add an Init Container
Next, update the pod specification for the red pod to include an init container that uses the BusyBox image to sleep for 20 seconds. First, check the current state of the red pod:Troubleshooting a Failing Pod: “orange”
A new pod named orange was deployed but is immediately encountering an init container crash loop. First, check its status:Ensure that commands are correctly spelled in your container specifications because minor typos can prevent your pod from initializing properly.
This concludes the Kubernetes init containers lab. In this lesson, you learned to inspect pod configurations, differentiate between regular and init containers, update a pod to include an init container, and troubleshoot configuration errors due to command typos. For more information on Kubernetes concepts, check out these resources: