Skip to content

Commit 70e7171

Browse files
committed
[zh] Move and update provision-swap-memory.md
1 parent e0407ac commit 70e7171

2 files changed

Lines changed: 45 additions & 18 deletions

File tree

content/zh-cn/docs/tutorials/_index.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ no_list: true
55
weight: 60
66
content_type: concept
77
---
8-
98
<!--
109
title: Tutorials
1110
main_menu: true
@@ -57,7 +56,7 @@ Kubernetes 文档的这一部分包含教程。
5756
5857
* [Adopting Sidecar Containers](/docs/tutorials/configuration/pod-sidecar-containers/)
5958
-->
60-
## 构造 Pod
59+
## 构造 Pod {#authoring-pods}
6160

6261
* [采用 Sidecar 容器](/zh-cn/docs/tutorials/configuration/pod-sidecar-containers/)
6362

@@ -67,10 +66,10 @@ Kubernetes 文档的这一部分包含教程。
6766
* [Exposing an External IP Address to Access an Application in a Cluster](/docs/tutorials/stateless-application/expose-external-ip-address/)
6867
* [Example: Deploying PHP Guestbook application with MongoDB](/docs/tutorials/stateless-application/guestbook/)
6968
-->
70-
## 无状态应用程序 {#stateless-applications}
69+
## 无状态应用 {#stateless-applications}
7170

72-
* [公开外部 IP 地址访问集群中的应用程序](/zh-cn/docs/tutorials/stateless-application/expose-external-ip-address/)
73-
* [示例:使用 Redis 部署 PHP 留言板应用程序](/zh-cn/docs/tutorials/stateless-application/guestbook/)
71+
* [公开外部 IP 地址访问集群中的应用](/zh-cn/docs/tutorials/stateless-application/expose-external-ip-address/)
72+
* [示例:使用 Redis 部署 PHP 留言板应用](/zh-cn/docs/tutorials/stateless-application/guestbook/)
7473

7574
<!--
7675
## Stateful Applications
@@ -80,7 +79,7 @@ Kubernetes 文档的这一部分包含教程。
8079
* [Example: Deploying Cassandra with Stateful Sets](/docs/tutorials/stateful-application/cassandra/)
8180
* [Running ZooKeeper, A CP Distributed System](/docs/tutorials/stateful-application/zookeeper/)
8281
-->
83-
## 有状态应用程序 {#stateful-applications}
82+
## 有状态应用 {#stateful-applications}
8483

8584
* [StatefulSet 基础](/zh-cn/docs/tutorials/stateful-application/basic-stateful-set/)
8685
* [示例:WordPress 和 MySQL 使用持久卷](/zh-cn/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/)
@@ -120,7 +119,7 @@ Kubernetes 文档的这一部分包含教程。
120119
* [Running Kubelet in Standalone Mode](/docs/tutorials/cluster-management/kubelet-standalone/)
121120
* [Install Drivers and Allocate Devices with DRA](/docs/tutorials/cluster-management/install-use-dra/)
122121
-->
123-
## 集群管理
122+
## 集群管理 {#cluster-management}
124123

125124
* [在 Kubernetes 节点上配置交换内存](/zh-cn/docs/tutorials/cluster-management/provision-swap-memory/)
126125
* [以独立模式运行 kubelet](/zh-cn/docs/tutorials/cluster-management/kubelet-standalone/)
@@ -133,5 +132,5 @@ If you would like to write a tutorial, see
133132
[Content Page Types](/docs/contribute/style/page-content-types/)
134133
for information about the tutorial page.
135134
-->
136-
如果你要编写教程,请参阅[内容页面类型](/zh-cn/docs/contribute/style/page-content-types/)
137-
以获取有关教程页面类型的信息。
135+
如果你要编写教程,
136+
请参阅[内容页面类型](/zh-cn/docs/contribute/style/page-content-types/)以获取有关教程页面类型的信息。

content/zh-cn/docs/tutorials/configuration/provision-swap-memory.md renamed to content/zh-cn/docs/tutorials/cluster-management/provision-swap-memory.md

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ On each worker node where you will configure swap use, you need:
7575
If swap is not enabled, there's a need to provision swap on the node.
7676
The 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 的配置文件中
241254
failSwapOn: false
242255
memorySwap:
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

Comments
 (0)