No project description provided
Project description
termination-handler
About
termination-handler
handles termination notices on spot/preemptible instances.
As an example, if deployed on a Kubernetes cluster and a termination notice is issued by the cloud provider, termination-handler
drains the node it is running on before the node is taken away by the cloud provider.
Inspired by pusher/k8s-spot-termination-handler for AWS, termination-handler
surges from the need to operate the same tooling in various distinct environments (providers, orchestrators...)
Features
- Supports multiple cloud providers (AWS, GCP).
- Supports multiple scheduling & orchestration tools (Kubernetes, Nomad).
- Small and extensible.
Documentation
TBD
Usage
Deploy to Kubernetes
A K8s docker image is available at dgzlopes/termination-handler-k8s
and sample Kubernetes manifests are available in the deploy/k8s folder.
To deploy in clusters using RBAC, please apply all of the manifests (Daemonset, ClusterRole, ClusterRoleBinding and ServiceAccount) in the deploy/k8s folder but uncomment the serviceAccountName
in the Daemonset.
Requirements
For termination-handler
to schedule correctly; you will need an identifying label on your spot/preemptible instances.
We add a label node-role.kubernetes.io/spot-worker
to our spot/preemptible instances and hence this is the default value in the node selector of the Daemonset.
nodeSelector:
"node-role.kubernetes.io/spot-worker": "true"
To achieve this, add the following flag to your Kubelet:
--node-labels="node-role.kubernetes.io/spot-worker=true"
Configuration
To define any custom parameters to the drain command you can use DRAIN_PARAMETERS
environment property. If not defined, default parameters are --grace-period=120 --force --ignore-daemonsets
.
env:
- name: DRAIN_PARAMETERS
value: '--grace-period=120 --force --ignore-daemonsets --delete-local-data'
Demo mode
TBD
Deploy to Nomad
TBD
How to contribute
- Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
- Fork the repository on GitHub to start making your changes to the master branch (or branch off of it).
- Write a test which shows that the bug was fixed or that the feature works as expected.
- Send a pull request and bug me until it gets merged and published.
Some things that would be great to have:
- Support for Azure cloud provider.
- Support for Execution handler (certain command or task)
- Support for notifications (Slack, Datadog..)
- Option to omit selected cloud provider discovery.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for termination-handler-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d76c6a06d31e69a39d309523645a49909eb40c57cc2703e5eac2ef9f9be1ee5d |
|
MD5 | 5708cd65a58058631b69d849835ee039 |
|
BLAKE2b-256 | 1dee78c37e7213cdf321a81aaf3f5b3ea2b84bdabe387204c8084d7e7254454c |
Hashes for termination_handler-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f718ceac26252cdc9ebd3872d15a28fa5223b6f1e2fa592e33d7464899b874d5 |
|
MD5 | 093dcd0ddbaf6ab6e85843dfa05abb54 |
|
BLAKE2b-256 | 1b691d7edc47a955cccc1e7ff9c44744f4e34b0dece9163ed573b8c32a2921a0 |