@@ -75,9 +75,9 @@ On each worker node where you will configure swap use, you need:
7575If swap is not enabled, there's a need to provision swap on the node.
7676The following sections demonstrate creating 4GiB of swap, both in the encrypted and unencrypted case.
7777-->
78- ## 使用 kubeadm 安装支持交换内存的集群
78+ ## 使用 kubeadm 安装支持交换内存的集群 {#install-a-swap-enabled-cluster-with-kubeadm}
7979
80- ### 创建交换文件并启用交换内存
80+ ### 创建交换文件并启用交换内存 {#create-a-swap-file-and-turn-swap-on}
8181
8282如果当前节点未启用交换内存,则需要先** 制备** 交换空间。
8383本节将展示如何以加密和未加密的方式创建 4GiB 的交换文件。
@@ -221,26 +221,54 @@ In a similar way, using systemd allows your server to leave swap active until ku
221221<!--
222222### Set up kubelet configuration
223223
224- After enabling swap on the node, kubelet needs to be configured in the following way:
224+ After enabling swap on the node, kubelet needs to be configured to use it.
225+ You need to select a [swap behavior](/docs/reference/node/swap-behavior/)
226+ for this node. You'll configure _LimitedSwap_ behavior for this tutorial.
225227
228+ Find and edit the kubelet configuration file, and:
229+
230+ - set `failSwapOn` to false
231+ - set `memorySwap.swapBehavior` to LimitedSwap
232+ -->
233+ ### 配置 kubelet {#set-up-kubelet-configuration}
234+
235+ 在节点上启用交换内存后,需要按如下方式配置 kubelet。
236+ 你需要为此节点选择一种[ 交换内存行为] ( /zh-cn/docs/reference/node/swap-behavior/ ) 。
237+ 在本教程中,你将配置 ** LimitedSwap** 行为。
238+
239+ 找到并编辑 kubelet 配置文件,然后:
240+
241+ - 将 ` failSwapOn ` 设置为 false
242+ - 将 ` memorySwap.swapBehavior ` 设置为 LimitedSwap
243+
244+ <!--
226245```yaml
227246 # this fragment goes into the kubelet's configuration file
228247 failSwapOn: false
229248 memorySwap:
230249 swapBehavior: LimitedSwap
231250```
232-
233- In order for these configurations to take effect, kubelet needs to be restarted.
234251-->
235- ### 配置 kubelet {#set-up-kubelet-configuration}
236-
237- 在节点上启用交换内存后,需要按如下方式配置 kubelet:
238-
239252``` yaml
240253# 此代码片段应添加到 kubelet 的配置文件中
241254failSwapOn : false
242255memorySwap :
243256 swapBehavior : LimitedSwap
244257` ` `
245258
259+ <!--
260+ In order for these configurations to take effect, kubelet needs to be restarted.
261+ Typically you do that by running:
262+ -->
246263为了使这些配置生效,需重启 kubelet。
264+ 通常你需要为此运行以下命令:
265+
266+ ` ` ` shell
267+ systemctl restart kubelet.service
268+ ```
269+
270+ <!--
271+ You should find that the kubelet is now healthy, and that you can run Pods
272+ that use swap memory as needed.
273+ -->
274+ 你应该会发现 kubelet 现在处于健康状态,并且你可以根据需要运行使用交换内存的 Pod。
0 commit comments