https://github.com/zapier/preoomkiller-controller
Preoomkiller Controller evicts pods gracefully before they get OOMKilled by Kubernetes
https://github.com/zapier/preoomkiller-controller
Last synced: about 1 year ago
JSON representation
Preoomkiller Controller evicts pods gracefully before they get OOMKilled by Kubernetes
- Host: GitHub
- URL: https://github.com/zapier/preoomkiller-controller
- Owner: zapier
- License: mit
- Created: 2020-02-18T13:16:28.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-09-18T17:33:32.000Z (almost 5 years ago)
- Last Synced: 2025-03-28T00:04:50.778Z (about 1 year ago)
- Language: Go
- Size: 16.6 KB
- Stars: 24
- Watchers: 16
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# preoomkiller-controller
A controller to gracefully evict selected pods before they get **OOMKilled** by
**Kubernetes**.
# How it works?
`preoomkiller-controller` watches (once every `60s` by default) memory usage
metrics for all pods matching label selector `preoomkiller-enabled=true`.
Pods can specify a **preoomkiller** `memory-threshold`, e.g., `512Mi`, `1Gi`, etc.
via an annotation `preoomkiller.alpha.k8s.zapier.com/memory-threshold`.
When `preoomkiller-controller` finds that the pods' memory usage has crossed
the specified threshold, it starts trying to evict the pod, until it's evicted.
This operation is very safe, as it uses Kubernetes' pod **eviction** API to
evict pods. Pod eviction API takes into account **PodDisruptionBudget** for
the pods and ensures that a specified minimum number of ready pods are always
available.
# Usage
## Deploy
### Setup RBAC
```
kubectl -n kube-system create serviceaccount preoomkiller-controller
cat <