Application Health Checks
Understand Liveness And Readiness
Open application URL and edit the URL by replacing
todo.html
with following path:/q/health
/q/health/live
/q/health/ready
Our To Do application already has the URLs which can be used to configure liveness and readiness probes.
Health check URL Go back to OpenShift web console, scale the todo-db Pod to 0 and now open the application URL with
/q/health/live
and/q/health/ready
paths.Ideally, the application is up and running that's why the
/q/health/live
returns"status": "UP"
. However, it cannot connect to database so it's not ready to use or serve any incoming requests so the/q/health/ready
returns"status": "DOWN"
Kubernetes/OpenShift uses application health checks for traffic routing/load balancing, auto recovery/self-healing etc.
Health check URL Scale the todo-db Pod back to 1 and wait until it's up and running.
Setting The Probes
Select the quarkus-todo-app node, click on the Actions drowdownlist menu then select Add Health Checks.
Add health checks Click Add Readiness probe link.
Add health checks Enter following inputs:
Path:
/q/health/ready
Initial delay:
60
Timeout:
5
Then click on the check button.
Add health checks Click Add Liveness probe link.
Add health checks Enter following inputs:
Path:
/q/health/live
Initial delay:
60
Timeout:
5
Then click on the check button.
Add health checks Click Add button.
Add health checks Deployment object will deploy a new Pod with health checks settings and terminate the old one. Wait until this completed.
Add health checks Go to Resources tab and click View logs link.
Add health checks You should see the logs indicate that
/q/health/ready
and/q/health/live
URLs get called bykube-probe
agent. Basically, Kubernetes/OpenShift will keep doing application health checks.

Last updated