Skip to content

Commit d195b0f

Browse files
authored
Merge pull request #23198 from tengqm/zh-links-tasks-7
[zh] Tidy up and fix links in tasks section (7/10)
2 parents 0355f57 + 30423d1 commit d195b0f

12 files changed

+724
-795
lines changed

content/zh/docs/tasks/administer-cluster/cpu-management-policies.md

Lines changed: 69 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
---
22
title: 控制节点上的 CPU 管理策略
3-
reviewers:
4-
- sjenning
5-
- ConnorDoyle
6-
- balajismaniam
73
content_type: task
84
---
95
<!--
10-
116
title: Control CPU Management Policies on the Node
127
reviewers:
138
- sjenning
149
- ConnorDoyle
1510
- balajismaniam
1611
content_type: task
17-
--->
12+
-->
1813

1914
<!-- overview -->
2015

@@ -27,19 +22,15 @@ stronger guarantees in terms of latency and/or performance in order to operate
2722
acceptably. The kubelet provides methods to enable more complex workload
2823
placement policies while keeping the abstraction free from explicit placement
2924
directives.
30-
--->
31-
按照设计,Kubernetes 对 pod 执行相关的很多方面进行了抽象,使得用户不必关心。然
32-
而,为了正常运行,有些工作负载要求在延迟和/或性能方面有更强的保证。 为此,kubelet 提供方法来实现更复杂的负载放置策略,同时保持抽象,避免显式的放置指令。
33-
34-
25+
-->
26+
按照设计,Kubernetes 对 pod 执行相关的很多方面进行了抽象,使得用户不必关心。
27+
然而,为了正常运行,有些工作负载要求在延迟和/或性能方面有更强的保证。
28+
为此,kubelet 提供方法来实现更复杂的负载放置策略,同时保持抽象,避免显式的放置指令。
3529

3630
## {{% heading "prerequisites" %}}
3731

38-
3932
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
4033

41-
42-
4334
<!-- steps -->
4435

4536
<!--
@@ -51,49 +42,51 @@ the workload can move to different CPU cores depending on
5142
whether the pod is throttled and which CPU cores are available at
5243
scheduling time.  Many workloads are not sensitive to this migration and thus
5344
work fine without any intervention.
54-
--->
45+
-->
5546
## CPU 管理策略
5647

