liveBook · Manning

Liveness check

As explained in Spring in Action, Sixth Edition

A liveness probe is a health indicator that tells an orchestrator whether an application is healthy enough to continue running without being restarted.

A liveness check tells an orchestrator whether an application is healthy enough to keep running. When liveness is down, Kubernetes can terminate the pod and start a replacement. section 18.3.3

Spring Boot exposes liveness through the Actuator health endpoint as a health group. Enable the probes before Kubernetes can query the liveness status. section 18.3.3

management:
  health:
    probes:
      enabled: true

Enable the liveness and readiness health groups with this application.yml setting. section 18.3.3

Liveness differs from readiness. Readiness controls whether Kubernetes sends traffic; liveness controls whether Kubernetes restarts the application. An application can be alive but temporarily unready during startup. section 18.3.3 section 18.3.2

Kubernetes deployment probe

A Deployment can query /actuator/health/liveness on port 8080 every five seconds after an initial delay. A separate readiness probe can query /actuator/health/readiness so traffic stops during initialization without triggering a restart.

Application availability can also be changed programmatically: publish LivenessState.BROKEN when the application cannot safely continue, or LivenessState.CORRECT when it recovers.

How Spring in Action, Sixth Edition covers it

How deep it goes
Defines liveness, contrasts readiness, and shows Spring Boot and Kubernetes configuration without detailing probe implementation internals.
Examples
Shows application.yml probe enablement, Kubernetes HTTP probes, and programmatic LivenessState availability events.
What it assumes
Assumes Spring Boot Actuator and Kubernetes terminology, while explaining liveness and readiness from their operational roles.
What you can do after
Operate/configure Spring Boot and Kubernetes liveness probes for restart decisions and distinguish them from traffic readiness.
How it connects
Connects liveness with readiness, Actuator health endpoints, Kubernetes, pods, and graceful shutdown.

Also explained in

Compare how 7 books explain liveness check →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.