The termination grace period is the time Kubernetes gives a container to shut down cleanly. The pod’s spec.terminationGracePeriodSeconds field sets the default, which is 30 seconds. section 6.4.2
Kubernetes follows this shutdown sequence:
- Runs the container’s pre-stop hook, if one exists. section 6.4.2
- Sends SIGTERM to the main container process, asking the application to exit. section 6.4.2
- Sends KILL if the process remains after the grace period expires. section 6.4.2
- Restarts the container afterward when the pod’s restart policy allows it. section 6.4.2
Deleting a Pod object uses a deletion grace period instead. It defaults to terminationGracePeriodSeconds but can be overridden with kubectl delete --grace-period. Containers in the pod shut down in parallel, and the Pod object is deleted after they stop. section 6.4.3
Shortening a pod’s shutdown window
Set spec.terminationGracePeriodSeconds to 5 for a pod that should finish shutdown sooner. A better fix for slow shutdown is usually handling SIGTERM in the application, allowing the server to close cleanly before Kubernetes forces termination. section 6.4.3 section 6.5
Figure 6.15 A container’s termination sequence
Follow the termination sequence from the pre-stop hook through SIGTERM and forced KILL. section 6.4.2

