A Kubernetes operator that uses time-to-live to enable time-bound objects.
It uses a single configMap to configure what Kinds of objects to check TTL for and the check interval.
There are no CRDs to install.
At every interval, the operator will get all resources matching a TTL label (kubettlreaper.samir.io/ttl) for each Kind configured to watch, and delete the resources if their TTL has expired (using creation timestamp + TTL as the calculation)
gvk-list (all valid GVKs are supported)check-interval- --configuration-name=kube-ttl-reaperkubectl apply -f - <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: kube-ttl-reaper
namespace: kubettlreaper-system
data:
check-interval: 30s
gvk-list: |
- group: ""
version: "v1"
kind: "Pod"
- group: "apps"
version: "v1"
kind: "Deployment"
- group: "rbac.authorization.k8s.io"
version: "v1"
kind: "RoleBinding"
EOF
kubettlreaper.samir.io/ttlkubectl apply -f - <<EOF
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: pod-reader-binding
namespace: default
labels:
kubettlreaper.samir.io/ttl: 1m # This label is all that is required
subjects:
- kind: ServiceAccount
name: default
namespace: default
roleRef:
kind: Role
name: pod-reader
apiGroup: rbac.authorization.k8s.io
EOF
A helm chart is generated using make helm.
cd charts/kube-ttl-reaper
helm upgrade --install -n kubettlreaper-system <release_name> . --create-namespace
samirtahir91076/kube-ttl-reaper:latest
Content type
Image
Digest
sha256:e9f7e4b7d…
Size
28.4 MB
Last updated
over 1 year ago
docker pull samirtahir91076/kube-ttl-reaper