Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: [zh] sync pod-scheduling-readiness.md #37986

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions content/zh-cn/docs/concepts/scheduling-eviction/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ of terminating one or more Pods on Nodes.
* [Scheduling Framework](/docs/concepts/scheduling-eviction/scheduling-framework)
* [Scheduler Performance Tuning](/docs/concepts/scheduling-eviction/scheduler-perf-tuning/)
* [Resource Bin Packing for Extended Resources](/docs/concepts/scheduling-eviction/resource-bin-packing/)
* [Pod Scheduling Readiness](/docs/concepts/scheduling-eviction/pod-scheduling-readiness/)
-->

## 调度
Expand All @@ -60,6 +61,7 @@ of terminating one or more Pods on Nodes.
* [调度框架](/zh-cn/docs/concepts/scheduling-eviction/scheduling-framework)
* [调度器性能调试](/zh-cn/docs/concepts/scheduling-eviction/scheduler-perf-tuning/)
* [扩展资源的资源装箱](/zh-cn/docs/concepts/scheduling-eviction/resource-bin-packing/)
* [Pod 调度就绪状态](/zh-cn/docs/concepts/scheduling-eviction/pod-scheduling-readiness/)

<!--
## Pod Disruption
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
---
title: Pod 调度就绪状态
content_type: concept
weight: 40
---

<!--
---
title: Pod Scheduling Readiness
content_type: concept
weight: 40
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 8 and line 12 can be removed together.

-->

<!-- overview -->

{{< feature-state for_k8s_version="v1.26" state="alpha" >}}

<!--
Pods were considered ready for scheduling once created. Kubernetes scheduler
does its due diligence to find nodes to place all pending Pods. However, in a
real-world case, some Pods may stay in a "miss-essential-resources" state for a long period.
These Pods actually churn the scheduler (and downstream integrators like Cluster AutoScaler)
in an unnecessary manner.
-->
之前,Pod 一旦创建就被认为可以进行调度。Kubernetes调度器会尽职尽责地寻找节点来放置所有待定的Pod。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
之前,Pod 一旦创建就被认为可以进行调度。Kubernetes调度器会尽职尽责地寻找节点来放置所有待定的Pod
之前,Pod 一旦创建就被认为可以进行调度。Kubernetes 调度器会尽职尽责地寻找节点来放置所有待定的 Pod

然而,在现实场景中,一些 Pod 可能会长期处于“缺失必要资源”状态。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
然而,在现实场景中,一些 Pod 可能会长期处于“缺失必要资源”状态。
然而,在现实场景中,一些 Pod 可能会长期处于“缺失必要资源(missing-essential-resources)”状态。

这些 Pod 实际上在以不必要的方式搅动调度器(和下游集成商,如Cluster AutoScaler)。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
这些 Pod 实际上在以不必要的方式搅动调度器(和下游集成商,如Cluster AutoScaler)。
这些 Pod 实际上在以不必要的方式搅动调度器(和下游集成服务,如 Cluster AutoScaler)。


<!--
By specifying/removing a Pod's `.spec.schedulingGates`, you can control when a Pod is ready
to be considered for scheduling.
-->
通过指定/删除一个 Pod 的 `.spec.schedulingGates` ,你可以控制一个 Pod 何时准备被进行调度。

<!-- body -->

<!--
## Configuring Pod schedulingGates
-->
## 配置 Pod 的调度门控
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 配置 Pod 的调度门控
## 配置 Pod 的 schedulingGates {#configuring-pod-schedulinggates}


<!--
The `schedulingGates` field contains a list of strings, and each string literal is perceived as a
criteria that Pod should be satisfied before considered schedulable. This field can be initialized
only when a Pod is created (either by the client, or mutated during admission). After creation,
each schedulingGate can be removed in arbitrary order, but addition of a new scheduling gate is disallowed.
-->

`schedulingGates` 字段包含一个字符串列表,每个字符串都为 Pod 在可调度之前应该满足的准则。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`schedulingGates` 字段包含一个字符串列表,每个字符串都为 Pod 在可调度之前应该满足的准则
`schedulingGates` 字段包含一个字符串列表,每个字符串都被视为 Pod 在可调度之前应该满足的一个条件

这个字段只能在 Pod 被创建时(由客户端创建,或在准入过程中突变)初始化。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
这个字段只能在 Pod 被创建时(由客户端创建,或在准入过程中突变)初始化。
这个字段只能在 Pod 被创建时(由客户端创建,或在准入过程中变更)初始化。

在创建之后,每个调度门控可以按任意顺序被删除,但不允许增加新的调度门控。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
在创建之后,每个调度门控可以按任意顺序被删除,但不允许增加新的调度门控。
在创建之后,各个 schedulingGate 可以按任意顺序被删除,但不允许增加新的调度门控。


{{<mermaid>}}
stateDiagram-v2
s1: pod 创建
s2: pod 调度受阻
s3: pod 调度就绪
s4: pod 运行
if: 空的调度门控?
state if <<choice>>
[*] --> s1
s1 --> if
s2 --> if: 调度门控被移除
if --> s2: 否
if --> s3: 是
s3 --> s4
s4 --> [*]
{{< /mermaid >}}

