Health Probe Checks in Kubernetes

Health Probe Checks in Kubernetes

·

2 min read

This topic will explain how health probe checks works in Kubernetes

  • Readiness probe

  • Liveliness probe

  • Startup probe

In Kubernetes, there are three types of health probes that can be used to monitor the health of a container:

  1. Liveness probe: A liveness probe is used to detect if a container is still running as expected and is healthy. If the probe fails, the container is restarted.

  2. Readiness probe: A readiness probe is used to determine if a container is ready to accept incoming requests. If the probe fails, the container is not sent any traffic until it passes. Examples some web servers are not ready to accept incoming traffic, we can ensure that no incoming request are coming in the pod.

  3. Startup probe: A startup probe is used to check if a container is fully initialized usually in slow start containers after a given time. Examples are legacy applications that takes minutes to start (JVM) . We don't want to overwhelm it with Liveliness probe since it will restart over and over again.

Each type of probe can be defined in the Pod specification using one of the following methods: HTTP GET, TCP socket connection, or command execution. The probe definition includes various configuration options such as the initial delay, the interval between probes, and the number of consecutive failures required before marking a container as failed.

Health Probe in Kubernetes: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/

Configure the time for Probes

Control the behavior of probes

  1. initialDelaySeconds

  2. periodSeconds

  3. timeoutSeconds

  4. successThreshold

  5. failureThreshold

  6. terminationGracePeriodSeconds

https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/

How to debug in Kubernetes?
- Via kubectl logs
- Via kubectl exec
- Via kubectl describe
- Via kubectl events