From 6c50bc639fa6b37db07e6b77059af6a30b9ddf10 Mon Sep 17 00:00:00 2001 From: Ravi Gudimetla Date: Thu, 19 Aug 2021 16:59:53 -0400 Subject: [PATCH 1/2] 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 From 1afd786d1bb60f919b732746de5afbce60547830 Mon Sep 17 00:00:00 2001 From: Ravi Gudimetla Date: Thu, 21 Oct 2021 10:46:42 -0400 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Tim Bannister --- .../docs/concepts/workloads/controllers/job.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/content/en/docs/concepts/workloads/controllers/job.md b/content/en/docs/concepts/workloads/controllers/job.md index ac0b28ab6b..82c938ff05 100644 --- a/content/en/docs/concepts/workloads/controllers/job.md +++ b/content/en/docs/concepts/workloads/controllers/job.md @@ -344,11 +344,20 @@ 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 +(Jobs that you created directly, and not indirectly through other workload APIs +such as CronJob) have a default deletion +policy of `orphanDependents` causing Pods created by an unmanaged Job to be left around +after that Job is fully deleted. +Even though the {{< glossary_tooltip text="control plane" term_id="control-plane" >}} eventually +[garbage collects](/docs/concepts/workloads/pods/pod-lifecycle/#pod-garbage-collection) +the Pods from a deleted Job after they either fail or complete, sometimes those lingering pods may cause cluster performance degradation or in worst case cause the -cluster to go down. +cluster to go offline due to this degradation. + +You can use [LimitRanges](/docs/concepts/policy/limit-range/) and +[ResourceQuotas](/docs/concepts/policy/resource-quotas/) to place a +cap on the amount of resources that a particular namespace can +consume. {{< /note >}}