Graceful shutdown prevents dropped requests during deployments.
Sequence:
Receive SIGTERM signal
Fail readiness probe (stop receiving new traffic)
Wait for in-flight requests to complete
Close connections to dependencies
Exit process
Kubernetes configuration:
terminationGracePeriodSeconds: Time allowed for shutdown- PreStop hook: Commands to run before SIGTERM
Common mistake: Exiting immediately on SIGTERM. Load balancer still sending traffic causes errors.