Video in progress

What does the /actuator/health endpoint return and what do the statuses mean?

It returns the application's overall state as JSON: UP, DOWN, OUT_OF_SERVICE or UNKNOWN. The overall status is aggregated from the state of the components inside it (db, diskSpace, redis).

📖 Answer

A simple response:

{ "status": "UP" }

To see the details:

management:
  endpoint:
    health:
      show-details: when-authorized

Then every component is visible:

{
  "status": "DOWN",
  "components": {
    "db": { "status": "DOWN", "details": { "error": "Connection refused" } },
    "diskSpace": { "status": "UP" }
  }
}

If one component is DOWN, the overall status is DOWN too and the HTTP code is 503. If it is UP, it's 200. Load balancers and Kubernetes look at exactly this HTTP code, they don't read the JSON.

Don't set show-details: always and leave it open to the internet: error messages can leak host names and sometimes versions.