What is successfulJobsHistoryLimit?

QuestionsQuestions8 SkillsProDec, 13 2025
0202

That's a very insightful question about CronJobs! successfulJobsHistoryLimit is an important setting for managing the history of your triggered Jobs.

In the cronjob.yaml you provided:

  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 3

successfulJobsHistoryLimit: 3 tells Kubernetes to keep a record of the last 3 successfully completed Jobs that were created by this hello-cronjob.

Here's why it's useful:

  1. Cleanup and Resource Management: CronJobs can create many Jobs over time (e.g., one every minute). Without a limit, your Kubernetes cluster would accumulate an ever-growing list of old Job resources, consuming memory and disk space in the API server. This setting helps prevent that.
  2. Debugging and Auditing: While it cleans up older ones, it keeps a recent history of successful Jobs, which can be useful if you need to check when a recent successful run occurred or its details.
  3. Paired with failedJobsHistoryLimit: Similarly, failedJobsHistoryLimit does the same for Jobs that failed. Keeping a few failed Job records is often even more critical for debugging issues.

In simple terms: After 3 successful Jobs have accumulated, when a new Job successfully completes, the oldest successful Job record will be automatically deleted by Kubernetes to maintain the limit of 3.

It helps keep your cluster tidy while still providing a valuable history for operational insights.

Do you have any other questions about CronJob settings?

0 Comments

no data
Be the first to share your comment!