From 6c50bc639fa6b37db07e6b77059af6a30b9ddf10 Mon Sep 17 00:00:00 2001 From: Ravi Gudimetla Date: Thu, 19 Aug 2021 16:59:53 -0400 Subject: [PATCH] Recommend using TTL field in job Recommend using ttlSecondsAfterFinished in the job spec so that the pod deletion can be guaranteed when jobs get deleted. --- content/en/docs/concepts/workloads/controllers/job.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/content/en/docs/concepts/workloads/controllers/job.md b/content/en/docs/concepts/workloads/controllers/job.md index 1635caf7b3..ac0b28ab6b 100644 --- a/content/en/docs/concepts/workloads/controllers/job.md +++ b/content/en/docs/concepts/workloads/controllers/job.md @@ -342,6 +342,16 @@ If the field is set to `0`, the Job will be eligible to be automatically deleted immediately after it finishes. If the field is unset, this Job won't be cleaned up by the TTL controller after it finishes. +{{< note >}} +It is recommended to set `ttlSecondsAfterFinished` field because unmanaged jobs +(jobs not created via high level controllers like cronjobs) have a default deletion +policy of `orphanDependents` causing pods created by this job to be left around. +Even though podgc collector eventually deletes these lingering pods, sometimes these +lingering pods may cause cluster performance degradation or in worst case cause the +cluster to go down. +{{< /note >}} + + ## Job patterns The Job object can be used to support reliable parallel execution of Pods. The Job object is not