An open API service indexing awesome lists of open source software.

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

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 <