Member-only story

Setting up readiness and liveness health-check probes in Kubernetes with SpringBoot

Eugen Hoble
6 min readOct 14, 2022

--

Readiness and Liveness health-check probes in Kubernetes with SpringBoot

The samples in this article are using minikube. An example of how minikube can be installed on a Linux Mint machine, can be found here.

Liveness

Kubernetes uses liveness probes to know when to restart a container. For example, liveness probes could catch a deadlock, where an application is running, but unable to make progress. Restarting a container in such a state can help to make the application more available despite bugs.

Many applications running for long periods of time eventually transition to broken states, and cannot recover except by being restarted. Kubernetes provides liveness probes to detect and remedy such situations. The result will be that the underlying container that is unhealthy will be restarted.

The configuration parameters for the liveness probe, are the following:

  • initialDelaySeconds

The number of seconds to wait until the probe is initiated after the container start. Useful if you know your app is taking at least 10 seconds to start then simply set this to 10 so the liveness probe won’t count the startup as failure.

  • periodSeconds

--

--

No responses yet