Monitors AWS for spot termination notices when run on spot instances and shuts down gracefully
Clone or download
Latest commit e20dcfb Mar 15, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
deploy Prepare for release Feb 26, 2018 Prepare for release Feb 26, 2018
Dockerfile Prepare for release Feb 26, 2018
LICENSE Prepare for release Feb 26, 2018 Prepare for release Feb 26, 2018 Initial commit Aug 15, 2017
requirements.txt Initial commit Aug 15, 2017
wercker.yml Use org AWS secret Mar 15, 2018

K8s Spot Termination Handler

Table of contents


The K8s Spot Termination handler watches the AWS metadata service when running on Spot Instances.

When a Spot Instance is due to be terminated, precisely 2 minutes before it's termination a "termination notice" is issued. The K8s Spot Termination Handler watches for this and then gracefully drains the node it is running on before the node is taken away by AWS.


Deploy to Kubernetes

A docker image is available at These images are currently built on pushes to master. Releases will be tagged as and when releases are made.

Sample Kubernetes manifests are available in the deploy folder.

To deploy in clusters using RBAC, please apply all of the manifests (Daemonset, ClusterRole, ClusterRoleBinding and ServiceAccount) in the deploy folder but uncomment the serviceAccountName in the Daemonset.


For the K8s Termination Handler to schedule correctly; you will need an identifying label on your spot instances.

We add a label to our spot instances and hence this is the default value in the node selector of the Daemonset.

  "": "true"

To achieve this, add the following flag to your Kubelet:



  • K8s Spot Rescheduler: Move nodes from on-demand instances to spot instances when space is available.


  • Found a bug? Please open an issue.
  • Have a feature request. Please open an issue.
  • If you want to contribute, please submit a pull request


Please see our Contributing guidelines.


This project is licensed under Apache 2.0 and a copy of the license is available here.