With Kubernetes being a declarative system, the lifecycle and hooks that are offered for Pods and Containers are the points where your code can take actions. Pods have a lifecycle, as do containers, and Kubernetes offers a number of places where you can provide explicit feedback to the system to have it operate as you’d like. In this chapter, we will dig into the expected lifecycle, hooks available to use, and examples of how to use them.
The topics will include:
- Pod lifecycle
- Container lifecycle
- Probes
- Container hook: post-start and pre-stop
- Initialization containers
- How to handle a graceful shutdown