Day 18/40 - Kubernetes Health Probes Explained | Liveness vs Readiness Probes
About this video
### Final Summary This video, part of the **CKA 2024 series (Video #18)** by Push, provides a comprehensive guide to **Kubernetes health probes**, focusing on their role in ensuring application reliability and high availability. Viewers are encouraged to engage actively with the content by leaving comments and liking the video, aiming for 200 interactions within 24 hours. #### **Health Probes Overview** Health probes are essential mechanisms that monitor and manage the health of applications running in Kubernetes. The three primary types of probes are: - **Liveness Probe**: Ensures the application is running correctly and restarts the container if it fails due to issues like network errors or application crashes. This promotes self-healing within the system. - **Readiness Probe**: Verifies that the application is ready to serve traffic. It prevents traffic from being routed to pods that are not fully initialized or are temporarily overloaded. - **Startup Probe**: Specifically designed for slow-starting applications, this probe ensures the application has sufficient time to initialize before other probes begin monitoring. #### **Probe Mechanisms** Probes can perform health checks using one of three methods: - **HTTP Probe**: Sends an HTTP GET request to a specified endpoint (e.g., `/health`) and expects a successful response (e.g., status code 200). - **TCP Probe**: Attempts to establish a TCP connection on a specified port. If the connection fails, the probe marks the container as unhealthy. - **Command Probe**: Executes a command inside the container. A successful exit code (0) indicates the container is healthy. #### **Demo Walkthrough** The video includes practical demonstrations of configuring health probes: - **Command-Based Liveness Probe**: Demonstrated using a `busybox` image, where a file (`temp/healthy`) is created or removed to simulate health status. The probe executes a `cat` command on this file every 5 seconds after an initial delay of 5 seconds. If the file is missing, the probe fails, triggering a container restart. - **HTTP-Based Liveness Probe**: Uses an HTTP GET request to `/health` on port 8080. If the endpoint does not respond successfully, the container is restarted. - **TCP-Based Liveness Probe**: Attempts to open a TCP connection on port 8080. If the connection fails, the probe marks the container as unhealthy. #### **Key Probe Properties** To fine-tune the behavior of health probes, several key properties are configurable: - **Initial Delay**: Specifies the time to wait before the first health check, allowing the application to initialize. - **Period Seconds**: Defines the interval between consecutive health checks. #### **Liveness vs. Readiness Probes** While both liveness and readiness probes ensure application health, their behaviors differ: - **Liveness Probes**: Restart containers when health checks fail, ensuring continuous operation. - **Readiness Probes**: Prevent traffic from reaching pods until they are ready to handle requests, without restarting them. An example demonstrates configuring a readiness probe using an HTTP GET request on port 8080. If the probe fails (e.g., due to an unavailable endpoint), the pod enters a crash loop. The video emphasizes hands-on practice and highlights the importance of understanding these concepts for real-world Kubernetes deployments. #### **Conclusion and Next Steps** The video concludes by encouraging viewers to practice configuring health probes independently and seek help if needed. A follow-up video on **config maps and secrets** is teased, reinforcing the importance of mastering Kubernetes fundamentals for certification and practical application.
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