What are the best practices for a health check API and probes in micro-services Kubernetes environment? What are the best practices for a health check API and probes in micro-services Kubernetes environment? kubernetes kubernetes

What are the best practices for a health check API and probes in micro-services Kubernetes environment?


An argument for including databases and other downstream dependencies in the health check is the following:

Assume you have a load balancer exposing some number of micro-services to the outside world. If due to a large amount of load the database of one of these micro-services goes down, and this is not included in the health check of the micro-service, the load balancer will still try to direct traffic to micro-service, further increasing the problem the database is experiencing.

If instead the health-check included downstream dependencies, the load-balancer would stop directing traffic to the micro-service (and hopefully show a nice error message to the user). This would give the database time to restore from the increase in load (and ops time to react).

So I would argue that using a basic /version is not a good idea.


A microservice generally calls other microservices/services to retrieve data, and there is the chance that the downstream service may be down. You can use the "Circuit Breaker Pattern". This pattern is suited to, prevent an application from trying to invoke a remote service or access a shared resource if this operation is highly likely to fail.

You will find a pattern in Observability Patterns (/Health Check) in Microservices. Each service needs to have an endpoint that can be used to check the health of the application, such as /health.1