advancedSpring Boot on Kubernetes: Health Probes, Config, Scaling & Observability

How does server.shutdown: graceful work in Kubernetes?

When Kubernetes sends SIGTERM, Spring Boot stops accepting new HTTP requests but continues processing in-flight requests until they complete or spring.lifecycle.timeout-per-shutdown-phase is reached. Kubernetes's terminationGracePeriodSeconds must be longer than the graceful shutdown timeout, otherwise SIGKILL arrives and cuts off in-flight requests.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.

How does server.shutdown: graceful work in Kubernetes?

Next Step

Continue to Spring Boot Pod restarts repeatedly in production with OutOfMemoryError← Back to all Kubernetes questions