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.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

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