spring-boot 2 graceful shutdown web

7/16/2018

Is there any recommended way to gracefully shutdown a Spring:boot 2 app in Kubernetes.

  1. Catch a termination signal SIGTERM
  2. Tell Tomcat to stop taking new requests. (or Jetty, Undertow or Netty/WebFlux depending on the embedded web server used). Or tell SCS to stop sending/listening for messages on Kafka.
  3. Tell Actuator health endpoint to go SERVICE_UNAVAILABLE (503)
  4. And then after a X seconds shutdown the application or (SIGKILL)

I'm trying to do a graceful shutdown Rest apps and SCS (kafka consumer&producer) apps

-- DarVar
kubernetes
spring-boot
spring-boot-actuator
spring-cloud-stream

0 Answers