Skip to content

Commit 089040d

Browse files
committed
[zh] Sync changes from English site (7)
1 parent edbab98 commit 089040d

File tree

10 files changed

+498
-351
lines changed

10 files changed

+498
-351
lines changed
Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: 驱逐策略
3-
content_template: templates/concept
3+
content_type: concept
44
weight: 60
55
---
66
<!--
77
title: Eviction Policy
8-
content_template: templates/concept
8+
content_type: concept
99
weight: 60
1010
-->
1111

@@ -20,25 +20,28 @@ This page is an overview of Kubernetes' policy for eviction.
2020
<!--
2121
## Eviction Policy
2222
23-
The {{< glossary_tooltip text="Kubelet" term_id="kubelet" >}} can proactively monitor for and prevent total starvation of a
24-
compute resource. In those cases, the `kubelet` can reclaim the starved
25-
resource by proactively failing one or more Pods. When the `kubelet` fails
23+
The {{< glossary_tooltip text="kubelet" term_id="kubelet" >}} proactively monitors for
24+
and prevents total starvation of a compute resource. In those cases, the `kubelet` can reclaim
25+
the starved resource by failing one or more Pods. When the `kubelet` fails
2626
a Pod, it terminates all of its containers and transitions its `PodPhase` to `Failed`.
27-
If the evicted Pod is managed by a Deployment, the Deployment will create another Pod
27+
If the evicted Pod is managed by a Deployment, the Deployment creates another Pod
2828
to be scheduled by Kubernetes.
2929
-->
3030
## 驱逐策略 {#eviction-policy}
3131

32-
{{< glossary_tooltip text="Kubelet" term_id="kubelet" >}} 能够主动监测和防止计算资源的全面短缺。
33-
在资源短缺的情况下,`kubelet` 可以主动地结束一个或多个 Pod 以回收短缺的资源。
34-
`kubelet` 结束一个 Pod 时,它将终止 Pod 中的所有容器,而 Pod 的 `Phase` 将变为 `Failed`
35-
如果被驱逐的 Pod 由 Deployment 管理,这个 Deployment 会创建另一个 Pod 给 Kubernetes 来调度。
32+
{{< glossary_tooltip text="Kubelet" term_id="kubelet" >}} 主动监测和防止
33+
计算资源的全面短缺。在资源短缺时,`kubelet` 可以主动地结束一个或多个 Pod
34+
以回收短缺的资源。
35+
`kubelet` 结束一个 Pod 时,它将终止 Pod 中的所有容器,而 Pod 的 `Phase`
36+
将变为 `Failed`
37+
如果被驱逐的 Pod 由 Deployment 管理,这个 Deployment 会创建另一个 Pod 给
38+
Kubernetes 来调度。
3639

3740
## {{% heading "whatsnext" %}}
3841

3942
<!--
40-
- Read [Configure out of resource handling](/docs/tasks/administer-cluster/out-of-resource/) to learn more about eviction signals, thresholds, and handling.
43+
- Learn how to [configure out of resource handling](/docs/tasks/administer-cluster/out-of-resource/) with eviction signals and thresholds.
4144
-->
4245
- 阅读[配置资源不足的处理](/zh/docs/tasks/administer-cluster/out-of-resource/)
43-
进一步了解驱逐信号、阈值以及处理方法
46+
进一步了解驱逐信号和阈值
4447

