How to automatically remove backup cron pods?

Currently when a backup job completes the pod is left in “Completed” status. In an environment where backups have to be kept for a long time the number of these pods build up and become a pain when using kubectl for other tasks.

Is there any way to have these pods be automatically removed after some time but keep the pxc-backup resource? Potentially by setting “.spec.ttlSecondsAfterFinished” on the job (Automatic Cleanup for Finished Jobs | Kubernetes)

I couldn’t see any way to set that in the operator.

@b602fa9c Do you use keep option percona-xtradb-cluster-operator/cr.yaml at main · percona/percona-xtradb-cluster-operator · GitHub in CR?

Yes we set keep to 0

In this case you disabled it. If you want to keep e.g. last 5 backups you need to set it in 5 and all jobs will be cleaned up as well .

I want to keep the backups but not the backup jobs

Hi b602fa9c, I am running into the same problem, where failed or succeeded jobs linger. I also have the ‘keep’ option set, but I believe you are right that this is the retention of backups on the storage destination.

Did you ever get an answer on how to solve this problem?

No, I’m still looking for a solution to this.

+1 on this - ttlSecondsAfterFinished is a good idea

@elie_mouawad what would be the best default for this?