The essense of Graceful Shutdown
summary
Covers how Python apps actually implement graceful shutdown: register signal handlers for SIGINT, SIGTERM, SIGHUP, cancel running asyncio tasks and stop the event loop, and close DB connections or requeue messages so transactions don’t leave partial state. Demonstrates with Docker and kubectl, notes SIGKILL cannot be caught, explains Docker STOPSIGNAL and Kubernetes default 30s terminationGracePeriodSeconds (reserve ~20% for platform), and shows why per-signal registration and testing (kubectl delete edge cases) matter.
AI-written summary · about
chapters (19)
- 0:00Introduction and speaker intro
- 1:11What is graceful shutdown
- 3:22Basic Python shutdown handling
- 5:11Signal handlers in Python
- 6:40Understanding signals
- 8:08Improved signal handler setup
- 9:56Recap of signal handling
- 10:19Graceful shutdown in Kubernetes
- 13:53Why graceful shutdown matters
- 14:16Demo of Kubernetes pod deletion
- 15:24Async code graceful shutdown
- 16:51Handling signals in async apps
- 18:00Uncatchable signals
- 19:25Testing failure scenarios
- 20:08Docker stop signals
- 21:35Release strategies overview
- 22:41Conclusion and key takeaways
- 23:47Q&A: Critical scenarios for shutdown
- 25:13Q&A: Risks of ignoring shutdown
related talks
31mBeyond the Start Button: The Hidden Life of Pod Termination in Kubernetes
26mWait! Can Your Pod Survive a Restart?
26mKubernetes SIG Apps Updates
43mKubernetes SIG Node Intro and Deep Dive
45mThe Glorious Art of Destroying Things on Purpose: an Introduction to Chaos Engineering
35mKubernetes SIG CLI: Intro And Updates
33mThe Gotchas of Zero-Downtime Traffic /w Kubernetes
30mAfterlife tales: Troubleshooting containerized applications
