Gracefully handles EC2 instance termination events in Kubernetes by cordoning and draining nodes before shutdown, supporting spot interruptions, scheduled maintenance, and ASG scale-in events.
AWS Node Termination Handler gracefully handles EC2 instance lifecycle events within Kubernetes clusters. It monitors for termination signals — including Spot Instance interruptions, scheduled maintenance windows, ASG scale-in events, and EC2 instance rebalance recommendations — and cordons and drains the affected node before the instance is terminated, ensuring that running workloads are safely evicted and rescheduled.
It operates in two modes: IMDS Processor, which runs as a DaemonSet and polls the EC2 instance metadata service directly on each node, and Queue Processor, which runs as a Deployment and consumes termination events from an SQS queue populated by Amazon EventBridge.
For more details, see the AWS Node Termination Handler GitHub repository.