kubernetes liveness readiness and startup probes
Kubernetes tends to mask the actual health check endpoint into something such as /health/ready or /health/live. I was trying to configure livenessProbe and turns on it also requires readinessProbe and startupProbes. Let's use keycloak as an example. It exposes different healthcheck endpoint on port 8080.
Keycloak exposes 4 health endpoints:
- /health/live
- /health/ready
- /health/started
- /health
So in my kubernetes health check configuration i would have something below:
FAQ
Do you need all to be configured?
Very likely yes. It is best to include startupProbe, livenessProbe and readinessProbe in your configuration to avoid unnecessary pod restarts.
Does the endpoint needs to be an actual endpoint?
Yes it has to be the exact path and port number to your application.
Can I use output from kubectl get pods -o yaml for my configuration?
You may be tempted to do a kubectl get pod -o yaml to re-use the configuration but those endpoint are masked and not the actual ones. So you probably not going to get it to run.
As long as it the endpoint returns HTTP status code 2xx, then we are good.
Comments