When deploying a service in a production environment, it is critically important to ensure that it is going to work smoothly to avoid interrupting the service.
Kubernetes and HAProxy are able to detect when a service is running correctly, and take action when it's not, but we need to give an endpoint that acts as a health check and configure it to be pinged at regular intervals, for early detection of problems.
For simplicity, we will use the root URL as a health check, but we can design specific endpoints to be tested. A good health checkup checks that the service is working as expected, but is light and quick. Avoid the temptation of over testing or performing an external verification that could make the endpoint take a long time.
An API endpoint that returns an empty response is a great example, as it checks that the whole piping...
An API endpoint that returns an empty response is a great example, as it checks that the whole piping...