content/zh/docs/concepts/scheduling-eviction/resource-bin-packing.md

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,25 @@ The kube-scheduler can be configured to enable bin packing of resources along wi
2626
<!--
2727
## Enabling Bin Packing using RequestedToCapacityRatioResourceAllocation
2828
29-
Before Kubernetes 1.15, Kube-scheduler used to allow scoring nodes based on the request to capacity ratio of primary resources like CPU and Memory. Kubernetes 1.16 added a new parameter to the priority function that allows the users to specify the resources along with weights for each resource to score nodes based on the request to capacity ratio. This allows users to bin pack extended resources by using appropriate parameters improves the utilization of scarce resources in large clusters. The behavior of the `RequestedToCapacityRatioResourceAllocation` priority function can be controlled by a configuration option called `requestedToCapacityRatioArguments`. This argument consists of two parameters `shape` and `resources`. Shape allows the user to tune the function as least requested or most requested based on `utilization` and `score` values. Resources
29+
Before Kubernetes 1.15, Kube-scheduler used to allow scoring nodes based on the request to capacity ratio of primary resources like CPU and Memory. Kubernetes 1.16 added a new parameter to the priority function that allows the users to specify the resources along with weights for each resource to score nodes based on the request to capacity ratio. This allows users to bin pack extended resources by using appropriate parameters and improves the utilization of scarce resources in large clusters. The behavior of the `RequestedToCapacityRatioResourceAllocation` priority function can be controlled by a configuration option called `requestedToCapacityRatioArguments`. This argument consists of two parameters `shape` and `resources`. Shape allows the user to tune the function as least requested or most requested based on `utilization` and `score` values. Resources
3030
consists of `name` which specifies the resource to be considered during scoring and `weight` specify the weight of each resource.
3131
-->
3232

3333
## 使用 RequestedToCapacityRatioResourceAllocation 启用装箱
3434

35-
在 Kubernetes 1.15 之前,Kube-scheduler 通常允许根据对主要资源(如 CPU 和内存)的请求数量和可用容量
36-
之比率对节点评分。
35+
在 Kubernetes 1.15 之前,Kube-scheduler 通常允许根据对主要资源(如 CPU 和内存)
36+
的请求数量和可用容量 之比率对节点评分。
3737
Kubernetes 1.16 在优先级函数中添加了一个新参数,该参数允许用户指定资源以及每类资源的权重,
3838
以便根据请求数量与可用容量之比率为节点评分。
3939
这就使得用户可以通过使用适当的参数来对扩展资源执行装箱操作,从而提高了大型集群中稀缺资源的利用率。
4040
`RequestedToCapacityRatioResourceAllocation` 优先级函数的行为可以通过名为
4141
`requestedToCapacityRatioArguments` 的配置选项进行控制。
4242
该标志由两个参数 `shape``resources` 组成。
43-
shape 允许用户根据 `utilization``score` 值将函数调整为最少请求(least requested)或
43+
`shape` 允许用户根据 `utilization``score` 值将函数调整为最少请求
44+
(least requested)或
4445
最多请求(most requested)计算。
45-
resources 由 `name``weight` 组成,`name` 指定评分时要考虑的资源,`weight` 指定每种资源的权重。
46+
`resources` 包含由 `name``weight` 组成,`name` 指定评分时要考虑的资源,
47+
`weight` 指定每种资源的权重。
4648

4749
<!--
4850
Below is an example configuration that sets `requestedToCapacityRatioArguments` to bin packing behavior for extended resources `intel.com/foo` and `intel.com/bar`
@@ -53,29 +55,29 @@ Below is an example configuration that sets `requestedToCapacityRatioArguments`
5355

5456
```json
5557
{
56-
"kind" : "Policy",
57-
"apiVersion" : "v1",
58-
...
59-
"priorities" : [
60-
...
61-
{
62-
"name": "RequestedToCapacityRatioPriority",
63-
"weight": 2,
64-
"argument": {
65-
"requestedToCapacityRatioArguments": {
66-
"shape": [
67-
{"utilization": 0, "score": 0},
68-
{"utilization": 100, "score": 10}
69-
],
70-
"resources": [
71-
{"name": "intel.com/foo", "weight": 3},
72-
{"name": "intel.com/bar", "weight": 5}
73-
]
74-
}
58+
"kind": "Policy",
59+
"apiVersion": "v1",
60+
...
61+
"priorities": [
62+
...
63+
{
64+
"name": "RequestedToCapacityRatioPriority",
65+
"weight": 2,
66+
"argument": {
67+
"requestedToCapacityRatioArguments": {
68+
"shape": [
69+
{"utilization": 0, "score": 0},
70+
{"utilization": 100, "score": 10}
71+
],
72+
"resources": [
73+
{"name": "intel.com/foo", "weight": 3},
74+
{"name": "intel.com/bar", "weight": 5}
75+
]
7576
}
7677
}
77-
],
78-
}
78+
}
79+
],
80+
}
7981
```
8082

