How to delete Kubernetes drone build jobs after completion?

or after X minutes? Is there any way to do it or is this considered a bad practice?

Drone will do this automatically, but it needs your cluster to support the TTLAfterFinished feature. That one is only available since Kubernetes 1.12, so most likely you just need to upgrade your cluster in order for this to work.

https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/#using-a-feature

(Confirmed to work for me on GKE, with version 1.12.5.)

3 Likes

Very cool answer @raucao I didn’t know this. We used https://github.com/lwolf/kube-cleanup-operator to clean up.

1 Like