Graceful Shutdown in Node.js Production Services

Every time you deploy a Node.js service without a proper shutdown handler, you're gambling with in-flight requests. The process receives SIGTERM, Node.js ignores it by default, Kubernetes eventually sends SIGKILL, and any requests mid-flight get a connection reset. This happens on every rolling deployment, every pod eviction, every scale-down event.

Most teams only discover the problem through user reports — intermittent 503s during peak deploys that are hard to reproduce locally. The fix isn't complicated, but it requires understanding exactly what happens during a Kubernetes termination sequence and wiring up a few moving parts in the right order.