1
1
---
2
2
title : 节点
3
+ api_metadata :
4
+ - apiVersion : " v1"
5
+ kind : " Node"
3
6
content_type : concept
4
7
weight : 10
5
8
---
@@ -8,6 +11,9 @@ reviewers:
8
11
- caesarxuchao
9
12
- dchen1107
10
13
title: Nodes
14
+ api_metadata:
15
+ - apiVersion: "v1"
16
+ kind: "Node"
11
17
content_type: concept
12
18
weight: 10
13
19
-->
@@ -950,22 +956,79 @@ During a non-graceful shutdown, Pods are terminated in the two phases:
950
956
并且用户要检查关闭节点是否已恢复,因为该用户是最初添加污点的用户。
951
957
{{< /note >}}
952
958
959
+ <!--
960
+ # ## Forced storage detach on timeout {#storage-force-detach-on-timeout}
961
+
962
+ In any situation where a pod deletion has not succeeded for 6 minutes, kubernetes will
963
+ force detach volumes being unmounted if the node is unhealthy at that instant. Any
964
+ workload still running on the node that uses a force-detached volume will cause a
965
+ violation of the
966
+ [CSI specification](https://github.com/container-storage-interface/spec/blob/master/spec.md#controllerunpublishvolume),
967
+ which states that `ControllerUnpublishVolume` "**must** be called after all
968
+ ` NodeUnstageVolume` and `NodeUnpublishVolume` on the volume are called and succeed".
969
+ In such circumstances, volumes on the node in question might encounter data corruption.
970
+ -->
971
+ # ## 存储超时强制解除挂接 {#storage-force-detach-on-timeout}
972
+
973
+ 当任何 Pod 未能在 6 分钟内被成功删除时,如果节点当时不健康,
974
+ Kubernetes 将强制解除挂接正在被卸载的卷。
975
+ 在启用了强制解除挂接卷的节点上仍在运行的所有工作负载都将导致违反
976
+ [CSI 规范](https://github.com/container-storage-interface/spec/blob/master/spec.md#controllerunpublishvolume),
977
+ 该规范指出 `ControllerUnpublishVolume` "**必须**在调用卷上的所有 `NodeUnstageVolume`
978
+ 和 `NodeUnpublishVolume` 执行且成功后被调用"。在这种情况下,相关节点上的卷可能会遇到数据损坏。
979
+
980
+ <!--
981
+ The forced storage detach behaviour is optional; users might opt to use the "Non-graceful
982
+ node shutdown" feature instead.
983
+ -->
984
+ 强制存储解除挂接行为是可选的;用户可以选择使用"非体面节点关闭"特性。
985
+
986
+ <!--
987
+ Force storage detach on timeout can be disabled by setting the `disable-force-detach-on-timeout`
988
+ config field in `kube-controller-manager`. Disabling the force detach on timeout feature means
989
+ that a volume that is hosted on a node that is unhealthy for more than 6 minutes will not have
990
+ its associated
991
+ [VolumeAttachment](/docs/reference/kubernetes-api/config-and-storage-resources/volume-attachment-v1/)
992
+ deleted.
993
+ -->
994
+ 可以通过在 `kube-controller-manager` 中设置 `disable-force-detach-on-timeout`
995
+ 配置字段来禁用超时时存储强制解除挂接。
996
+ 禁用超时强制解除挂接特性意味着托管在不正常运行时间超过 6 分钟的节点上的卷将不会删除其关联的
997
+ [VolumeAttachment](/zh-cn/docs/reference/kubernetes-api/config-and-storage-resources/volume-attachment-v1/)。
998
+
999
+ <!--
1000
+ After this setting has been applied, unhealthy pods still attached to a volumes must be recovered
1001
+ via the [Non-Graceful Node Shutdown](#non-graceful-node-shutdown) procedure mentioned above.
1002
+ -->
1003
+ 应用此设置后,仍关联到某卷的不健康 Pod 必须通过上述[非体面节点关闭](#non-graceful-node-shutdown)过程进行恢复。
1004
+
1005
+ {{< note >}}
1006
+ <!--
1007
+ - Caution must be taken while using the [Non-Graceful Node Shutdown](#non-graceful-node-shutdown) procedure.
1008
+ - Deviation from the steps documented above can result in data corruption.
1009
+ -->
1010
+ - 使用[非体面节点关闭](#non-graceful-node-shutdown)过程时必须小心。
1011
+ - 偏离上述步骤可能会导致数据损坏。
1012
+ {{< /note >}}
1013
+
953
1014
<!--
954
1015
# # Swap memory management {#swap-memory}
955
1016
-->
956
- # # 交换内存管理 {#swap-memory}
1017
+ # # 交换内存(swap)管理 {#swap-memory}
957
1018
958
1019
{{< feature-state feature_gate_name="NodeSwap" >}}
959
1020
960
1021
<!--
961
1022
To enable swap on a node, the `NodeSwap` feature gate must be enabled on
962
- the kubelet, and the `--fail-swap-on` command line flag or `failSwapOn`
1023
+ the kubelet (default is true) , and the `--fail-swap-on` command line flag or `failSwapOn`
963
1024
[configuration setting](/docs/reference/config-api/kubelet-config.v1beta1/)
964
1025
must be set to false.
1026
+ To allow Pods to utilize swap, `swapBehavior` should not be set to `NoSwap` (which is the default behavior) in the kubelet config.
965
1027
-->
966
- 要在节点上启用交换内存,必须启用 kubelet 的 `NodeSwap` 特性门控,
1028
+ 要在节点上启用交换内存,必须启用 kubelet 的 `NodeSwap` 特性门控(默认启用) ,
967
1029
同时使用 `--fail-swap-on` 命令行参数或者将 `failSwapOn`
968
1030
[配置](/zh-cn/docs/reference/config-api/kubelet-config.v1beta1/)设置为 false。
1031
+ 为了允许 Pod 使用交换内存,在 kubelet 配置中不应将 `swapBehavior` 设置为 `NoSwap`(默认行为)。
969
1032
970
1033
{{< warning >}}
971
1034
<!--
@@ -983,27 +1046,25 @@ specify how a node will use swap memory. For example,
983
1046
984
1047
` ` ` yaml
985
1048
memorySwap:
986
- swapBehavior: UnlimitedSwap
1049
+ swapBehavior: LimitedSwap
987
1050
` ` `
988
1051
989
1052
<!--
990
- - `UnlimitedSwap` (default) : Kubernetes workloads can use as much swap memory as they
991
- request, up to the system limit.
1053
+ - `NoSwap` (default) : Kubernetes workloads will not use swap.
992
1054
- `LimitedSwap` : The utilization of swap memory by Kubernetes workloads is subject to limitations.
993
1055
Only Pods of Burstable QoS are permitted to employ swap.
994
1056
-->
995
- - ` UnlimitedSwap` (默认):Kubernetes 工作负载可以根据请求使用尽可能多的交换内存,
996
- 一直到达到系统限制为止。
1057
+ - ` NoSwap` (默认):Kubernetes 工作负载不会使用交换内存。
997
1058
- ` LimitedSwap` :Kubernetes 工作负载对交换内存的使用受到限制。
998
- 只有具有 Burstable QoS 的 Pod 可以使用交换空间 。
1059
+ 只有具有 Burstable QoS 的 Pod 可以使用交换内存 。
999
1060
1000
1061
<!--
1001
1062
If configuration for `memorySwap` is not specified and the feature gate is
1002
1063
enabled, by default the kubelet will apply the same behaviour as the
1003
- ` UnlimitedSwap ` setting.
1064
+ ` NoSwap ` setting.
1004
1065
-->
1005
1066
如果启用了特性门控但是未指定 `memorySwap` 的配置,默认情况下 kubelet 将使用与
1006
- ` UnlimitedSwap ` 设置相同的行为。
1067
+ ` NoSwap ` 设置相同的行为。
1007
1068
1008
1069
<!--
1009
1070
With `LimitedSwap`, Pods that do not fall under the Burstable QoS classification (i.e.
@@ -1038,9 +1099,9 @@ It is important to note that, for containers within Burstable QoS Pods, it is po
1038
1099
opt-out of swap usage by specifying memory requests that are equal to memory limits.
1039
1100
Containers configured in this manner will not have access to swap memory.
1040
1101
-->
1041
- 交换限制被配置为 `(containerMemoryRequest / nodeTotalMemory) * totalPodsSwapAvailable` 的值。
1102
+ 交换内存限制被配置为 `(containerMemoryRequest / nodeTotalMemory) * totalPodsSwapAvailable` 的值。
1042
1103
1043
- 需要注意的是,位于 Burstable QoS Pod 中的容器可以通过将内存请求设置为与内存限制相同来选择不使用交换空间 。
1104
+ 需要注意的是,位于 Burstable QoS Pod 中的容器可以通过将内存请求设置为与内存限制相同来选择不使用交换内存 。
1044
1105
以这种方式配置的容器将无法访问交换内存。
1045
1106
1046
1107
<!--
@@ -1051,7 +1112,7 @@ see the blog-post about [Kubernetes 1.28: NodeSwap graduates to Beta1](/blog/202
1051
1112
[KEP-2400](https://github.com/kubernetes/enhancements/issues/4128) and its
1052
1113
[design proposal](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/2400-node-swap/README.md).
1053
1114
-->
1054
- 只有 **Cgroup v2** 支持交换空间 ,Cgroup v1 不支持。
1115
+ 只有 **Cgroup v2** 支持交换内存 ,Cgroup v1 不支持。
1055
1116
1056
1117
如需了解更多信息、协助测试和提交反馈,请参阅关于
1057
1118
[Kubernetes 1.28:NodeSwap 进阶至 Beta1](/zh-cn/blog/2023/08/24/swap-linux-beta/) 的博客文章、
0 commit comments