← Back to Kube-Zen

Generic Garbage Collection for Kubernetes

Declarative, Kubernetes-native resource cleanup with time-to-live policies

Coming SoonOpen Source

The Problem

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.

The Solution

zen-gc provides a generic garbage collection controller that enables declarative, time-based cleanup of any Kubernetes resource through a simpleGarbageCollectionPolicy CRD.

Example: Cleanup temporary ConfigMaps
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: 10

Key Features

πŸ”§

Generic

Works with any Kubernetes resource - CRDs, core resources, custom resources

πŸ“

Declarative

Policies defined as Kubernetes CRDs - GitOps friendly and version controlled

☸️

Kubernetes-Native

Uses spec fields (like Jobs), not annotations. Follows Kubernetes conventions

⚑

Production-Ready

Rate limiting, metrics, observability, dry-run mode, and high availability

🎯

Flexible TTL

Fixed TTL, field-based TTL, mapped TTL, or relative TTL - choose what fits your needs

πŸ”

Advanced Selectors

Label selectors, field selectors, namespace scoping, and complex conditions

Use Cases

Cleanup Evicted Pods

Automatically remove pods that have been evicted due to resource pressure

Temporary Resource Management

Clean up temporary ConfigMaps, Secrets, and other resources after a set time

Old Deployment Cleanup

Remove old deployments that have been scaled down or replaced

Completed Job Cleanup

Extend TTL support beyond Jobs to any resource type

Orphaned Resource Cleanup

Clean up orphaned ReplicaSets, PVCs, and other resources automatically

Observability Data Retention

Manage retention policies for logs, metrics, and traces stored as Kubernetes resources

Quick Start

1

Add the Helm Repository

helm repo add zen-gc https://kube-zen.github.io/zen-gc
helm repo update
2

Install zen-gc

helm install gc-controller zen-gc/gc-controller \
  --namespace gc-system --create-namespace
3

Create Your First Policy

kubectl apply -f https://raw.githubusercontent.com/kube-zen/zen-gc/main/examples/temp-configmap-cleanup.yaml

Project Status

Design & Architecture

Complete design with comprehensive documentation

Implementation

Working prototype with >80% test coverage

Open Source

Released as OSS for community testing and adoption

Community Growth

Building community and gathering real-world feedback

Get Started

zen-gc is coming soon! Check out the repository and feel free to contribute.