<!--
## Usage example
-->
## 使用示例
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 使用示例
## 用法示例 {#usage-example}


<!--
To mark a Pod not-ready for scheduling, you can create it with one or more scheduling gates like this:

{{< codenew file="pods/pod-with-scheduling-gates.yaml" >}}

After the Pod's creation, you can check its state using:
-->
要标记一个 Pod 未调度就绪,你可以像这样创建它,其中包含一个或多个调度门控:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
要标记一个 Pod 未调度就绪,你可以像这样创建它,其中包含一个或多个调度门控
要标记一个 Pod 未调度就绪,你可以在创建 Pod 时设置一个或多个调度门控,像这样


{{< codenew file="pods/pod-with-scheduling-gates.yaml" >}}

创建 Pod 之后,你可以使用以下命令检查其状态:

```bash
kubectl get pod test-pod
```

<!--
The output reveals it's in `SchedulingGated` state:
-->
输出显示它处于 `SchedulingGated` 状态:

```none
NAME READY STATUS RESTARTS AGE
test-pod 0/1 SchedulingGated 0 7s
```

<!--
You can also check its `schedulingGates` field by running:
-->
你也可以通过运行以下命令检查其 `schedulingGates` 字段:

```bash
kubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'
```

<!--
The output is:
-->
输出:

```none
[{"name":"foo"},{"name":"bar"}]
```

<!--
To inform scheduler this Pod is ready for scheduling, you can remove its `schedulingGates` entirely
by re-applying a modified manifest:

{{< codenew file="pods/pod-without-scheduling-gates.yaml" >}}

You can check if the `schedulingGates` is cleared by running:
-->
要通知调度器这个 Pod 已经准备好进行调度,你可以通过重新应用修改过的清单来完全删除其 `schedulingGates` :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
要通知调度器这个 Pod 已经准备好进行调度,你可以通过重新应用修改过的清单来完全删除其 `schedulingGates`
要通知调度器这个 Pod 已经准备好进行调度,你可以通过重新应用修改过的清单来彻底删除其 `schedulingGates`


{{< codenew file="pods/pod-without-scheduling-gates.yaml" >}}

你可以通过运行以下命令检查 `schedulingGates` 是否已被清除:

```bash
kubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'
```

<!--
The output is expected to be empty. And you can check its latest status by running:
-->
输出应该为空。你可以通过运行以下命令检查其最新状态:

```bash
kubectl get pod test-pod -o wide
```

<!--
Given the test-pod doesn't request any CPU/memory resources, it's expected that this Pod's state get
transited from previous `SchedulingGated` to `Running`:
-->
考虑到 test-pod 没有请求任何 CPU/内存资源,预期这个 Pod 的状态从之前的 `SchedulingGated` 转换为 `Running` :

```none
NAME READY STATUS RESTARTS AGE IP NODE
test-pod 1/1 Running 0 15s 10.0.0.4 node-2
```

<!--
## Observability
-->
## 可观测性 (Observability)

<!--
The metric `scheduler_pending_pods` comes with a new label `"gated"` to distinguish whether a Pod
has been tried scheduling but claimed as unschedulable, or explicitly marked as not ready for
scheduling. You can use `scheduler_pending_pods{queue="gated"}` to check the metric result.
-->
指标 `scheduler_pending_pods` 带有一个新的标签 `"gated"` ,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多一空格

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
指标 `scheduler_pending_pods` 带有一个新的标签 `"gated"`
指标 `scheduler_pending_pods` 带有一个新的标签 `"gated"`

用于区分 Pod 是否已经尝试调度但被声明为不可调度,或者是否被显式标记为未准备好调度。
你可以使用 `scheduler_pending_pods{queue="gated"}` 来检查指标结果。

## {{% heading "whatsnext" %}}

<!--
* Read the [PodSchedulingReadiness KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-scheduling/3521-pod-scheduling-readiness) for more details
-->
* 阅读 [Pod 调度就绪状态 KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-scheduling/3521-pod-scheduling-readiness) 以了解更多细节
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ For a reference to old feature gates that are removed, please refer to
| `PodDeletionCost` | `true` | Beta | 1.22 | |
| `PodDisruptionConditions` | `false` | Alpha | 1.25 | - |
| `PodHasNetworkCondition` | `false` | Alpha | 1.25 | |
| `PodSchedulingReadiness` | `false` | Alpha | 1.26 | |
| `ProbeTerminationGracePeriod` | `false` | Alpha | 1.21 | 1.21 |
| `ProbeTerminationGracePeriod` | `false` | Beta | 1.22 | 1.24 |
| `ProbeTerminationGracePeriod` | `true` | Beta | 1.25 | |
Expand Down
11 changes: 11 additions & 0 deletions content/zh-cn/examples/pods/pod-with-scheduling-gates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Pod
metadata:
name: test-pod
spec:
schedulingGates:
- name: foo
- name: bar
containers:
- name: pause
image: registry.k8s.io/pause:3.6
8 changes: 8 additions & 0 deletions content/zh-cn/examples/pods/pod-without-scheduling-gates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Pod
metadata:
name: test-pod
spec:
containers:
- name: pause
image: registry.k8s.io/pause:3.6