Understanding how to automatically remove completed jobs

You can specify that OpenShift Container Platform should delete jobs when they are finished, either Complete or Failed, in order to limit the number of objects in your cluster.

By default, for jobs that are not associated with a cron job or other controlling object, OpenShift Container Platform does not delete the job or its related pods when the job is finished. If you keep these artifacts in your cluster, you can view the status of finished jobs or view job logs for errors, warnings, or other diagnostic output.

However, having too many of these objects in the cluster can lead to etcd issues, latency issues, performance degradation, and other problems.

You can configure a time-to-live (TTL) duration for jobs without a controlling object by setting the ttlSecondsAfterFinished parameter in the job spec. When set, OpenShift Container Platform deletes the jobs and any related pods immediately after the job is finished or after a specified period of time in seconds.