Skip to content

Commit 2f4195b

Browse files
authored
Merge pull request #53046 from asa3311/sync-zh-200
[zh] sync topology-spread-constraints replicaset horizontal-pod-autoscale-walkthrough
2 parents cf8f7de + 9cac5c3 commit 2f4195b

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

content/zh-cn/docs/concepts/scheduling-eviction/topology-spread-constraints.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ spec:
133133
### 其他 Pod 字段置于此处
134134
```
135135

136+
{{< note >}}
137+
<!--
138+
There can only be one `topologySpreadConstraint` for a given `topologyKey` and `whenUnsatisfiable` value. For example, if you have defined a `topologySpreadConstraint` that uses the `topologyKey` "kubernetes.io/hostname" and `whenUnsatisfiable` value "DoNotSchedule", you can only add another `topologySpreadConstraint` for the `topologyKey` "kubernetes.io/hostname" if you use a different `whenUnsatisfiable` value.
139+
-->
140+
对于特定的 `topologyKey``whenUnsatisfiable` 值,只能有一个 `topologySpreadConstraint`
141+
例如,如果你已经定义了一个 `topologySpreadConstraint`,其 `topologyKey`
142+
为 "kubernetes.io/hostname",`whenUnsatisfiable` 值为 "DoNotSchedule",
143+
那么你在添加另一个 `topologyKey` 为 "kubernetes.io/hostname" 的 `topologySpreadConstraint`
144+
时,`whenUnsatisfiable` 需要使用不同的值。
145+
{{< /note >}}
146+
136147
<!--
137148
You can read more about this field by running `kubectl explain Pod.spec.topologySpreadConstraints` or
138149
refer to [scheduling](/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling) section of the API reference for Pod.
@@ -1025,6 +1036,26 @@ section of the enhancement proposal about Pod topology spread constraints.
10251036

10261037
你可以通过使用感知 Pod 拓扑分布约束并感知整个拓扑域集的节点自动扩缩工具来解决此问题。
10271038

1039+
<!--
1040+
- Pods that don't match their own labelSelector create "ghost pods". If a pod's
1041+
labels don't match the `labelSelector` in its topology spread constraint, the pod
1042+
won't count itself in spread calculations. This means:
1043+
- Multiple such pods can just accumulate on the same topology (until matching pods are newly created/deleted) because those pod's schedule don't change a spreading calculation result.
1044+
- The spreading constraint works in an unintended way, most likely not matching your expectations
1045+
1046+
Ensure your pod's labels match the `labelSelector` in your spread constraints.
1047+
Typically, a pod should match its own topology spread constraint selector.
1048+
-->
1049+
- 与自身的 labelSelector 不匹配的 Pod 会产生“幽灵 Pod”。
1050+
如果某个 Pod 的标签与其拓扑分布约束中的 `labelSelector` 不匹配,
1051+
那么该 Pod 无法参与拓扑分布的计算。这意味着:
1052+
- 这类 Pod 可能会持续堆积在同一个拓扑域上(直到新创建或删除了选择算符相匹配的 Pod),
1053+
因为这些 Pod 的调度不会改变分布计算结果。
1054+
- 分布约束会以非预期的方式工作,很可能与你的期望不一致。
1055+
1056+
请确保 Pod 的标签与分布约束中的 `labelSelector` 相匹配。
1057+
通常,Pod 应当能够匹配到它自己定义的拓扑分布约束选择算符。
1058+
10281059
## {{% heading "whatsnext" %}}
10291060

10301061
<!--

content/zh-cn/docs/concepts/workloads/controllers/replicaset.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ Alternatively, you can use the `kubectl autoscale` command to accomplish the sam
708708
或者,可以使用 `kubectl autoscale` 命令完成相同的操作(而且它更简单!)
709709

710710
```shell
711-
kubectl autoscale rs frontend --max=10 --min=3 --cpu-percent=50
711+
kubectl autoscale rs frontend --max=10 --min=3 --cpu=50%
712712
```
713713

714714
<!--

content/zh-cn/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Create the HorizontalPodAutoscaler:
174174
创建 HorizontalPodAutoscaler:
175175

176176
```shell
177-
kubectl autoscale deployment php-apache --cpu=50% --min=1 --max=10
177+
kubectl autoscale deployment php-apache --cpu-percent=50 --min=1 --max=10
178178
```
179179

180180
```

0 commit comments

Comments
 (0)