Kubernetes Probes

Kubernetes probes are health checks that the kubelet (the node agent) performs on containers running inside a Pod. Their primary purpose is to let Kubernetes know the state of your application so it can make intelligent decisions, like restarting a failing container or not sending traffic to a pod that isn't ready.


There are three distinct types of probes, each serving a different purpose:

  • Liveness Probe (livenessProbe) 

Purpose: Answers the question, "Is the application alive and running?" 

Action: If a liveness probe fails, the kubelet restarts the container.

Use Case: To recover from a "deadlock" or a situation where the application is running but is unable to make any progress. A classic example is a web server that has stopped responding to HTTP requests.

  • Readiness Probe (readinessProbe)

       Purpose: Answers the question, "Is the application ready to accept traffic?" 

       Action: If a readiness probe fails, the kubelet removes the Pod's IP address from the                       Endpoints of all Services that match the Pod. This means the Pod won't receive any new                 traffic. 

       Use Case: To handle situations where an application is temporarily busy or not fully                      initialized. For example: During startup, while it loads large data caches or configuration.              When it's under heavy load and temporarily can't handle more requests.

  • Startup Probe (startupProbe)

     Purpose: Answers the question, "Has the application finished starting up?"

     Action: Disables all other liveness and readiness checks until it succeeds. If it fails, the                   container is restarted. 

     Use Case: For applications with slow startup times (e.g., legacy Java applications). It gives           them ample time to start up without being killed by a liveness probe that is set for a faster-             running application.


Comments

Popular posts from this blog

Monolithic Architecture

Advantages and Disadvantages of Monolithic Architecture

Load Balancers and Load Balancers Algorithms