https://github.com/int128/spot-handler
Kubernetes controller for observability of Amazon EC2 Spot Interruption
https://github.com/int128/spot-handler
aws kubebuilder kubernetes kubernetes-controller observability spot-instances
Last synced: 7 months ago
JSON representation
Kubernetes controller for observability of Amazon EC2 Spot Interruption
- Host: GitHub
- URL: https://github.com/int128/spot-handler
- Owner: int128
- Created: 2024-07-07T05:59:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-14T15:22:04.000Z (7 months ago)
- Last Synced: 2025-03-14T16:29:45.075Z (7 months ago)
- Topics: aws, kubebuilder, kubernetes, kubernetes-controller, observability, spot-instances
- Language: Go
- Homepage:
- Size: 489 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# spot-handler [](https://github.com/int128/spot-handler/actions/workflows/go.yaml)
This is a Kubernetes controller for the observability of spot interruptions.
It provides the Kubernetes events for the [Amazon EC2 Spot Instance interruption notices](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-instance-termination-notices.html).## Features
### Observability of spot interruptions
When a spot interruption occurs, it may cause a problem such as network error.
It is very important to measure the number of affected nodes or pods.This controller provides the following events in Kubernetes:
- `SpotInterrupted` event on `Node` resource
- `SpotInterrupted` event on `Pod` resource### Pod termination handler
When a spot interruption occurs, possibly a pod is not gracefully terminated.
For example, a pod disruption budget (PDB) may prevent the pod from being deleted.This controller can delete the affected pods to initiate the graceful termination.
## Getting Started
You need to set up an EventBridge rule and an SQS queue to receive the spot interruption messages.
```mermaid
graph LR
EventBridge --> SQS --> Controller --> Event --> Datadog
subgraph AWS
EventBridge
SQS
end
subgraph Kubernetes cluster
Controller
Event
end
```Deploy the manifest from the GitHub Releases.
Configure the Queue resource with the SQS URL.
```yaml
apiVersion: spothandler.int128.github.io/v1
kind: Queue
metadata:
name: eks-spot-handler
spec:
url: https://sqs.us-east-2.amazonaws.com/123456789012/eks-spot-handler
```