Skip to content

Commit 29e6c74

Browse files
committed
follow up 52876
1 parent 8167832 commit 29e6c74

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

content/en/docs/concepts/workloads/pods/pod-lifecycle.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -958,17 +958,42 @@ phase. Also, PodGC adds a Pod disruption condition when cleaning up an orphan Po
958958
See [Pod disruption conditions](/docs/concepts/workloads/pods/disruptions#pod-disruption-conditions)
959959
for more details.
960960

961-
### Pod status during kubelet restart {#kubelet-restart-pod-status}
961+
## Pod behavior during kubelet restarts {#kubelet-restarts}
962962

963-
{{< feature-state feature_gate_name="ChangeContainerStatusOnKubeletRestart" >}}
963+
If you restart the kubelet, Pods (and their containers) continue to run
964+
even during the restart.
965+
When there are running Pods on a node, stopping or restarting the kubelet
966+
on that node does **not** cause the kubelet to stop all local Pods
967+
before the kubelet itself stops.
968+
To stop the Pods on a node, you can use `kubectl drain`.
964969

965-
If the node's `KubeletReady` condition remains unchanged, meaning its `Ready` condition does not transition from true to false, we consider it a kubelet restart.
970+
### Detection of kubelet restarts
971+
{{< feature-state feature_gate_name="ChangeContainerStatusOnKubeletRestart" >}}
972+
When the kubelet starts, it checks to see if there is already a Node with
973+
bound Pods.
974+
If the Node's [`Ready` condition](/docs/reference/node/node-status/#condition) remains unchanged,
975+
in other words the condition has not transitioned from true to false, Kubernetes detects this a _kubelet restart_.
976+
(It's possible to restart the kubelet in other ways, for example to fix a node bug,
977+
but in these cases, Kubernetes picks the safe option and treats this as if you
978+
stopped the kubelet and then later started it).
966979

967980
When the kubelet restarts, the container statuses are managed differently based on the feature gate setting:
968981

969-
* With the `ChangeContainerStatusOnKubeletRestart` feature gate disabled (the default), the kubelet does not change container statuses after a restart. Containers that were in a Ready state remain Ready.
970-
971-
* With the feature gate enabled, and containers within the pod have a readiness probe, the kubelet will modify the container's Ready status after restart to be not ready. This behavior was the default for a long time and caused issues in large scale deployments. While the feature gate allows reverting to this legacy behavior temporarily, it is recommended to file a bug report if you encounter problems. Note that this feature gate will be removed in the future.
982+
* By default, the kubelet does not change container statuses after a restart.
983+
Containers that were in set to `ready: true` state remain remain ready.
984+
985+
If you stop the kubelet long enough for it to fail a series of
986+
[node heartbeat](/docs/concepts/architecture/leases/#node-heart-beats) checks,
987+
and then you wait before you start the kubelet again, Kubernetes may begin to evict Pods from that Node.
988+
However, even though Pod evictions begin to happen, Kubernetes does not mark the
989+
individual containers in those Pods as `ready: false`. The Pod-level eviction
990+
happens after the control plane taints the node as `node.kubernetes.io/not-ready` (due to the failed heartbeats).
991+
992+
* In Kubernetes {{< skew currentVersion >}} you can opt in to a legacy behavior where the kubelet always modify the containers `ready` value, after a kubelet restart, to be false.
993+
This legacy behavior was the default for a long time, but caused issue for people using Kubernetes, especially in large scale deployments.
994+
Althought the feature gate allows reverting to this legacy behavior temporarily, the Kubernetes project recommends that you file a bug report if you encounter problems.
995+
The `ChangeContainerStatusOnKubeletRestart` feature gate will be removed in
996+
the future.
972997

973998
## {{% heading "whatsnext" %}}
974999

content/en/docs/reference/command-line-tools-reference/feature-gates/ChangeContainerStatusOnKubeletRestart.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ stages:
1010
defaultValue: false
1111
fromVersion: "1.35"
1212
---
13-
When disabled, kubelet restarts will not change the status of Pods already running on the node,
14-
This Feature Gate was introduced to allow revert the behavior to previously used default.
15-
13+
This feature gate was introduced to allow you revert the behavior to previously used default.
14+
If you are satisfied with the default behavior, you do not need to enable this
15+
feature gate.

0 commit comments

Comments
 (0)