liveBook · Manning

Termination stage

As explained in Kubernetes in Action, Second Edition

The termination stage is the pod lifecycle stage in which its containers are shut down after the Pod object is deleted.

The termination stage is the final Pod lifecycle stage. It begins when the Pod object is deleted: containers enter Terminating, shut down, and the Pod object is removed after every container stops. section 6.4 section 6.4.3

Container shutdown follows this sequence:

  • Containers terminate in parallel. section 6.4.3
  • Each container’s pre-stop hook runs, then its main process receives SIGTERM. section 6.4.3
  • If the process remains alive when the deletion grace period expires, Kubernetes terminates it with SIGKILL. section 6.4.3
  • Kubernetes deletes the Pod object after all containers stop. section 6.4.3

Controlling shutdown time

Set a five-second default grace period in a Pod manifest with terminationGracePeriodSeconds: 5, or request a ten-second period with kubectl delete po kiada-ssl --grace-period 10. section 6.4.3

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains parallel termination, hooks, signals, grace periods, and final object deletion, with shutdown timing examples.
Examples
Demonstrates Pod deletion commands, a shortened terminationGracePeriodSeconds setting, logs, and SIGTERM handling.
What you can do after
Operate/configure Pod shutdown using deletion grace periods and application SIGTERM handling.
How it connects
Connects Pod lifecycle with containers, liveness probes, pre-stop hooks, SIGTERM, SIGKILL, and deletion grace periods.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.