Reader small image

You're reading from  Kubernetes for Developers

Product typeBook
Published inApr 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781788834759
Edition1st Edition
Languages
Right arrow
Author (1)
Joseph Heck
Joseph Heck
author image
Joseph Heck

Joseph Heck has broad development and management experience across start-ups and large companies. He has architected, developed, and deployed a wide variety of solutions, ranging from mobile and desktop applications to cloud-based distributed systems. He builds and directs teams and mentors individuals to improve the way they build, validate, deploy, and run software. He also works extensively with and in open source, collaborating across many projects, including Kubernetes.
Read more about Joseph Heck

Right arrow

Handling a graceful shutdown


With the lifecycle hooks, we mentioned the pre-stop hook that can be defined and enabled, but if you're writing your own code, then you may find it just as easy to respect the SIGTERM signal that Kubernetes uses to tell containers to shut down.

If you aren't familiar with SIGTERM, it is one of the functions that Linux supports from the kernel—a means of sending an interrupt to a running process. The process can listen for these signals, and you can choose how they respond when they are received. There are two signals that you can't ignore and the operating system will enforce, regardless of what you implement: SIGKILL and SIGSTOP. The signal that Kubernetes uses when it wants to shut down a container is SIGTERM.

The kind of events where you will receive this signal aren't just on error or user-invoked deletion, but also when you roll out a code update leveraging the rolling update mechanism that deployment uses. It can also happen if you take advantage of any of...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Kubernetes for Developers
Published in: Apr 2018Publisher: PacktISBN-13: 9781788834759

Author (1)

author image
Joseph Heck

Joseph Heck has broad development and management experience across start-ups and large companies. He has architected, developed, and deployed a wide variety of solutions, ranging from mobile and desktop applications to cloud-based distributed systems. He builds and directs teams and mentors individuals to improve the way they build, validate, deploy, and run software. He also works extensively with and in open source, collaborating across many projects, including Kubernetes.
Read more about Joseph Heck