Should I implement a dedicated api endpoint for Kubernetes health checks?
Actually, if you are concerned about affecting the performance of your application, from the compute/memory resources perspective it depends on what material you are serving under /
.
If you are serving a big blob of HTML it will actually affect your performance and I'd recommend implementing a different endpoint /health
for healthcheck to be used with Kubernetes Readiness Probes for example.
If the content of /
is very light, it's unlikely that it will make a difference. In terms of improving the 'stress' you are putting on the resources when running a healthcheck using Liveness/Readiness probes in K8s, you could alleviate that by increasing the periodSeconds
in them, but keep in mind that if you have multiple pods behind a Kubernetes service and one of the pods has some issue with the healthcheck it would take longer for that pod to be removed from the service causing a longer potential 'downtime'.