AWS supports Automated Draining for Spot Instance Nodes on Kubernetes

Posted on: Nov 7, 2019

The AWS Node Termination Handler makes it easy for customers to take advantage of the cost savings and performance boost offered by EC2 Spot Instances in their Kubernetes clusters while gracefully handling EC2 Spot Instance terminations.  

Amazon EC2 Spot Instances let you take advantage of unused EC2 capacity in the AWS cloud. Spot Instances are available at up to a 90% discount compared to On-Demand prices; however, can be interrupted via Spot Instance interruptions, a two-minute warning before Amazon EC2 stops or terminates the instance. 

The AWS Node Termination Handler provides a connection between termination requests from AWS infrastructure to Kubernetes nodes, allowing graceful draining and termination of nodes that receive interruption notifications. The termination handler uses the Kubernetes API to initiate drain and cordon actions on a node that is targeted for termination. The Node Termination Handler project can also be configured to simulate Spot termination requests to see how Kubernetes applications react to interruptions. 

This project is open source (contributions welcome!) and supported by AWS. You can run the termination handler on any Kubernetes cluster running on AWS, including clusters created with Amazon Elastic Kubernetes Service. To learn more or get started, visit the project on GitHub.