Skip to content

Commit 17f2ae9

Browse files
authored
Merge pull request #39586 from windsonsea/sysctly
[zh] sync sysctl-cluster.md
2 parents 9e17076 + 82585b0 commit 17f2ae9

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

content/zh-cn/docs/tasks/administer-cluster/sysctl-cluster.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ This document describes how to configure and use kernel parameters within a
2020
Kubernetes cluster using the {{< glossary_tooltip term_id="sysctl" >}}
2121
interface.
2222
-->
23-
2423
本文档介绍如何通过 {{< glossary_tooltip term_id="sysctl" >}}
2524
接口在 Kubernetes 集群中配置和使用内核参数。
2625

26+
{{< note >}}
2727
<!--
2828
Starting from Kubernetes version 1.23, the kubelet supports the use of either `/` or `.`
2929
as separators for sysctl names.
@@ -34,7 +34,6 @@ For more sysctl parameter conversion method details, please refer to
3434
the page [sysctl.d(5)](https://man7.org/linux/man-pages/man5/sysctl.d.5.html) from
3535
the Linux man-pages project.
3636
-->
37-
{{< note >}}
3837
从 Kubernetes 1.23 版本开始,kubelet 支持使用 `/``.` 作为 sysctl 参数的分隔符。
3938
从 Kubernetes 1.25 版本开始,支持为 Pod 设置 sysctl 时使用设置名字带有斜线的 sysctl。
4039
例如,你可以使用点或者斜线作为分隔符表示相同的 sysctl 参数,以点作为分隔符表示为: `kernel.shm_rmid_forced`
@@ -58,7 +57,7 @@ options for the kubelets running on your cluster.
5857
<!--
5958
## Listing all Sysctl Parameters
6059
-->
61-
## 获取 Sysctl 的参数列表
60+
## 获取 Sysctl 的参数列表 {#listing-all-sysctl-parameters}
6261

6362
<!--
6463
In Linux, the sysctl interface allows an administrator to modify kernel
@@ -91,17 +90,17 @@ sudo sysctl -a
9190
```
9291

9392
<!--
94-
## Enabling Unsafe Sysctls
93+
## Safe and Unsafe Sysctls
9594
96-
Sysctls are grouped into _safe_ and _unsafe_ sysctls. In addition to proper
97-
namespacing a _safe_ sysctl must be properly _isolated_ between pods on the same
98-
node. This means that setting a _safe_ sysctl for one pod
95+
Kubernetes classes sysctls as either _safe_ or _unsafe_. In addition to proper
96+
namespacing, a _safe_ sysctl must be properly _isolated_ between pods on the
97+
same node. This means that setting a _safe_ sysctl for one pod
9998
-->
100-
## 启用非安全的 Sysctl 参数 {#enabling-usafe-sysctls}
99+
## 安全和非安全的 Sysctl 参数 {#safe-and-unsafe-sysctls}
101100

102-
sysctl 参数分为 **安全****非安全的**
103-
**安全** 的 sysctl 参数除了需要设置恰当的命名空间外,在同一节点上的不同 Pod
104-
之间也必须是 **相互隔离的**。这意味着 Pod 上设置 **安全** sysctl 参数
101+
Kubernetes 将 sysctl 参数分为 **安全****非安全的**
102+
**安全** 的 sysctl 参数除了需要设置恰当的命名空间外,在同一节点上的不同 Pod
103+
之间也必须是 **相互隔离的**。这意味着 Pod 上设置 **安全的** sysctl 参数时
105104

106105
<!--
107106
- must not have any influence on any other pod on the node
@@ -126,10 +125,10 @@ The following sysctls are supported in the _safe_ set:
126125
- `net.ipv4.ping_group_range`(从 Kubernetes 1.18 开始)
127126
- `net.ipv4.ip_unprivileged_port_start`(从 Kubernetes 1.22 开始)。
128127

128+
{{< note >}}
129129
<!--
130130
The example `net.ipv4.tcp_syncookies` is not namespaced on Linux kernel version 4.4 or lower.
131131
-->
132-
{{< note >}}
133132
示例中的 `net.ipv4.tcp_syncookies` 在Linux 内核 4.4 或更低的版本中是无命名空间的。
134133
{{< /note >}}
135134

@@ -141,8 +140,12 @@ supports better isolation mechanisms.
141140
则上述列表中将会列出更多 **安全的** sysctl 参数。
142141

143142
<!--
143+
### Enabling Unsafe Sysctls
144+
144145
All _safe_ sysctls are enabled by default.
145146
-->
147+
### 启用非安全的 Sysctl 参数 {#enabling-unsafe-sysctls}
148+
146149
所有 **安全的** sysctl 参数都默认启用。
147150

148151
<!--
@@ -188,10 +191,10 @@ A number of sysctls are _namespaced_ in today's Linux kernels. This means that
188191
they can be set independently for each pod on a node. Only namespaced sysctls
189192
are configurable via the pod securityContext within Kubernetes.
190193
-->
191-
## 设置 Pod 的 Sysctl 参数
194+
## 设置 Pod 的 Sysctl 参数 {#setting-sysctls-for-pod}
192195

193-
目前,在 Linux 内核中,有许多的 sysctl 参数都是 **有命名空间的**
194-
这就意味着可以为节点上的每个 Pod 分别去设置它们的 sysctl 参数。
196+
目前,在 Linux 内核中,有许多的 sysctl 参数都是 **有命名空间的**
197+
这就意味着可以为节点上的每个 Pod 分别去设置它们的 sysctl 参数。
195198
在 Kubernetes 中,只有那些有命名空间的 sysctl 参数可以通过 Pod 的 securityContext 对其进行配置。
196199

197200
<!--
@@ -235,11 +238,11 @@ the specification.
235238
`net.core.somaxconn``kernel.msgmax` 进行设置。
236239
在 Pod 规约中对 **安全的****非安全的** sysctl 参数不做区分。
237240

241+
{{< warning >}}
238242
<!--
239243
Only modify sysctl parameters after you understand their effects, to avoid
240244
destabilizing your operating system.
241245
-->
242-
{{< warning >}}
243246
为了避免破坏操作系统的稳定性,请你在了解变更后果之后再修改 sysctl 参数。
244247
{{< /warning >}}
245248

@@ -262,12 +265,12 @@ spec:
262265

263266
<!-- discussion -->
264267

268+
{{< warning >}}
265269
<!--
266270
Due to their nature of being _unsafe_, the use of _unsafe_ sysctls
267271
is at-your-own-risk and can lead to severe problems like wrong behavior of
268272
containers, resource shortage or complete breakage of a node.
269273
-->
270-
{{< warning >}}
271274
由于 **非安全的** sysctl 参数其本身具有不稳定性,在使用 **非安全的** sysctl 参数时可能会导致一些严重问题,
272275
如容器的错误行为、机器资源不足或节点被完全破坏,用户需自行承担风险。
273276
{{< /warning >}}
@@ -295,6 +298,3 @@ to schedule those pods onto the right nodes.
295298
建议开启[污点和容忍度特性](/docs/reference/generated/kubectl/kubectl-commands/#taint)
296299
[为节点配置污点](/zh-cn/docs/concepts/scheduling-eviction/taint-and-toleration/)以便将
297300
Pod 调度到正确的节点之上。
298-
299-
300-

0 commit comments

Comments
 (0)