Iterapp uses health checks in order to verify if a container in a pod is healthy and ready to serve traffic. Health checks, or probes as they are called in Kubernetes, are carried out by Kubernetes to determine when to restart a container and used by services and deployments to determine if a pod should receive traffic.
The health endpoint for the application is set with the property
It is the responsibility of the application developer to expose a URL that the kubelet can use to determine if the container is healthy. If this is not added, Kubernetes will assume your app is not responding and stop directing traffic to it.
The default value of the endpoint is
readiness_path = "/health"
Kubernetes will use the health endpoint exposed in
iterapp.toml and make a
HTTP request on it. Response
200 OK means that the app is ready.
The health check is used reduce downtime when switching builds. If the health endpoint stops responding then Kubernetes will stop directing traffic to the new pod.
As Kubernetes checks the
health endpoint every 2 seconds, having
/ as the
endpoint can potentially trigger loading data, requests to external services,
nuke caches etc.
Therefore having the health check as a dedicated endpoint will be a safer approach. It is advised to turn off logging at this endpoint to avoid too many log-lines.
If you want to check external services on your health endpoint, don't do it directly, since it's called every other second. Instead, have a separate task that update some state, and check that state in the health endpoint.