Skip to content

Commit 770e238

Browse files
authored
Merge pull request #45946 from my-git9/nodes245
[zh-cn] sync nodes garbage-collection
2 parents 0faafb0 + 01bd86d commit 770e238

File tree

2 files changed

+90
-16
lines changed

2 files changed

+90
-16
lines changed

content/zh-cn/docs/concepts/architecture/garbage-collection.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ kubelet 会持续删除镜像,直到磁盘用量到达 `LowThresholdPercent`
281281
{{< feature-state feature_gate_name="ImageMaximumGCAge" >}}
282282

283283
<!--
284-
As an alpha feature, you can specify the maximum time a local image can be unused for,
284+
As an beta feature, you can specify the maximum time a local image can be unused for,
285285
regardless of disk usage. This is a kubelet setting that you configure for each node.
286286
-->
287-
这是一个 Alpha 特性,不论磁盘使用情况如何,你都可以指定本地镜像未被使用的最长时间。
287+
这是一个 Beta 特性,不论磁盘使用情况如何,你都可以指定本地镜像未被使用的最长时间。
288288
这是一个可以为每个节点配置的 kubelet 设置。
289289

290290
<!--
@@ -303,6 +303,19 @@ field to `3d12h`, which means 3 days and 12 hours.
303303
该值应遵循 Kubernetes __持续时间(Duration)__ 格式;例如,你可以将配置字段设置为 `3d12h`
304304
代表 3 天 12 小时。
305305

306+
{{< note >}}
307+
<!--
308+
This feature does not track image usage across kubelet restarts. If the kubelet
309+
is restarted, the tracked image age is reset, causing the kubelet to wait the full
310+
`ImageMaximumGCAge` duration before qualifying images for garbage collection
311+
based on image age.
312+
-->
313+
这个特性不会跟踪 kubelet 重新启动后的镜像使用情况。
314+
如果 kubelet 被重新启动,所跟踪的镜像年龄会被重置,
315+
导致 kubelet 在根据镜像年龄进行垃圾收集时需要等待完整的
316+
`ImageMaximumGCAge` 时长。
317+
{{< /note>}}
318+
306319
<!--
307320
### Container garbage collection {#container-image-garbage-collection}
308321

content/zh-cn/docs/concepts/architecture/nodes.md

Lines changed: 75 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
---
22
title: 节点
3+
api_metadata:
4+
- apiVersion: "v1"
5+
kind: "Node"
36
content_type: concept
47
weight: 10
58
---
@@ -8,6 +11,9 @@ reviewers:
811
- caesarxuchao
912
- dchen1107
1013
title: Nodes
14+
api_metadata:
15+
- apiVersion: "v1"
16+
kind: "Node"
1117
content_type: concept
1218
weight: 10
1319
-->
@@ -950,22 +956,79 @@ During a non-graceful shutdown, Pods are terminated in the two phases:
950956
并且用户要检查关闭节点是否已恢复,因为该用户是最初添加污点的用户。
951957
{{< /note >}}
952958

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+
9531014
<!--
9541015
## Swap memory management {#swap-memory}
9551016
-->
956-
## 交换内存管理 {#swap-memory}
1017+
## 交换内存(swap)管理 {#swap-memory}
9571018

9581019
{{< feature-state feature_gate_name="NodeSwap" >}}
9591020

9601021
<!--
9611022
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`
9631024
[configuration setting](/docs/reference/config-api/kubelet-config.v1beta1/)
9641025
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.
9651027
-->
966-
要在节点上启用交换内存,必须启用 kubelet 的 `NodeSwap` 特性门控,
1028+
要在节点上启用交换内存,必须启用 kubelet 的 `NodeSwap` 特性门控(默认启用)
9671029
同时使用 `--fail-swap-on` 命令行参数或者将 `failSwapOn`
9681030
[配置](/zh-cn/docs/reference/config-api/kubelet-config.v1beta1/)设置为 false。
1031+
为了允许 Pod 使用交换内存,在 kubelet 配置中不应将 `swapBehavior` 设置为 `NoSwap`(默认行为)。
9691032

9701033
{{< warning >}}
9711034
<!--
@@ -983,27 +1046,25 @@ specify how a node will use swap memory. For example,
9831046

9841047
```yaml
9851048
memorySwap:
986-
swapBehavior: UnlimitedSwap
1049+
swapBehavior: LimitedSwap
9871050
```
9881051

9891052
<!--
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.
9921054
- `LimitedSwap`: The utilization of swap memory by Kubernetes workloads is subject to limitations.
9931055
Only Pods of Burstable QoS are permitted to employ swap.
9941056
-->
995-
- `UnlimitedSwap`(默认):Kubernetes 工作负载可以根据请求使用尽可能多的交换内存,
996-
一直到达到系统限制为止。
1057+
- `NoSwap`(默认):Kubernetes 工作负载不会使用交换内存。
9971058
- `LimitedSwap`:Kubernetes 工作负载对交换内存的使用受到限制。
998-
只有具有 Burstable QoS 的 Pod 可以使用交换空间
1059+
只有具有 Burstable QoS 的 Pod 可以使用交换内存
9991060

10001061
<!--
10011062
If configuration for `memorySwap` is not specified and the feature gate is
10021063
enabled, by default the kubelet will apply the same behaviour as the
1003-
`UnlimitedSwap` setting.
1064+
`NoSwap` setting.
10041065
-->
10051066
如果启用了特性门控但是未指定 `memorySwap` 的配置,默认情况下 kubelet 将使用与
1006-
`UnlimitedSwap` 设置相同的行为。
1067+
`NoSwap` 设置相同的行为。
10071068

10081069
<!--
10091070
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
10381099
opt-out of swap usage by specifying memory requests that are equal to memory limits.
10391100
Containers configured in this manner will not have access to swap memory.
10401101
-->
1041-
交换限制被配置为 `(containerMemoryRequest / nodeTotalMemory) * totalPodsSwapAvailable` 的值。
1102+
交换内存限制被配置为 `(containerMemoryRequest / nodeTotalMemory) * totalPodsSwapAvailable` 的值。
10421103

1043-
需要注意的是,位于 Burstable QoS Pod 中的容器可以通过将内存请求设置为与内存限制相同来选择不使用交换空间
1104+
需要注意的是,位于 Burstable QoS Pod 中的容器可以通过将内存请求设置为与内存限制相同来选择不使用交换内存
10441105
以这种方式配置的容器将无法访问交换内存。
10451106

10461107
<!--
@@ -1051,7 +1112,7 @@ see the blog-post about [Kubernetes 1.28: NodeSwap graduates to Beta1](/blog/202
10511112
[KEP-2400](https://github.com/kubernetes/enhancements/issues/4128) and its
10521113
[design proposal](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/2400-node-swap/README.md).
10531114
-->
1054-
只有 **Cgroup v2** 支持交换空间,Cgroup v1 不支持。
1115+
只有 **Cgroup v2** 支持交换内存,Cgroup v1 不支持。
10551116

10561117
如需了解更多信息、协助测试和提交反馈,请参阅关于
10571118
[Kubernetes 1.28:NodeSwap 进阶至 Beta1](/zh-cn/blog/2023/08/24/swap-linux-beta/) 的博客文章、

0 commit comments

Comments
 (0)