Operations Basics / Version 2110
Table Of ContentsThe runlevel endpoint provides the possibility to switch the runlevel on a content server.
Endpoint properties.
management.endpoint.runlevel.enabled=true
Endpoint URL.
http://localhost:8081/actuator/runlevel
When requested using a GET HTTP request, the endpoint will respond which runlevel is currently active.
Response.
{ "RUNLEVEL": "ONLINE" }
To switch the runlevel, send a POST request to the endpoint with the desired runlevel and a grace period for the switch.
Switch runlevel.
curl -X POST -H "Content-Type: application/json" \ -d '{"runlevel": "MAINTENANCE", "gracePeriod": 30}' \ http://localhost:8081/actuator/runlevel
This runlevel endpoint can be used together with the uapiConnectionReadiness
health indicator to implement connection
draining in a Kubernetes setup.
When triggered from a preStop
lifecycle hook combined with an appended waiting timeout,
the content server will notify all clients that it will switch its runlevel to maintenance. As a result clients can use the
uapiConnectionReadiness
health indicator to be included in its readiness health group to tell Kubernetes that it should
no longer route any request to the pod. During the grace period, the client can process all active requests to drain its
connections.