Repository navigation
Replies: 5 comments 9 replies
|
thanks 👍 Case 1: Disk full while server is runningStarted: UP (server is there in general) Case2: No Cache connectionStarted: UP (server is there in general) |
|
For the startup probe / dedicated endpoint: Afaik, startup probes are intended to use the same probe as the liveness probe, just using a different |
|
@thomasdarimont W.r.t. to the SPI. I noticed you have this https://github.com/thomasdarimont/keycloak-health-checks/tree/master/src/main/java/com/github/thomasdarimont/keycloak/healthchecker/spi. I'm wondering if we could discuss it and see if we can just use it. Wdyt? |
|
It would be worth splitting this into two separate discussions:
From a priority perspective 1 is the most important. Having well behaved probes is one of the corner stones of having a well behaved system on K8s. Around probes in general I think what @pedroigor has laid out in the initial description is going in the correct direction, and we should focus on the general design of it, then we can boil down to individual checks later. I also agree with the ability to make it configurable, but that should not be a must from a users perspective. Keycloak should out of the box have the right checks for the right probes, and not require users to understand or tweak this themselves. I'm not 100% convinced that we even need to support custom checks here, so would like some clear use-cases for that upfront. One open question to me is if having the probes as http endpoints on the default http listener is the correct way to go. For example if an individual node is flooded with requests, that could lead to liveness probe timing out, and K8s restarting the node, while in fact it should just have backed-of traffic to the node. |
|
@thomasdarimont Is there anyway to implement LDAP HealthCheck Endpoint as your current HealthCheck endpoint is not supported from 20.0.0 and when I checked with 22.0.2, there are number of changes w.r.t files from keycloak. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Introduction
This discussion is a follow-up to the Health Endpoint original proposal. Please, consider reading it first in order to understand better some of the proposals herein presented.
Some of the information herein documented is basically exposing the current status of health checks in Keycloak so that we can evaluate what can be improved.
Some key points that are still unclear and undocumented are:
liveness,readiness, orstartupcheckliveness,readiness, andstartupchecksFor now, I would like to avoid discussing implementation details but try to focus on the design, if possible.
The Health Protocol
Health checks are obtained from the
/healthendpoint.By querying the
/healthendpoint, the health checks available from allhealth groupsare serialized into a JavaScript Object Notation (JSON) with the following structure:More details about the health protocol can be read from the MicroProfile Health Protocol and Wireformat document.
Default Health Groups and Probes
Within the health endpoint, there are some key health check groups available by default. Each one is targeted for a specific health probe:
/health/started/health/readiness/health/livenessThe
startedhealth group should be used to probe if the server is fully started.The
readinesshealth group should be used to probe if the server is ready to serve requests.The
livenesshealth group should be used to probe if the server is alive and indicate whether or not the instance should be restarted.The default health groups are based on the Kubernetes Probes and the checks available from each health group depend on the constraints and requirements for each type of probe.
Probing the server startup
Startup probes should use the
/health/startedendpoint to check if the server is fully started. In general, this endpoint should not return any specific status check and the overall status should always beUP. If any failure happens when starting the server the endpoint is not even available and the server is going to exit with a status code indicating the error.A positive status from this endpoint indicates that:
Although the server does not perform any long-running operation after startup that could bring a negative overall status, this endpoint is still relevant to make sure the server is started and possibly support long-running operations that could impact its
startedstate.Probing the server readiness
Readiness probes should use the
/health/readinessendpoint to check if the server is ready to serve requests.By default, the server does not provide any readiness check because the overall status relies on the server being started. Once started, the assumption is that the main components are bootstrapped, fully initialized, and ready to serve requests.
However, it should be possible to register some built-in readiness checks if needed such as:
These checks should not be used for collecting metrics but to indicate if the server should stop serving traffic even if temporarily.
The server should not be opinionated about the checks available from this endpoint but allow users to combine them accordingly to their needs.
Probing the server liveness
Liveness probes should use the
/health/livenessendpoint to check if the server needs a restart after transitioning to a broken state. In general, this endpoint should not return any specific status check and the overall status should always beUPindicating that the server instance is still alive and reachable through its HTTP(s) interface.As a general rule, any check added to this endpoint should not depend on downstream services because a restart is very unlikely to solve the problem and possibly introduce cascading failures. The same goes for any other check that can not be solved by a server restart. For instance, causing restarts due to database failures might impact requests that can be served with the information from the cache and a restart is very unlikely to solve the problem. The same goes for cluster failures where restarts can cause even more problems.
The checks that should go into this endpoint are not clear as they are more related to environment-specific issues such as deadlocks, memory leaks, or disk failures.
It should be possible to register any available health check if needed.
@andreaTP Do you have an idea about what liveness checks make sense for the operator so that we can recover instances transitioned to a broken state?
Active and Passive Health Checks
Health checks can perform active or passive checks:
Active - Checks that periodically perform an operation in order to calculate a status
Passive - Checks that calculate the status based on metrics, failures, errors, and information about the traffic
We should be favoring passive checks as much as possible not only because they reduce the impact on the server runtime but also because they enable a variety of checks based on the metrics collected by the server.
One open question here is if it makes sense to have metrics disabled when health check is enabled.
User-defined Health Checks
It should be possible to register custom health checks and expose them through the health endpoint.
We should be providing an SPI to avoid depending on the stack (e.g.: Quarkus or Wildfly) that the server is using.
All reactions