Day 11/40 - Multi Container Pod Kubernetes - Sidecar vs Init Container
About this video
### Summary of the Video Content: 1. **Introduction**: - The video is part of the "CKA 2024" series, specifically video number 11. - Previous videos covered Docker, Kubernetes fundamentals, pods, deployments, services, and related concepts. - This video focuses on **multi-container pods** and related concepts like init containers and sidecar containers. 2. **Engagement Request**: - The creator requests viewers to engage by leaving at least **120 comments** and **280 likes** within 24 hours. - Encourages sharing learnings on social media platforms like LinkedIn or Twitter to spread awareness. 3. **Multi-Container Pods Overview**: - A pod can have multiple containers working together. - Types of containers: - **Init Containers**: Run before the main app container to perform setup tasks. The app container starts only after the init container completes its task. - **Sidecar Containers**: Run alongside the app container, providing helper functions (e.g., logging, monitoring). - All containers in a pod share the same resources (CPU, memory, storage). 4. **Demo Setup**: - Demonstrates creating a pod with an **init container** using a YAML file. - Uses the `busybox` image for both the app container and init container. - Explains how to define environment variables within the pod manifest. 5. **Init Container Workflow**: - The init container performs an `nslookup` to check if a service is available. - If the service is not found, the init container keeps retrying every 2 seconds using a loop (`until` command). - Once the service is available, the init container completes, and the app container starts. 6. **Deployment and Service Exposure**: - Creates a deployment using the `nginx` image and exposes it as a service on port 80. - The pod remains in the initialization state until the service is exposed. - After exposing the service, the init container completes, and the app container starts running. 7. **Logs and Debugging**: - Shows how to view logs of the init container to monitor its activity. - Demonstrates accessing environment variables inside the container using the `printenv` command. 8. **Multiple Init Containers**: - Adds a second init container (`MyDB`) to the pod, which waits for another service (`redis`) to be available. - Highlights that **all init containers must complete successfully** before the app container starts. - Creates a second deployment and service for the `MyDB` init container, allowing the pod to initialize fully. 9. **Key Learnings**: - Pods can have multiple init containers, each performing specific initialization tasks. - The app container starts only after all init containers complete their tasks. - Environment variables can be defined and accessed within containers. 10. **Assignment and Community Support**: - Provides a small assignment in the GitHub repository (Day 11 folder) for practicing multi-container pods. - Encourages viewers to seek help or assist others via the Discord server. 11. **Next Video Preview**: - The next video will cover **DaemonSets**, **CronJobs**, and **Jobs** in Kubernetes. 12. **Closing Remarks**: - Thanks viewers for their support and engagement. - Encourages completing the comments and likes target for the video.
Course: Certified Kubernetes Administrator Full Course For beginners | CKA 2025
This playlist contains the complete CKA series for beginners, based on the latest 2025 curriculum. It includes 40+ videos with hands-on demos, assignments, and exam-based scenarios. We will cover everything from the basics to the Advanced, including fundamental concepts such as Docker, containers, Docker storage and networking, DNS, etc.
View Full Course