@@ -227,17 +227,12 @@ have some limitations:
227
227
228
228
- Most of the metadata about a Pod is immutable. For example, you cannot
229
229
change the ` namespace ` , ` name ` , ` uid ` , or ` creationTimestamp ` fields.
230
- - The ` generation ` field is unique. It will be automatically set by the
231
- system such that new pods have a ` generation ` of 1, and every update to
232
- mutable fields in the pod's spec will increment the ` generation ` by 1. If the
233
- alpha feature gate PodObservedGenerationTracking is set, the
234
- pod's ` status.observedGeneration ` will reflect the ` metadata.generation ` of
235
- the pod at the point that the pod status is being reported.
230
+
236
231
- If the ` metadata.deletionTimestamp ` is set, no new entry can be added to the
237
232
` metadata.finalizers ` list.
238
233
- Pod updates may not change fields other than ` spec.containers[*].image ` ,
239
- ` spec.initContainers[*].image ` , ` spec.activeDeadlineSeconds ` or
240
- ` spec.tolerations ` . For ` spec.tolerations ` , you can only add new entries.
234
+ ` spec.initContainers[*].image ` , ` spec.activeDeadlineSeconds ` , ` spec.terminationGracePeriodSeconds ` ,
235
+ ` spec.tolerations ` or ` spec.schedulingGates ` . For ` spec.tolerations ` , you can only add new entries.
241
236
- When updating the ` spec.activeDeadlineSeconds ` field, two types of updates
242
237
are allowed:
243
238
@@ -260,6 +255,54 @@ The above update rules apply to regular pod updates, but other pod fields can be
260
255
- ** Binding:** The ` binding ` subresource allows setting the pod's ` spec.nodeName ` via a ` Binding ` request.
261
256
This is typically only used by the {{< glossary_tooltip text="scheduler" term_id="kube-scheduler" >}}.
262
257
258
+ ### Pod generation
259
+
260
+ - The ` metadata.generation ` field is unique. It will be automatically set by the
261
+ system such that new pods have a ` metadata.generation ` of 1, and every update to
262
+ mutable fields in the pod's spec will increment the ` metadata.generation ` by 1.
263
+
264
+ {{< feature-state feature_gate_name="PodObservedGenerationTracking" >}}
265
+
266
+ - ` observedGeneration ` is a field that is captured in the ` status ` section of the Pod
267
+ object. If the feature gate ` PodObservedGenerationTracking ` is set, the Kubelet will set ` status.observedGeneration `
268
+ to track the pod state to the current pod status. The pod's ` status.observedGeneration ` will reflect the
269
+ ` metadata.generation ` of the pod at the point that the pod status is being reported.
270
+
271
+ {{< note >}}
272
+ The ` status.observedGeneration ` field is managed by the kubelet and external controllers should ** not** modify this field.
273
+ {{< /note >}}
274
+
275
+ Different status fields may either be associated with the ` metadata.generation ` of the current sync loop, or with the
276
+ ` metadata.generation ` of the previous sync loop. The key distinction is whether a change in the ` spec ` is reflected
277
+ directly in the ` status ` or is an indirect result of a running process.
278
+
279
+ #### Direct Status Updates
280
+
281
+ For status fields where the allocated spec is directly reflected, the ` observedGeneration ` will
282
+ be associated with the current ` metadata.generation ` (Generation N).
283
+
284
+ This behavior applies to:
285
+
286
+ - ** Resize Status** : The status of a resource resize operation.
287
+ - ** Allocated Resources** : The resources allocated to the Pod after a resize.
288
+ - ** Ephemeral Containers** : When a new ephemeral container is added, and it is in ` Waiting ` state.
289
+
290
+ #### Indirect Status Updates
291
+
292
+ For status fields that are an indirect result of running the spec, the ` observedGeneration ` will be associated
293
+ with the ` metadata.generation ` of the previous sync loop (Generation N-1).
294
+
295
+ This behavior applies to:
296
+
297
+ - ** Container Image** : The ` ContainerStatus.ImageID ` reflects the image from the previous generation until the new image
298
+ is pulled and the container is updated.
299
+ - ** Actual Resources** : During an in-progress resize, the actual resources in use still belong to the previous generation's
300
+ request.
301
+ - ** Container state** : During an in-progress resize, with require restart policy reflects the previous generation's
302
+ request.
303
+ - ** activeDeadlineSeconds** & ** terminationGracePeriodSeconds** & ** deletionTimestamp** : The effects of these fields on the
304
+ Pod's status are a result of the previously observed specification.
305
+
263
306
## Resource sharing and communication
264
307
265
308
Pods enable data sharing and communication among their constituent
0 commit comments