Discussion More Information • Managed Lifecycle Example • Container Lifecycle Hooks • Attaching Handlers to Container Lifecycle Events • Terminating with Grace • Graceful Shutdown of Pods with Kubernetes • Defer Containers One of the main benefits the cloud-native platform provides is the ability to run and scale applications reliably and predictably on top of potentially unreliable cloud infra‐ structure. These platforms provide a set of constraints and contracts for an applica‐ tion running on them. It is in the interest of the application to honor these contracts to benefit from all of the capabilities offered by the cloud-native platform. Handling and reacting to these events ensures your application can gracefully start up and shut down with minimal impact on the consuming services. At the moment, in its basic form, that means the containers should behave as any well-designed POSIX process. In the future, there might be even more events giving hints to the application when it is about to be scaled up, or asked to release resources to prevent being shut down. It is essential to get into the mindset where the application lifecycle is no longer in the control of a person but fully automated by the platform. Besides managing the application lifecycle, the other big duty of orchestration plat‐ forms like Kubernetes is to distribute containers over a fleet of nodes. The next pat‐ tern,  Automated Placement , explains the options to influence the scheduling decisions from the outside. 46  |  Chapter 5: Managed Lifecycle