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
- Take the backup of the existing cronjob using the below command:
$ kubectl get cronjob -n <REGION_NAMESPACE> <CRONJOB_NAME> -o yaml > <cronjob-name>.bk
- Edit the cronjob object file.
$ kubectl edit cronjob -n <REGION_NAMESPACE> <CRONJOB_NAME>
- Under
spec
section modify the desired value forFailedJobsHistoryLimit
orSuccessfulJobsHistoryLimit
.
spec:
failedJobsHistoryLimit: 2 <--- Update desired value for failedJobsHistoryLimit
.
.
successfulJobsHistoryLimit: 4 <--- Update desired value for successfulJobsHistoryLimit
- Save the file.
$ kubectl edit cronjob -n <REGION_NAMESPACE> <CRONJOB_NAME>
cronjob.batch/<cronjob-name> edited
- 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.
Was this page helpful?