I am trying to set up readiness probe for my app deployed to k8s but under the actuator/health endpoint I am getting different status, comparing to actuator/health/readiness endpoint.
It's important, that this behaviour is only observed when the app is deployed to k8s cluster.
So without any additional config in the application.properties file I am getting:
➜ ~ curl localhost:8080/actuator/health
{"status":"OUT_OF_SERVICE","groups":["liveness","readiness"]}%
➜ ~ curl localhost:8080/actuator/health/liveness
{"status":"UP"}%
➜ ~ curl localhost:8080/actuator/health/readiness
{"status":"OUT_OF_SERVICE"}%
Which seems to be correct - if the readiness state is OUT_OF_SERVICE, the health endpoint returns OUT_OF_SERVICE as well, because it includes readiness group. This is at least consistent.
On the other hand, when I specify what should be included in the readiness group in the application.properties file it seems to be reporting inconsistent results. In my case I've added one entry to my configuration file, which is: management.endpoint.health.group.readiness.include=ping
This time that's what I have as a result of sending the same set of requests as before:
➜ ~ curl localhost:8080/actuator/health
{"status":"OUT_OF_SERVICE","groups":["liveness","readiness"]}%
➜ ~ curl localhost:8080/actuator/health/liveness
{"status":"UP"}%
➜ ~ curl localhost:8080/actuator/health/readiness
{"status":"UP"}%
This is inconsistent - when both liveness and readiness endpoint return status UP I'd expect to see the same status in the health endpoint.
I am looking for an explanation what I have misconfigured here, and why it works that way.
To make it easier, I've created a small app, where you can verify this behaviour on your cluster: https://github.com/gebertdominik/actuator-bug