Skip to content

Commit 4f45d4d

Browse files
author
X723166587
authored
[zh] Accurate explanation for the calculation of number of failures in Job (#34327)
* [zh] Accurate explanation for the calculation of number of failures in Job Apply PR 33536 corrections to Chinese content. signed-off-by: X723166587 <[email protected]> * Update job.md fix typo * Update job.md fix typo
1 parent dcdc5d2 commit 4f45d4d

File tree

1 file changed

+23
-4
lines changed
  • content/zh-cn/docs/concepts/workloads/controllers

1 file changed

+23
-4
lines changed

content/zh-cn/docs/concepts/workloads/controllers/job.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,19 @@ due to a logical error in configuration etc.
450450
To do so, set `.spec.backoffLimit` to specify the number of retries before
451451
considering a Job as failed. The back-off limit is set by default to 6. Failed
452452
Pods associated with the Job are recreated by the Job controller with an
453-
exponential back-off delay (10s, 20s, 40s ...) capped at six minutes. The
454-
back-off count is reset when a Job's Pod is deleted or successful without any
455-
other Pods for the Job failing around that time.
453+
exponential back-off delay (10s, 20s, 40s ...) capped at six minutes.
454+
455+
The number of retries is calculated in two ways:
456+
- The number of Pods with `.status.phase = "Failed"`.
457+
- When using `restartPolicy = "OnFailure"`, the number of retries in all the
458+
containers of Pods with `.status.phase` equal to `Pending` or `Running`.
459+
460+
If either of the calculations reaches the `.spec.backoffLimit`, the Job is
461+
considered failed.
462+
463+
When the [`JobTrackingWithFinalizers`](#job-tracking-with-finalizers) feature is
464+
disabled, the number of failed Pods is only based on Pods that are still present
465+
in the API.
456466
-->
457467
### Pod 回退失效策略 {#pod-backoff-failure-policy}
458468

@@ -462,7 +472,16 @@ other Pods for the Job failing around that time.
462472
失效回退的限制值默认为 6。
463473
与 Job 相关的失效的 Pod 会被 Job 控制器重建,回退重试时间将会按指数增长
464474
(从 10 秒、20 秒到 40 秒)最多至 6 分钟。
465-
当 Job 的 Pod 被删除时,或者 Pod 成功时没有其它 Pod 处于失败状态,失效回退的次数也会被重置(为 0)。
475+
476+
计算重试次数有以下两种方法:
477+
- 计算 `.status.phase = "Failed"` 的 Pod 数量。
478+
- 当 Pod 的 `restartPolicy = "OnFailure"` 时,针对 `.status.phase` 等于 `Pending`
479+
`Running` 的 Pod,计算其中所有容器的重试次数。
480+
481+
如果两种方式其中一个的值达到 `.spec.backoffLimit`,则 Job 被判定为失败。
482+
483+
[`JobTrackingWithFinalizers`](#job-tracking-with-finalizers) 特性被禁用时,
484+
失败的 Pod 数目仅基于 API 中仍然存在的 Pod。
466485

467486
<!--
468487
If your job has `restartPolicy = "OnFailure"`, keep in mind that your Pod running the Job

0 commit comments

Comments
 (0)