57-
默认情况下,kubelet 使用 [CFS 配额](https://en.wikipedia.org/wiki/Completely_Fair_Scheduler) 来执行 pod 的 CPU 约束。当节点上运行了很多 CPU 密集的 pod 时,工作负载可能会迁移到不同的 CPU 核,这取决于调度时 pod 是否被扼制,以及哪些 CPU 核是可用的。许多工作负载对这种迁移不敏感,因此无需任何干预即可正常工作。
48+
默认情况下,kubelet 使用 [CFS 配额](https://en.wikipedia.org/wiki/Completely_Fair_Scheduler)
49+
来执行 Pod 的 CPU 约束。
50+
当节点上运行了很多 CPU 密集的 Pod 时,工作负载可能会迁移到不同的 CPU 核,
51+
这取决于调度时 Pod 是否被扼制,以及哪些 CPU 核是可用的。
52+
许多工作负载对这种迁移不敏感,因此无需任何干预即可正常工作。
5853

5954
<!--
6055
However, in workloads where CPU cache affinity and scheduling latency
6156
significantly affect workload performance, the kubelet allows alternative CPU
6257
management policies to determine some placement preferences on the node.
63-
--->
64-
然而,有些工作负载的性能明显地受到 CPU 缓存亲和性以及调度延迟的影响,对此,kubelet 提供了可选的 CPU 管理策略,来确定节点上的一些分配偏好。
58+
-->
59+
然而,有些工作负载的性能明显地受到 CPU 缓存亲和性以及调度延迟的影响。
60+
对此,kubelet 提供了可选的 CPU 管理策略,来确定节点上的一些分配偏好。
6561

6662
<!--
6763
### Configuration
6864
69-
The CPU Manager is an alpha feature in Kubernetes v1.8. It was enabled by
70-
default as a beta feature since v1.10.
71-
72-
The CPU Manager policy is set with the `--cpu-manager-policy` kubelet
65+
The CPU Manager policy is set with the `-cpu-manager-policy` kubelet
7366
option. There are two supported policies:
74-
--->
67+
-->
7568
### 配置
7669

77-
CPU 管理器(CPU Manager)作为 alpha 特性引入 Kubernetes 1.8 版本。从 1.10 版本开始,作为 beta 特性默认开启。
78-
7970
CPU 管理策略通过 kubelet 参数 `--cpu-manager-policy` 来指定。支持两种策略:
8071

8172
<!--
8273
* `none`: the default, which represents the existing scheduling behavior.
8374
* `static`: allows pods with certain resource characteristics to be
8475
granted increased CPU affinity and exclusivity on the node.
85-
--->
76+
-->
8677
* `none`: 默认策略,表示现有的调度行为。
8778
* `static`: 允许为节点上具有某些资源特征的 pod 赋予增强的 CPU 亲和性和独占性。
8879

8980
<!--
9081
The CPU manager periodically writes resource updates through the CRI in
9182
order to reconcile in-memory CPU assignments with cgroupfs. The reconcile
9283
frequency is set through a new Kubelet configuration value
93-
`--cpu-manager-reconcile-period`. If not specified, it defaults to the same
94-
duration as `--node-status-update-frequency`.
95-
--->
96-
CPU 管理器定期通过 CRI 写入资源更新,以保证内存中 CPU 分配与 cgroupfs 一致。同步频率通过新增的 Kubelet 配置参数 `--cpu-manager-reconcile-period` 来设置。 如果不指定,默认与 `--node-status-update-frequency` 的周期相同。
84+
`-cpu-manager-reconcile-period`. If not specified, it defaults to the same
85+
duration as `-node-status-update-frequency`.
86+
-->
87+
CPU 管理器定期通过 CRI 写入资源更新,以保证内存中 CPU 分配与 cgroupfs 一致。
88+
同步频率通过新增的 Kubelet 配置参数 `--cpu-manager-reconcile-period` 来设置。
89+
如果不指定,默认与 `--node-status-update-frequency` 的周期相同。
9790

9891
<!--
9992
### None policy
@@ -103,51 +96,43 @@ affinity scheme, providing no affinity beyond what the OS scheduler does
10396
automatically.  Limits on CPU usage for
10497
[Guaranteed pods](/docs/tasks/configure-pod-container/quality-service-pod/)
10598
are enforced using CFS quota.
106-
--->
107-
### None 策略
99+
-->
100+
### none 策略
108101

109-
`none` 策略显式地启用现有的默认 CPU 亲和方案,不提供操作系统调度器默认行为之外的亲和性策略。 通过 CFS 配额来实现 [Guaranteed pods](/docs/tasks/configure-pod-container/quality-service-pod/) 的 CPU 使用限制。
102+
`none` 策略显式地启用现有的默认 CPU 亲和方案,不提供操作系统调度器默认行为之外的亲和性策略。
103+
通过 CFS 配额来实现 [Guaranteed pods](/zh/docs/tasks/configure-pod-container/quality-service-pod/)
104+
的 CPU 使用限制。
110105

111106
<!--
112107
### Static policy
113108
114109
The `static` policy allows containers in `Guaranteed` pods with integer CPU
115110
`requests` access to exclusive CPUs on the node. This exclusivity is enforced
116111
using the [cpuset cgroup controller](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt).
117-
--->
118-
### Static 策略
112+
-->
113+
### static 策略
119114

120-
`static` 策略针对具有整数型 CPU `requests``Guaranteed` pod ,它允许该类 pod 中的容器访问节点上的独占 CPU 资源。这种独占性是使用 [cpuset cgroup 控制器](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt) 来实现的。
115+
`static` 策略针对具有整数型 CPU `requests``Guaranteed` Pod ,它允许该类 Pod
116+
中的容器访问节点上的独占 CPU 资源。这种独占性是使用
117+
[cpuset cgroup 控制器](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt) 来实现的。
121118

122119
<!--
123-
{{< note >}}
124120
System services such as the container runtime and the kubelet itself can continue to run on these exclusive CPUs.  The exclusivity only extends to other pods.
125-
{{< /note >}}
126-
--->
121+
-->
127122
{{< note >}}
128-
诸如容器运行时和 kubelet 本身的系统服务可以继续在这些独占 CPU 上运行。独占性仅针对其他 pod
123+
诸如容器运行时和 kubelet 本身的系统服务可以继续在这些独占 CPU 上运行。独占性仅针对其他 Pod
129124
{{< /note >}}
130125

131126
<!--
132-
{{< note >}}
133-
The alpha version of this policy does not guarantee static
134-
exclusive allocations across Kubelet restarts.
135-
{{< /note >}}
136-
--->
137-
{{< note >}}
138-
该策略的 alpha 版本不保证 Kubelet 重启前后的静态独占性分配。
139-
{{< /note >}}
140-
141-
<!--
142-
{{< note >}}
143127
CPU Manager doesn't support offlining and onlining of
144128
CPUs at runtime. Also, if the set of online CPUs changes on the node,
145129
the node must be drained and CPU manager manually reset by deleting the
146130
state file `cpu_manager_state` in the kubelet root directory.
147-
{{< /note >}}
148-
--->
131+
-->
149132
{{< note >}}
150-
CPU 管理器不支持运行时下线和上线 CPUs。此外,如果节点上的在线 CPUs 集合发生变化,则必须驱逐节点上的 pods,并通过删除 kubelet 根目录中的状态文件 `cpu_manager_state` 来手动重置 CPU 管理器。
133+
CPU 管理器不支持运行时下线和上线 CPUs。此外,如果节点上的在线 CPUs 集合发生变化,
134+
则必须驱逐节点上的 Pod,并通过删除 kubelet 根目录中的状态文件 `cpu_manager_state`
135+
来手动重置 CPU 管理器。
151136
{{< /note >}}
152137

153138
<!--
@@ -172,15 +157,15 @@ exclusive CPUs.
172157
的 CPU 集合。`Guaranteed` pod 中的容器,如果声明了非整数值的 CPU `requests` ,也将运行在共享池的 CPU 上。只有 `Guaranteed` pod 中,指定了整数型 CPU `requests` 的容器,才会被分配独占 CPU 资源。
173158

174159
<!--
175-
{{< note >}}
176160
The kubelet requires a CPU reservation greater than zero be made
177161
using either `--kube-reserved` and/or `--system-reserved` or `--reserved-cpus` when the static
178162
policy is enabled. This is because zero CPU reservation would allow the shared
179163
pool to become empty.
180-
{{< /note >}}
181164
--->
182165
{{< note >}}
183-
当启用 static 策略时,要求使用 `--kube-reserved` 和/或 `--system-reserved``--reserved-cpus` 来保证预留的 CPU 值大于零。 这是因为零预留 CPU 值可能使得共享池变空。
166+
当启用 static 策略时,要求使用 `--kube-reserved` 和/或 `--system-reserved`
167+
`--reserved-cpus` 来保证预留的 CPU 值大于零。
168+
这是因为零预留 CPU 值可能使得共享池变空。
184169
{{< /note >}}
185170

186171
<!--
@@ -194,8 +179,12 @@ affinity and decreases context switches due to throttling for the CPU-bound
194179
workload.
195180
196181
Consider the containers in the following pod specs:
197-
--->
198-
`Guaranteed` pod 调度到节点上时,如果其容器符合静态分配要求,相应的 CPU 会被从共享池中移除,并放置到容器的 cpuset 中。因为这些容器所使用的 CPU 受到调度域本身的限制,所以不需要使用 CFS 配额来进行 CPU 的绑定。换言之,容器 cpuset 中的 CPU 数量与 pod 规格中指定的整数型 CPU `limit` 相等。这种静态分配增强了 CPU 亲和性,减少了 CPU 密集的工作负载在节流时引起的上下文切换。
182+
-->
183+
`Guaranteed` Pod 调度到节点上时,如果其容器符合静态分配要求,
184+
相应的 CPU 会被从共享池中移除,并放置到容器的 cpuset 中。
185+
因为这些容器所使用的 CPU 受到调度域本身的限制,所以不需要使用 CFS 配额来进行 CPU 的绑定。
186+
换言之,容器 cpuset 中的 CPU 数量与 Pod 规约中指定的整数型 CPU `limit` 相等。
187+
这种静态分配增强了 CPU 亲和性,减少了 CPU 密集的工作负载在节流时引起的上下文切换。
199188

200189
考虑以下 Pod 规格的容器:
201190

@@ -209,8 +198,9 @@ spec:
209198
<!--
210199
This pod runs in the `BestEffort` QoS class because no resource `requests` or
211200
`limits` are specified. It runs in the shared pool.
212-
--->
213-
该 pod 属于 `BestEffort` QoS 类型,因为其未指定 `requests` 或 `limits` 值。 所以该容器运行在共享 CPU 池中。
201+
-->
202+
该 Pod 属于 `BestEffort` QoS 类型,因为其未指定 `requests` 或 `limits` 值。
203+
所以该容器运行在共享 CPU 池中。
214204

215205
```yaml
216206
spec:
@@ -228,8 +218,9 @@ spec:
228218
This pod runs in the `Burstable` QoS class because resource `requests` do not
229219
equal `limits` and the `cpu` quantity is not specified. It runs in the shared
230220
pool.
231-
--->
232-
该 pod 属于 `Burstable` QoS 类型,因为其资源 `requests` 不等于 `limits`, 且未指定 `cpu` 数量。所以该容器运行在共享 CPU 池中。
221+
-->
222+
该 Pod 属于 `Burstable` QoS 类型,因为其资源 `requests` 不等于 `limits`,且未指定 `cpu` 数量。
223+
所以该容器运行在共享 CPU 池中。
233224

234225
```yaml
235226
spec:
@@ -248,8 +239,9 @@ spec:
248239
<!--
249240
This pod runs in the `Burstable` QoS class because resource `requests` do not
250241
equal `limits`. It runs in the shared pool.
251-
--->
252-
该 pod 属于 `Burstable` QoS 类型,因为其资源 `requests` 不等于 `limits`。所以该容器运行在共享 CPU 池中。
242+
-->
243+
该 pod 属于 `Burstable` QoS 类型,因为其资源 `requests` 不等于 `limits`。
244+
所以该容器运行在共享 CPU 池中。
253245

254246
```yaml
255247
spec:
@@ -269,8 +261,10 @@ spec:
269261
This pod runs in the `Guaranteed` QoS class because `requests` are equal to `limits`.
270262
And the container's resource limit for the CPU resource is an integer greater than
271263
or equal to one. The `nginx` container is granted 2 exclusive CPUs.
272-
--->
273-
该 pod 属于 `Guaranteed` QoS 类型,因为其 `requests` 值与 `limits`相等。同时,容器对 CPU 资源的限制值是一个大于或等于 1 的整数值。所以,该 `nginx` 容器被赋予 2 个独占 CPU。
264+
-->
265+
该 Pod 属于 `Guaranteed` QoS 类型,因为其 `requests` 值与 `limits`相等。
266+
同时,容器对 CPU 资源的限制值是一个大于或等于 1 的整数值。
267+
所以,该 `nginx` 容器被赋予 2 个独占 CPU。
274268

275269
```yaml
276270
spec:
@@ -290,8 +284,9 @@ spec:
290284
This pod runs in the `Guaranteed` QoS class because `requests` are equal to `limits`.
291285
But the container's resource limit for the CPU resource is a fraction. It runs in
292286
the shared pool.
293-
--->
294-
该 pod 属于 `Guaranteed` QoS 类型,因为其 `requests` 值与 `limits`相等。但是容器对 CPU 资源的限制值是一个小数。所以该容器运行在共享 CPU 池中。
287+
-->
288+
该 Pod 属于 `Guaranteed` QoS 类型,因为其 `requests` 值与 `limits`相等。
289+
但是容器对 CPU 资源的限制值是一个小数。所以该容器运行在共享 CPU 池中。
295290

296291
```yaml
297292
spec:
@@ -309,7 +304,9 @@ This pod runs in the `Guaranteed` QoS class because only `limits` are specified
309304
and `requests` are set equal to `limits` when not explicitly specified. And the
310305
container's resource limit for the CPU resource is an integer greater than or
311306
equal to one. The `nginx` container is granted 2 exclusive CPUs.
312-
--->
313-
该 pod 属于 `Guaranteed` QoS 类型,因其指定了 `limits` 值,同时当未显式指定时,`requests` 值被设置为与 `limits` 值相等。同时,容器对 CPU 资源的限制值是一个大于或等于 1 的整数值。所以,该 `nginx` 容器被赋予 2 个独占 CPU。
314-
307+
-->
308+
该 Pod 属于 `Guaranteed` QoS 类型,因其指定了 `limits` 值,同时当未显式指定时,
309+
`requests` 值被设置为与 `limits` 值相等。
310+
同时,容器对 CPU 资源的限制值是一个大于或等于 1 的整数值。
311+
所以,该 `nginx` 容器被赋予 2 个独占 CPU。
315312

0 commit comments

Comments
 (0)