FoxuTech

Kubernetes Probes – Liveness, Readiness and Startup

Kubernetes Probes

Recently we have seen about pod requests and limits, now let’s see about another important and interest feature on Kubernetes. Which is nothing but Probes (Health Check). If you have worked on docker, you may know about health checks, which will help you to check the container status. As like that, here in Kubernetes we have certain condition which helps to make sure only we have healthy pods in our cluster. In additional this given option to find the startup duration, is pod ready for service, or live to serve traffic.

Types of Probes

Kubernetes gives you three types of health checks probes:

  1. Liveness
  2. Startup
  3. Readiness

Liveness Probe

Liveness probes allow you to automatically determine container application (running in a container inside Pod) is healthy and also indicates whether the container is running. If app is unhealthy, Pod will be marked as unhealthy. If a Pod fails health-checks continuously, the Kubernetes terminates the pod and starts a new one.

Sometimes, Liveness probes could help to find a deadlock, where you could see an application is still running, but unable to make any progress. Restarting a container in such a state can help to make the application to available.

Also configure a health check that periodically checks if your application is still alive. Containers can be restarted if the check fails.

Use Cases

Best Practices

The best way to implement the liveness probe is for application to expose a /health HTTP endpoint. When receiving a request on this endpoint, the application should send a 200-399 response if it is considered healthy.

Readiness Probe

Use Cases

Best Practices

The recommended way to implement the readiness probe is for your application to expose a /ready HTTP endpoint. When it receives a request on this endpoint, the application should send a 200-399 response if it is ready to receive traffic.

Startup Probe

Use Cases

Possible options to check:

Kubelet can check a Pods health in three ways. Each probe must define exactly one of these mechanisms:

HTTP

TCP

Command

Facts

Demo:


You can follow us on social media, to get some regular updates

Exit mobile version