Skip to main content

Zen Cleaner — Declarative Kubernetes Resource Cleanup Controller

Zen Cleaner is a free Apache-2.0 Kubernetes controller that applies declarative TTL cleanup policies to namespaced resources. It is independent OSS released by the Zen Mesh team.

How it fits​

  • Retention hygiene: Automatically prune stale resources based on resource age, labels, or custom TTL annotations — reducing storage costs and namespace clutter.
  • Evidence lifecycle: Apply retention windows to delivery logs, audit entries, and evidence artifacts so expired data is cleaned up without manual operator intervention.
  • Operational cleanup: Remove completed or abandoned pipeline resources (Pods, Jobs, ConfigMaps) that accumulate in long-running clusters.
  • Safe platform maintenance: Declarative policy-driven deletion avoids accidental mass cleanup — resources are removed only when TTL conditions are met.

Zen Cleaner declares cleanup intent with ZenCleanerPolicy objects (API group cleaner.zen-mesh.io, v1alpha1): fixed, field-derived, mapped, and relative TTL modes; label/field/annotation selectors and conditions; dry-run; per-policy rate limiting and batching; leader election; and Prometheus metrics (zen_cleaner_*).

Getting started​

# Clone the repository
git clone https://github.com/zenmesh/zen-cleaner
cd zen-cleaner

# Install the CRD and controller
kubectl apply -f deploy/crds/cleaner.zen-mesh.io_zencleanerpolicies.yaml
kubectl apply -f deploy/manifests/namespace.yaml
kubectl apply -f deploy/manifests/rbac.yaml
# Point deploy/manifests/deployment.yaml at your image (build locally or use a registry tag).
kubectl apply -f deploy/manifests/deployment.yaml

A Helm chart is also available at deploy/helm/zen-cleaner.

See the Zen Cleaner repository for full documentation, policy configuration, and examples.