8183
<!--
@@ -89,7 +91,6 @@ Below is an example configuration that sets `requestedToCapacityRatioArguments`
8991
9092
`shape` is used to specify the behavior of the `RequestedToCapacityRatioPriority` function.
9193
-->
92-
9394
### 调整 RequestedToCapacityRatioResourceAllocation 优先级函数
9495

9596
`shape` 用于指定 `RequestedToCapacityRatioPriority` 函数的行为。
@@ -103,8 +104,9 @@ Below is an example configuration that sets `requestedToCapacityRatioArguments`
103104
The above arguments give the node a score of 0 if utilization is 0% and 10 for utilization 100%, thus enabling bin packing behavior. To enable least requested the score value must be reversed as follows.
104105
-->
105106

106-
上面的参数在 utilization 为 0% 时给节点评分为 0,在 utilization 为 100% 时给节点评分为 10,
107-
因此启用了装箱行为。要启用最少请求(least requested)模式,必须按如下方式反转得分值。
107+
上面的参数在 `utilization` 为 0% 时给节点评分为 0,在 `utilization`
108+
100% 时给节点评分为 10,因此启用了装箱行为。
109+
要启用最少请求(least requested)模式,必须按如下方式反转得分值。
108110

109111
```yaml
110112
{"utilization": 0, "score": 100},

content/zh/docs/concepts/scheduling-eviction/scheduler-perf-tuning.md

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ You configure this tuning setting via kube-scheduler setting
5454
`percentageOfNodesToScore`. This KubeSchedulerConfiguration setting determines
5555
a threshold for scheduling nodes in your cluster.
5656
-->
57-
在大规模集群中,你可以调节调度器的表现来平衡调度的延迟(新 Pod 快速就位)和精度(调度器很少做出糟糕的放置决策)。
57+
在大规模集群中,你可以调节调度器的表现来平衡调度的延迟(新 Pod 快速就位)
58+
和精度(调度器很少做出糟糕的放置决策)。
5859

5960
你可以通过设置 kube-scheduler 的 `percentageOfNodesToScore` 来配置这个调优设置。
6061
这个 KubeSchedulerConfiguration 设置决定了调度集群中节点的阈值。
@@ -71,33 +72,32 @@ should use its compiled-in default.
7172
If you set `percentageOfNodesToScore` above 100, kube-scheduler acts as if you
7273
had set a value of 100.
7374
-->
74-
`percentageOfNodesToScore` 选项接受从 0 到 100 之间的整数值。0 值比较特殊,表示 kube-scheduler 应该使用其编译后的默认值。
75-
如果你设置 `percentageOfNodesToScore` 的值超过了 100,kube-scheduler 的表现等价于设置值为 100。
75+
`percentageOfNodesToScore` 选项接受从 0 到 100 之间的整数值。
76+
0 值比较特殊,表示 kube-scheduler 应该使用其编译后的默认值。
77+
如果你设置 `percentageOfNodesToScore` 的值超过了 100,
78+
kube-scheduler 的表现等价于设置值为 100。
7679

7780
<!--
7881
To change the value, edit the kube-scheduler configuration file (this is likely
7982
to be `/etc/kubernetes/config/kube-scheduler.yaml`), then restart the scheduler.
8083
-->
81-
要修改这个值,编辑 kube-scheduler 的配置文件(通常是 `/etc/kubernetes/config/kube-scheduler.yaml`),然后重启调度器。
84+
要修改这个值,编辑 kube-scheduler 的配置文件
85+
(通常是 `/etc/kubernetes/config/kube-scheduler.yaml`),
86+
然后重启调度器。
8287

8388
<!--
8489
After you have made this change, you can run
8590
-->
8691
修改完成后,你可以执行
92+
8793
```bash
88-
kubectl get componentstatuses
94+
kubectl get pods -n kube-system | grep kube-scheduler
8995
```
9096

9197
<!--
92-
to verify that the kube-scheduler component is healthy. The output is similar to:
98+
to verify that the kube-scheduler component is healthy.
9399
-->
94-
来检查该 kube-scheduler 组件是否健康。输出类似如下:
95-
```
96-
NAME STATUS MESSAGE ERROR
97-
controller-manager Healthy ok
98-
scheduler Healthy ok
99-
...
100-
```
100+
来检查该 kube-scheduler 组件是否健康。
101101

102102
<!--
103103
## Node scoring threshold {#percentage-of-nodes-to-score}
@@ -109,7 +109,8 @@ To improve scheduling performance, the kube-scheduler can stop looking for
109109
feasible nodes once it has found enough of them. In large clusters, this saves
110110
time compared to a naive approach that would consider every node.
111111
-->
112-
要提升调度性能,kube-scheduler 可以在找到足够的可调度节点之后停止查找。在大规模集群中,比起考虑每个节点的简单方法相比可以节省时间。
112+
要提升调度性能,kube-scheduler 可以在找到足够的可调度节点之后停止查找。
113+
在大规模集群中,比起考虑每个节点的简单方法相比可以节省时间。
113114

114115
<!--
115116
You specify a threshold for how many nodes are enough, as a whole number percentage
@@ -141,8 +142,8 @@ If you don't specify a threshold, Kubernetes calculates a figure using a
141142
linear formula that yields 50% for a 100-node cluster and yields 10%
142143
for a 5000-node cluster. The lower bound for the automatic value is 5%.
143144
-->
144-
如果你不指定阈值,Kubernetes 使用线性公式计算出一个比例,在 100-node 集群下取 50%,在 5000-node 的集群下取 10%。
145-
这个自动设置的参数的最低值是 5%。
145+
如果你不指定阈值,Kubernetes 使用线性公式计算出一个比例,在 100-节点集群
146+
下取 50%,在 5000-节点的集群下取 10%。这个自动设置的参数的最低值是 5%。
146147

147148
<!--
148149
This means that, the kube-scheduler always scores at least 5% of your cluster no
@@ -205,12 +206,14 @@ scheduler's performance significantly.
205206
{{< /note >}}
206207
-->
207208
{{< note >}}
208-
当集群中的可调度节点少于 50 个时,调度器仍然会去检查所有的 Node,因为可调度节点太少,不足以停止调度器最初的过滤选择。
209-
210-
同理,在小规模集群中,如果你将 `percentageOfNodesToScore` 设置为一个较低的值,则没有或者只有很小的效果。
209+
当集群中的可调度节点少于 50 个时,调度器仍然会去检查所有的 Node,
210+
因为可调度节点太少,不足以停止调度器最初的过滤选择。
211211

212-
如果集群只有几百个节点或者更少,请保持这个配置的默认值。改变基本不会对调度器的性能有明显的提升。
212+
同理,在小规模集群中,如果你将 `percentageOfNodesToScore` 设置为
213+
一个较低的值,则没有或者只有很小的效果。
213214

215+
如果集群只有几百个节点或者更少,请保持这个配置的默认值。
216+
改变基本不会对调度器的性能有明显的提升。
214217
{{< /note >}}
215218

216219
<!--
@@ -226,9 +229,15 @@ percentage to anything below 10%, unless the scheduler's throughput is critical
226229
for your application and the score of nodes is not important. In other words, you
227230
prefer to run the Pod on any Node as long as it is feasible.
228231
-->
229-
值得注意的是,该参数设置后可能会导致只有集群中少数节点被选为可调度节点,很多 node 都没有进入到打分阶段。这样就会造成一种后果,一个本来可以在打分阶段得分很高的 Node 甚至都不能进入打分阶段。
232+
值得注意的是,该参数设置后可能会导致只有集群中少数节点被选为可调度节点,
233+
很多节点都没有进入到打分阶段。这样就会造成一种后果,
234+
一个本来可以在打分阶段得分很高的节点甚至都不能进入打分阶段。
230235

231-
由于这个原因,这个参数不应该被设置成一个很低的值。通常的做法是不会将这个参数的值设置的低于 10。很低的参数值一般在调度器的吞吐量很高且对 node 的打分不重要的情况下才使用。换句话说,只有当你更倾向于在可调度节点中任意选择一个 Node 来运行这个 Pod 时,才使用很低的参数设置。
236+
由于这个原因,这个参数不应该被设置成一个很低的值。
237+
通常的做法是不会将这个参数的值设置的低于 10。
238+
很低的参数值一般在调度器的吞吐量很高且对节点的打分不重要的情况下才使用。
239+
换句话说,只有当你更倾向于在可调度节点中任意选择一个节点来运行这个 Pod 时,
240+
才使用很低的参数设置。
232241

233242
<!--
234243
### How the scheduler iterates over Nodes
@@ -250,14 +259,20 @@ Nodes as specified by `percentageOfNodesToScore`. For the next Pod, the
250259
scheduler continues from the point in the Node array that it stopped at when
251260
checking feasibility of Nodes for the previous Pod.
252261
-->
253-
在将 Pod 调度到 Node 上时,为了让集群中所有 Node 都有公平的机会去运行这些 Pod,调度器将会以轮询的方式覆盖全部的 Node。你可以将 Node 列表想象成一个数组。调度器从数组的头部开始筛选可调度节点,依次向后直到可调度节点的数量达到 `percentageOfNodesToScore` 参数的要求。在对下一个 Pod 进行调度的时候,前一个 Pod 调度筛选停止的 Node 列表的位置,将会来作为这次调度筛选 Node 开始的位置。
262+
在将 Pod 调度到节点上时,为了让集群中所有节点都有公平的机会去运行这些 Pod,
263+
调度器将会以轮询的方式覆盖全部的 Node。
264+
你可以将 Node 列表想象成一个数组。调度器从数组的头部开始筛选可调度节点,
265+
依次向后直到可调度节点的数量达到 `percentageOfNodesToScore` 参数的要求。
266+
在对下一个 Pod 进行调度的时候,前一个 Pod 调度筛选停止的 Node 列表的位置,
267+
将会来作为这次调度筛选 Node 开始的位置。
254268

255269
<!--
256270
If Nodes are in multiple zones, the scheduler iterates over Nodes in various
257271
zones to ensure that Nodes from different zones are considered in the
258272
feasibility checks. As an example, consider six nodes in two zones:
259273
-->
260-
如果集群中的 Node 在多个区域,那么调度器将从不同的区域中轮询 Node,来确保不同区域的 Node 接受可调度性检查。如下例,考虑两个区域中的六个节点:
274+
如果集群中的 Node 在多个区域,那么调度器将从不同的区域中轮询 Node,
275+
来确保不同区域的 Node 接受可调度性检查。如下例,考虑两个区域中的六个节点:
261276

262277
```
263278
Zone 1: Node 1, Node 2, Node 3, Node 4
@@ -278,4 +293,3 @@ After going over all the Nodes, it goes back to Node 1.
278293
-->
279294
在评估完所有 Node 后,将会返回到 Node 1,从头开始。
280295
281-

0 commit comments

Comments
 (0)