How to Modify "FailedJobsHistoryLimit" or "SuccessfulJobsHistoryLimit" Settings for CronJobs?

Problem

To modify the default values for FailedJobsHistoryLimit or SuccessfulJobsHistoryLimit settings in CronJobs.

Environment

  • Self-Hosted Private Cloud Director - Virtualisation: v2025.4 and Higher.

  • Self-Hosted Private Cloud Director - Kubernetes: v2025.4 and Higher.

  • Private Cloud Director - Virtualisation: v2025.4 and Higher.

  • Private Cloud Director - Kubernetes: v2025.4 and Higher.

Procedure

  1. Take the backup of the existing cronjob using the below command:

$ kubectl get cronjob -n <REGION_NAMESPACE> <CRONJOB_NAME> -o yaml > <cronjob-name>.bk
  1. Edit the cronjob object file.

$ kubectl edit cronjob -n <REGION_NAMESPACE> <CRONJOB_NAME>
  1. Under spec section modify the desired value for FailedJobsHistoryLimit or SuccessfulJobsHistoryLimit.

spec: failedJobsHistoryLimit: 2 <--- Update desired value for failedJobsHistoryLimit . . successfulJobsHistoryLimit: 4 <--- Update desired value for successfulJobsHistoryLimit
  1. Save the file.

$ kubectl edit cronjob -n <REGION_NAMESPACE> <CRONJOB_NAME> cronjob.batch/<cronjob-name> edited
  1. Verify the change.

$ kubectl get cronjob -n <REGION_NAMESPACE> <CRONJOB_NAME> -o yaml

Additional Information

To update the default values for all CronJobs, apply the same procedure to each one.