Skip to content

Commit 96628b2

Browse files
authored
Merge pull request #41343 from windsonsea/asspod
[zh] assign-pod-node.md and api-eviction.md
2 parents 0556bd8 + cd6fdf0 commit 96628b2

File tree

2 files changed

+82
-19
lines changed

2 files changed

+82
-19
lines changed

content/zh-cn/docs/concepts/scheduling-eviction/api-eviction.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ You can use a [Kubernetes language client](/docs/tasks/administer-cluster/access
4242
to access the Kubernetes API and create an `Eviction` object. To do this, you
4343
POST the attempted operation, similar to the following example:
4444
-->
45-
## 调用 Eviction API
45+
## 调用 Eviction API {#calling-eviction-api}
4646

4747
你可以使用 [Kubernetes 语言客户端](/zh-cn/docs/tasks/administer-cluster/access-cluster-api/#programmatic-access-to-the-api)
4848
来访问 Kubernetes API 并创建 `Eviction` 对象。
@@ -73,7 +73,7 @@ POST the attempted operation, similar to the following example:
7373
<!--
7474
Deprecated in v1.22 in favor of `policy/v1`
7575
-->
76-
在 v1.22 版本废弃以支持 `policy/v1`
76+
在 v1.22 版本废弃以支持 `policy/v1`
7777
{{< /note >}}
7878

7979
```json
@@ -105,8 +105,7 @@ curl -v -H 'Content-type: application/json' https://your-cluster-api-endpoint.ex
105105
When you request an eviction using the API, the API server performs admission
106106
checks and responds in one of the following ways:
107107
-->
108-
109-
## API 发起驱逐的工作原理
108+
## API 发起驱逐的工作原理 {#how-api-initiated-eviction-works}
110109

111110
当你使用 API 来请求驱逐时,API 服务器将执行准入检查,并通过以下方式之一做出响应:
112111

@@ -122,7 +121,8 @@ checks and responds in one of the following ways:
122121
-->
123122
* `200 OK`:允许驱逐,子资源 `Eviction` 被创建,并且 Pod 被删除,
124123
类似于发送一个 `DELETE` 请求到 Pod 地址。
125-
* `429 Too Many Requests`:当前不允许驱逐,因为配置了 {{<glossary_tooltip term_id="pod-disruption-budget" text="PodDisruptionBudget">}}。
124+
* `429 Too Many Requests`:当前不允许驱逐,因为配置了
125+
{{<glossary_tooltip term_id="pod-disruption-budget" text="PodDisruptionBudget">}}。
126126
你可以稍后再尝试驱逐。你也可能因为 API 速率限制而看到这种响应。
127127
* `500 Internal Server Error`:不允许驱逐,因为存在配置错误,
128128
例如存在多个 PodDisruptionBudgets 引用同一个 Pod。
@@ -175,7 +175,7 @@ happen if, for example, a ReplicaSet creates pods for your application but new
175175
pods do not enter a `Ready` state. You may also notice this behavior in cases
176176
where the last evicted Pod had a long termination grace period.
177177
-->
178-
## 解决驱逐被卡住的问题
178+
## 解决驱逐被卡住的问题 {#troubleshooting-stuck-evictions}
179179

180180
在某些情况下,你的应用可能进入中断状态,
181181
在你干预之前,驱逐 API 总是返回 `429``500`
@@ -203,6 +203,6 @@ If you notice stuck evictions, try one of the following solutions:
203203
* Learn about [Node-pressure Eviction](/docs/concepts/scheduling-eviction/node-pressure-eviction/).
204204
* Learn about [Pod Priority and Preemption](/docs/concepts/scheduling-eviction/pod-priority-preemption/).
205205
-->
206-
* 了解如何使用 [Pod 干扰预算](/zh-cn/docs/tasks/run-application/configure-pdb/) 保护你的应用。
206+
* 了解如何使用 [Pod 干扰预算](/zh-cn/docs/tasks/run-application/configure-pdb/)保护你的应用。
207207
* 了解[节点压力引发的驱逐](/zh-cn/docs/concepts/scheduling-eviction/node-pressure-eviction/)
208208
* 了解 [Pod 优先级和抢占](/zh-cn/docs/concepts/scheduling-eviction/pod-priority-preemption/)

content/zh-cn/docs/concepts/scheduling-eviction/assign-pod-node.md

Lines changed: 75 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: 将 Pod 指派给节点
33
content_type: concept
44
weight: 20
55
---
6-
76
<!--
87
reviewers:
98
- davidopp
@@ -31,13 +30,12 @@ or to co-locate Pods from two different services that communicate a lot into the
3130
-->
3231
你可以约束一个 {{< glossary_tooltip text="Pod" term_id="pod" >}}
3332
以便 **限制** 其只能在特定的{{< glossary_tooltip text="节点" term_id="node" >}}上运行,
34-
或优先在特定的节点上运行。
35-
有几种方法可以实现这点,推荐的方法都是用
33+
或优先在特定的节点上运行。有几种方法可以实现这点,推荐的方法都是用
3634
[标签选择算符](/zh-cn/docs/concepts/overview/working-with-objects/labels/)来进行选择。
3735
通常这样的约束不是必须的,因为调度器将自动进行合理的放置(比如,将 Pod 分散到节点上,
3836
而不是将 Pod 放置在可用资源不足的节点上等等)。但在某些情况下,你可能需要进一步控制
3937
Pod 被部署到哪个节点。例如,确保 Pod 最终落在连接了 SSD 的机器上,
40-
或者将来自两个不同的服务且有大量通信的 Pods 被放置在同一个可用区。
38+
或者将来自两个不同的服务且有大量通信的 Pod 被放置在同一个可用区。
4139

4240
<!-- body -->
4341

@@ -94,7 +92,7 @@ properties.
9492
## 节点隔离/限制 {#node-isolation-restriction}
9593

9694
通过为节点添加标签,你可以准备让 Pod 调度到特定节点或节点组上。
97-
你可以使用这个功能来确保特定的 Pod 只能运行在具有一定隔离性安全性或监管属性的节点上。
95+
你可以使用这个功能来确保特定的 Pod 只能运行在具有一定隔离性安全性或监管属性的节点上。
9896

9997
<!--
10098
If you use labels for node isolation, choose label keys that the {{<glossary_tooltip text="kubelet" term_id="kubelet">}}
@@ -126,7 +124,7 @@ kubelet 使用 `node-restriction.kubernetes.io/` 前缀设置或修改标签。
126124
1. 确保你在使用[节点鉴权](/zh-cn/docs/reference/access-authn-authz/node/)机制并且已经启用了
127125
[NodeRestriction 准入插件](/zh-cn/docs/reference/access-authn-authz/admission-controllers/#noderestriction)
128126
2. 将带有 `node-restriction.kubernetes.io/` 前缀的标签添加到 Node 对象,
129-
然后在[节点选择器](#nodeSelector)中使用这些标签。
127+
然后在[节点选择算符](#nodeSelector)中使用这些标签。
130128
例如,`example.com.node-restriction.kubernetes.io/fips=true`
131129
`example.com.node-restriction.kubernetes.io/pci-dss=true`
132130

@@ -260,6 +258,12 @@ interpreting the rules. You can use `In`, `NotIn`, `Exists`, `DoesNotExist`,
260258
你可以使用 `operator` 字段来为 Kubernetes 设置在解释规则时要使用的逻辑操作符。
261259
你可以使用 `In``NotIn``Exists``DoesNotExist``Gt``Lt` 之一作为操作符。
262260

261+
<!--
262+
Read [Operators](#operators)
263+
to learn more about how these work.
264+
-->
265+
阅读[操作符](#operators)了解有关这些操作的更多信息。
266+
263267
<!--
264268
`NotIn` and `DoesNotExist` allow you to define node anti-affinity behavior.
265269
Alternatively, you can use [node taints](/docs/concepts/scheduling-eviction/taint-and-toleration/)
@@ -579,13 +583,20 @@ refer to the [design proposal](https://git.k8s.io/design-proposals-archive/sched
579583
<!--
580584
You can use the `In`, `NotIn`, `Exists` and `DoesNotExist` values in the
581585
`operator` field for Pod affinity and anti-affinity.
582-
583-
In principle, the `topologyKey` can be any allowed label key with the following
584-
exceptions for performance and security reasons:
585586
-->
586587
你可以针对 Pod 间亲和性与反亲和性为其 `operator` 字段使用 `In`、`NotIn`、`Exists`、
587588
`DoesNotExist` 等值。
588589

590+
<!--
591+
Read [Operators](#operators)
592+
to learn more about how these work.
593+
-->
594+
阅读[操作符](#operators)了解有关这些操作的更多信息。
595+
596+
<!--
597+
In principle, the `topologyKey` can be any allowed label key with the following
598+
exceptions for performance and security reasons:
599+
-->
589600
原则上,`topologyKey` 可以是任何合法的标签键。出于性能和安全原因,`topologyKey`
590601
有一些限制:
591602

@@ -613,9 +624,9 @@ If omitted or empty, `namespaces` defaults to the namespace of the Pod where the
613624
affinity/anti-affinity definition appears.
614625
-->
615626
除了 `labelSelector` 和 `topologyKey`,你也可以指定 `labelSelector`
616-
要匹配的命名空间列表,方法是在 `labelSelector` 和 `topologyKey`
627+
要匹配的名字空间列表,方法是在 `labelSelector` 和 `topologyKey`
617628
所在层同一层次上设置 `namespaces`。
618-
如果 `namespaces` 被忽略或者为空,则默认为 Pod 亲和性/反亲和性的定义所在的命名空间
629+
如果 `namespaces` 被忽略或者为空,则默认为 Pod 亲和性/反亲和性的定义所在的名字空间
619630

620631
<!--
621632
#### Namespace selector
@@ -869,6 +880,58 @@ to learn more about how these work.
869880
阅读 [Pod 拓扑分布约束](/zh-cn/docs/concepts/scheduling-eviction/topology-spread-constraints/)
870881
以进一步了解这些约束的工作方式。
871882

883+
<!--
884+
## Operators
885+
886+
The following are all the logical operators that you can use in the `operator` field for `nodeAffinity` and `podAffinity` mentioned above.
887+
-->
888+
## 操作符 {#operators}
889+
890+
下面是你可以在上述 `nodeAffinity` 和 `podAffinity` 的 `operator`
891+
字段中可以使用的所有逻辑运算符。
892+
893+
<!--
894+
| Operator | Behavior |
895+
| :------------: | :-------------: |
896+
| `In` | The label value is present in the supplied set of strings |
897+
| `NotIn` | The label value is not contained in the supplied set of strings |
898+
| `Exists` | A label with this key exists on the object |
899+
| `DoesNotExist` | No label with this key exists on the object |
900+
-->
901+
| 操作符 | 行为 |
902+
| :------------: | :-------------: |
903+
| `In` | 标签值存在于提供的字符串集中 |
904+
| `NotIn` | 标签值不包含在提供的字符串集中 |
905+
| `Exists` | 对象上存在具有此键的标签 |
906+
| `DoesNotExist` | 对象上不存在具有此键的标签 |
907+
908+
<!--
909+
The following operators can only be used with `nodeAffinity`.
910+
-->
911+
以下操作符只能与 `nodeAffinity` 一起使用。
912+
913+
<!--
914+
| Operator | Behaviour |
915+
| :------------: | :-------------: |
916+
| `Gt` | The supplied value will be parsed as an integer, and that integer is less than or equal to the integer that results from parsing the value of a label named by this selector |
917+
| `Lt` | The supplied value will be parsed as an integer, and that integer is greater than or equal to the integer that results from parsing the value of a label named by this selector |
918+
-->
919+
| 操作符 | 行为 |
920+
| :------------: | :-------------: |
921+
| `Gt` | 提供的值将被解析为整数,并且该整数小于等于通过解析此选择算符命名的标签的值所得到的整数 |
922+
| `Lt` | 提供的值将被解析为整数,并且该整数大于等于通过解析此选择算符命名的标签的值所得到的整数 |
923+
924+
{{<note>}}
925+
<!--
926+
`Gt` and `Lt` operators will not work with non-integer values. If the given value
927+
doesn't parse as an integer, the pod will fail to get scheduled. Also, `Gt` and `Lt`
928+
are not available for `podAffinity`.
929+
-->
930+
`Gt` 和 `Lt` 操作符不能与非整数值一起使用。
931+
如果给定的值未解析为整数,则该 Pod 将无法被调度。
932+
另外,`Gt` 和 `Lt` 不适用于 `podAffinity`。
933+
{{</note>}}
934+
872935
## {{% heading "whatsnext" %}}
873936

874937
<!--
@@ -882,7 +945,7 @@ to learn more about how these work.
882945
-->
883946
- 进一步阅读[污点与容忍度](/zh-cn/docs/concepts/scheduling-eviction/taint-and-toleration/)文档。
884947
- 阅读[节点亲和性](https://git.k8s.io/design-proposals-archive/scheduling/nodeaffinity.md)
885-
和[Pod 间亲和性与反亲和性](https://git.k8s.io/design-proposals-archive/scheduling/podaffinity.md)
948+
[Pod 间亲和性与反亲和性](https://git.k8s.io/design-proposals-archive/scheduling/podaffinity.md)
886949
的设计文档。
887950
- 了解[拓扑管理器](/zh-cn/docs/tasks/administer-cluster/topology-manager/)如何参与节点层面资源分配决定。
888951
- 了解如何使用 [nodeSelector](/zh-cn/docs/tasks/configure-pod-container/assign-pods-nodes/)。

0 commit comments

Comments
 (0)