Enabling Keycloak Health checks

Learn how to enable and use Keycloak health checks

Keycloak has built in support for health checks. This guide describes how to enable and use the Keycloak health checks.

Keycloak Health checks

Keycloak exposed health endpoints are three:

  • /health

  • /health/live

  • /health/ready

The result is returned in json format and it looks as follows:

{
    "status": "UP",
    "checks": []
}

Enabling the health checks

It is possible to enable the health checks using the build time option health-enabled:

bin/kc.[sh|bat] build --health-enabled=true

By default, no check is returned from the health endpoints.

Available Checks

The table below shows the available checks.

Check Description Requires Metrics

Database

Returns the status of the database connection pool.

Yes

For some checks, you’ll need to also enable metrics as indicated by the Requires Metrics column. To enable metrics use the metrics-enabled option as follows:

bin/kc.[sh|bat] build --health-enabled=true --metrics-enabled=true

Relevant options

Type Default

health-enabled

If the server should expose health check endpoints.

If enabled, health checks are available at the '/health', '/health/ready' and '/health/live' endpoints.

CLI: --health-enabled

Env: KC_HEALTH_ENABLED

true, false

false

On this page