Declarative, Kubernetes-native resource cleanup with time-to-live policies
Kubernetes only provides built-in TTL support for Jobs. For all other resources (ConfigMaps, Secrets, Pods, CRDs, etc.), operators must build custom controllers, use external tools, or manually manage cleanup via CronJobs.
This creates operational overhead and inconsistency across the ecosystem.
zen-gc provides a generic garbage collection controller that enables declarative, time-based cleanup of any Kubernetes resource through a simpleGarbageCollectionPolicy CRD.
apiVersion: gc.kube-zen.io/v1alpha1
kind: GarbageCollectionPolicy
metadata:
name: cleanup-temp-configmaps
spec:
targetResource:
apiVersion: v1
kind: ConfigMap
labelSelector:
matchLabels:
temporary: "true"
ttl:
secondsAfterCreation: 604800 # 7 days
behavior:
maxDeletionsPerSecond: 10Works with any Kubernetes resource - CRDs, core resources, custom resources
Policies defined as Kubernetes CRDs - GitOps friendly and version controlled
Uses spec fields (like Jobs), not annotations. Follows Kubernetes conventions
Rate limiting, metrics, observability, dry-run mode, and high availability
Fixed TTL, field-based TTL, mapped TTL, or relative TTL - choose what fits your needs
Label selectors, field selectors, namespace scoping, and complex conditions
Automatically remove pods that have been evicted due to resource pressure
Clean up temporary ConfigMaps, Secrets, and other resources after a set time
Remove old deployments that have been scaled down or replaced
Extend TTL support beyond Jobs to any resource type
Clean up orphaned ReplicaSets, PVCs, and other resources automatically
Manage retention policies for logs, metrics, and traces stored as Kubernetes resources
helm repo add zen-gc https://kube-zen.github.io/zen-gc helm repo update
helm install gc-controller zen-gc/gc-controller \ --namespace gc-system --create-namespace
kubectl apply -f https://raw.githubusercontent.com/kube-zen/zen-gc/main/examples/temp-configmap-cleanup.yaml
Complete design with comprehensive documentation
Working prototype with >80% test coverage
Released as OSS for community testing and adoption
Building community and gathering real-world feedback
zen-gc is coming soon! Check out the repository and feel free to contribute.