@@ -420,17 +420,11 @@ Kubernetes 并不禁止你直接管理 Pod。对运行中的 Pod 的某些字段
420
420
<!--
421
421
- Most of the metadata about a Pod is immutable. For example, you cannot
422
422
change the `namespace`, `name`, `uid`, or `creationTimestamp` fields.
423
- - The `generation` field is unique. It will be automatically set by the
424
- system such that new pods have a `generation` of 1, and every update to
425
- mutable fields in the pod's spec will increment the `generation` by 1. If the
426
- alpha feature gate PodObservedGenerationTracking is set, the
427
- pod's `status.observedGeneration` will reflect the `metadata.generation` of
428
- the pod at the point that the pod status is being reported.
429
423
- If the `metadata.deletionTimestamp` is set, no new entry can be added to the
430
424
`metadata.finalizers` list.
431
425
- Pod updates may not change fields other than `spec.containers[*].image`,
432
- `spec.initContainers[*].image`, `spec.activeDeadlineSeconds` or
433
- `spec.tolerations`. For `spec.tolerations`, you can only add new entries.
426
+ `spec.initContainers[*].image`, `spec.activeDeadlineSeconds`, `spec.terminationGracePeriodSeconds`,
427
+ `spec.tolerations` or `spec.schedulingGates `. For `spec.tolerations`, you can only add new entries.
434
428
- When updating the `spec.activeDeadlineSeconds` field, two types of updates
435
429
are allowed:
436
430
@@ -440,15 +434,10 @@ Kubernetes 并不禁止你直接管理 Pod。对运行中的 Pod 的某些字段
440
434
-->
441
435
- Pod 的绝大多数元数据都是不可变的。例如,你不可以改变其 ` namespace ` 、` name ` 、
442
436
` uid ` 或者 ` creationTimestamp ` 字段。
443
- - ` generation ` 字段是特别的。它将由系统自动设置,使得新
444
- Pod 的 ` generation ` 为 1,并且每次更新 Pod 规格中的可变字段时,
445
- ` generation ` 将增加 1。如果设置了 Alpha 基本特性门控 PodObservedGenerationTracking,
446
- 则 Pod 的 ` status.observedGeneration ` 将反映报告 Pod 状态时的
447
- Pod 的 ` metadata.generation ` 。
448
437
- 如果 ` metadata.deletionTimestamp ` 已经被设置,则不可以向 ` metadata.finalizers `
449
438
列表中添加新的条目。
450
- - Pod 更新不可以改变除 ` spec.containers [*].image ` 、` spec.initContainers[*].image ` 、
451
- ` spec.activeDeadlineSeconds ` 或 ` spec.tolerations ` 之外的字段。
439
+ - Pod 更新不可以改变除 ` spec.initContainers [*].image ` 、` spec.activeDeadlineSeconds ` 、
440
+ ` spec.terminationGracePeriodSeconds ` 、 ` spec.tolerations ` 或 ` spec.schedulingGates ` 之外的字段。
452
441
对于 ` spec.tolerations ` ,你只被允许添加新的条目到其中。
453
442
- 在更新 ` spec.activeDeadlineSeconds ` 字段时,以下两种更新操作是被允许的:
454
443
@@ -487,6 +476,100 @@ The above update rules apply to regular pod updates, but other pod fields can be
487
476
- ** 绑定:** ` binding ` 子资源允许通过 ` Binding ` 请求设置 Pod 的 ` spec.nodeName ` 。
488
477
这通常仅由 {{< glossary_tooltip text="调度器" term_id="kube-scheduler" >}} 使用。
489
478
479
+ <!--
480
+ ### Pod generation
481
+
482
+ - The `metadata.generation` field is unique. It will be automatically set by the
483
+ system such that new pods have a `metadata.generation` of 1, and every update to
484
+ mutable fields in the pod's spec will increment the `metadata.generation` by 1.
485
+ -->
486
+ ### Pod 生成
487
+
488
+ - ` metadata.generation ` 字段是唯一的。它将由系统自动设置,使得新 Pod 的 ` metadata.generation ` 为 1,
489
+ 并且对 Pod 规约中可变字段的每次更新都会使 ` metadata.generation ` 增加 1。
490
+
491
+ {{< feature-state feature_gate_name="PodObservedGenerationTracking" >}}
492
+
493
+ <!--
494
+ - `observedGeneration` is a field that is captured in the `status` section of the Pod
495
+ object. If the feature gate `PodObservedGenerationTracking` is set, the Kubelet will set `status.observedGeneration`
496
+ to track the pod state to the current pod status. The pod's `status.observedGeneration` will reflect the
497
+ `metadata.generation` of the pod at the point that the pod status is being reported.
498
+ -->
499
+ - ` observedGeneration ` 是在 Pod 对象的 ` status ` 部分中捕获的一个字段。
500
+ 如果启用了 ** PodObservedGenerationTracking** 特性门控,
501
+ kubelet 将设置 ` status.observedGeneration ` 来追踪当前 Pod 的状态。
502
+ Pod 的 ` status.observedGeneration ` 将展示报告 Pod 状态时的 Pod 的 ` metadata.generation ` 。
503
+
504
+ {{< note >}}
505
+ <!--
506
+ The `status.observedGeneration` field is managed by the kubelet and external controllers should **not** modify this field.
507
+ -->
508
+ ` status.observedGeneration ` 字段由 kubelet 管理,外部控制器** 不** 应修改此字段。
509
+ {{< /note >}}
510
+
511
+ <!--
512
+ Different status fields may either be associated with the `metadata.generation` of the current sync loop, or with the
513
+ `metadata.generation` of the previous sync loop. The key distinction is whether a change in the `spec` is reflected
514
+ directly in the `status` or is an indirect result of a running process.
515
+ -->
516
+ 不同的状态字段可能与当前同步循环的 ` metadata.generation ` 相关联,
517
+ 或者与前一个同步循环的 ` metadata.generation ` 相关联。
518
+ 关键区别在于,` spec ` 中的变化是直接体现在 ` status ` 中,还是作为运行过程的间接结果展示。
519
+
520
+ <!--
521
+ #### Direct Status Updates
522
+
523
+ For status fields where the allocated spec is directly reflected, the `observedGeneration` will
524
+ be associated with the current `metadata.generation` (Generation N).
525
+
526
+ This behavior applies to:
527
+
528
+ - **Resize Status**: The status of a resource resize operation.
529
+ - **Allocated Resources**: The resources allocated to the Pod after a resize.
530
+ - **Ephemeral Containers**: When a new ephemeral container is added, and it is in `Waiting` state.
531
+ -->
532
+ #### 直接状态更新
533
+
534
+ 对于那些直接反映分配的 spec 的状态字段,` observedGeneration `
535
+ 将与当前的 ` metadata.generation ` (第 N 代)相关联。
536
+
537
+ 此行为适用于:
538
+
539
+ - ** 扩缩状态** :资源扩缩操作的状态。
540
+ - ** 分配的资源** :扩缩后分配给 Pod 的资源。
541
+ - ** 临时容器** :当添加一个新的临时容器,并且它处于 ` Waiting ` 状态时。
542
+
543
+ <!--
544
+ #### Indirect Status Updates
545
+
546
+ For status fields that are an indirect result of running the spec, the `observedGeneration` will be associated
547
+ with the `metadata.generation` of the previous sync loop (Generation N-1).
548
+
549
+ This behavior applies to:
550
+ -->
551
+ #### 间接状态更新
552
+
553
+ 对于那些运行规约的间接结果的状态字段,` observedGeneration `
554
+ 将与上一个同步循环的 ` metadata.generation ` (第 N-1 代)相关联。
555
+
556
+ 此行为适用于:
557
+
558
+ <!--
559
+ - **Container Image**: The `ContainerStatus.ImageID` reflects the image from the previous generation until the new image
560
+ is pulled and the container is updated.
561
+ - **Actual Resources**: During an in-progress resize, the actual resources in use still belong to the previous generation's
562
+ request.
563
+ - **Container state**: During an in-progress resize, with require restart policy reflects the previous generation's
564
+ request.
565
+ - **activeDeadlineSeconds** & **terminationGracePeriodSeconds** & **deletionTimestamp**: The effects of these fields on the
566
+ Pod's status are a result of the previously observed specification.
567
+ -->
568
+ - ** 容器镜像** :` ContainerStatus.ImageID ` 反映的是上一代的镜像,直到新的镜像被拉取并且容器被更新。
569
+ - ** 实际资源** :在扩缩进行中,实际使用的资源仍然属于上一代请求的资源。
570
+ - ** 容器状态** :在扩缩进行中,需要重启策略反映的是上一代的请求。
571
+ - ** activeDeadlineSeconds** & ** terminationGracePeriodSeconds** & ** deletionTimestamp** :这些字段对 Pod 状态的影响是之前观察到的规约的结果。
572
+
490
573
<!--
491
574
## Resource sharing and communication
492
575
0 commit comments