springboot lifecycle timeout-per-shutdown-phase优雅退出
springboot config:
spring:
lifecycle:
timeout-per-shutdown-phase: 30s #Spring Boot 保证在收到 SIGTERM 后不再接受新请求,并在超时内完成所有正在进行的请求的处理。
#即使无法及时完成,也会记录相关信息,然后强制退出。
Dockerfile中java -jar
改成exec java -jar
pod配置也要改prestop和grace:
https://sre.ink/kubernetes-terminationgraceperiodseconds/