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