https://github.com/porter-dev/porter-node-drainer
Simple node drainer for EKS self-managed nodes.
https://github.com/porter-dev/porter-node-drainer
Last synced: about 1 year ago
JSON representation
Simple node drainer for EKS self-managed nodes.
- Host: GitHub
- URL: https://github.com/porter-dev/porter-node-drainer
- Owner: porter-dev
- Created: 2022-08-02T17:52:41.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-08-15T08:44:23.000Z (over 2 years ago)
- Last Synced: 2025-02-16T16:56:52.064Z (about 1 year ago)
- Language: Go
- Size: 43.9 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Porter Node Drainer
This repository contains source code for performing a node drain for self-managed EKS nodes.
**How does it work?**
The script is meant to run as a Lambda function which gets triggered on an ASG instance termination event. The script performs the following actions:
1. Performs a read on the relevant EC2 instance being terminated to discover the EC2 internal hostname.
2. Lists nodes on the EKS cluster and matches the above hostname on the `kubernetes.io/hostname` label.
3. Cordons the node to prevent new workloads from being scheduled on that node.
4. Evicts any non-daemonset pods running on the node.
5. Calls the ASG Complete Lifecycle action to allow ASG termination to proceed.
**Required environment variables:**
```
EKS_AWS_ACCESS_KEY_ID
EKS_AWS_SECRET_ACCESS_KEY
EKS_AWS_REGION
EKS_AWS_CLUSTER_ID
EKS_CLUSTER_SERVER
EKS_CA_DATA
```
### Project Goals
While this project currently contains a very simple drain script, the goal is eventually to be able to customize the drain behavior on the node and to notify the Porter server that a node is being cycled out.
### Similar Projects
- https://github.com/aws-samples/amazon-k8s-node-drainer
- https://github.com/ryan-a-baker/eks-node-drainer