This is article 2 of 10 in Beyond Kubernetes Defaults . Read article 1: When Kubernetes Primitives Aren’t Enough first. This article is cross-published from Zen Mesh .
Kubernetes already garbage-collects resources.
That makes “we built a Kubernetes garbage collector” sound suspiciously like reinventing a solved problem.
In many cases, it would be.
Kubernetes gives us several excellent lifecycle mechanisms: owner references , cascading deletion, Job TTLs , CronJob history limits and finalizers . If a resource has a natural owner or a single lifecycle rule, those mechanisms should usually be the first choice.
Our need appeared when cleanup stopped being a property of one resource and became policy across resource classes.
Native cleanup is good at structural lifecycle
Owner references are excellent when the relationship is structural: delete the parent and its children should disappear.
ttlSecondsAfterFinished is excellent when every completed Job can follow the same lifecycle.
CronJob history limits…