Skip to content

Commit 2a88351

Browse files
committed
[zh] Add text to: extensible-admission-controllers.md
1 parent ee85349 commit 2a88351

File tree

1 file changed

+96
-21
lines changed

1 file changed

+96
-21
lines changed

content/zh-cn/docs/reference/access-authn-authz/extensible-admission-controllers.md

+96-21
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ API 服务器将发送的是 `admissionReviewVersions` 列表中所支持的第
733733
<!--
734734
### Response
735735
-->
736-
### 响应{#response}
736+
### 响应 {#response}
737737
738738
<!--
739739
Webhooks respond with a 200 HTTP status code, `Content-Type: application/json`,
@@ -2277,7 +2277,6 @@ admisson webhook should also be configured to intercept `CREATE` pod requests, a
22772277
container with name "foo-sidecar" with the expected configuration exists in the to-be-created
22782278
object.
22792279
-->
2280-
22812280
### 确保看到对象的最终状态 {#guaranteeing-the-final-state-of-the-object-is-seen}
22822281
22832282
如果某准入 Webhook 需要保证自己能够看到对象的最终状态以实施策略,
@@ -2294,31 +2293,107 @@ object.
22942293
<!--
22952294
### Avoiding deadlocks in self-hosted webhooks
22962295
2297-
A webhook running inside the cluster might cause deadlocks for its own deployment if it is configured
2298-
to intercept resources required to start its own pods.
2296+
There are several ways that webhooks can cause deadlocks, where the cluster cannot make progress in
2297+
scheduling pods:
2298+
2299+
* A webhook running inside the cluster might cause deadlocks for its own deployment if it is configured
2300+
to intercept resources required to start its own pods.
2301+
-->
2302+
### 避免自托管的 Webhook 中出现死锁 {#avoiding-deadlocks-in-self-hosted-webhooks}
2303+
2304+
有几种方式 Webhook 可能导致死锁,即集群无法在调度 Pod 时取得进展:
2305+
2306+
* 如果集群内的 Webhook 配置能够拦截启动其自己的 Pod 所需的资源,
2307+
则该 Webhook 可能导致其自身部署时发生死锁。
2308+
2309+
<!--
2310+
For example, a mutating admission webhook is configured to admit **create** Pod requests only if a certain label is set in the
2311+
pod (such as `env: "prod"`). However, the webhook server runs as a Deployment that doesn't set the `env` label.
2312+
When a node that runs the webhook server pods
2313+
becomes unhealthy, the webhook deployment will try to reschedule the pods to another node. However the requests will
2314+
get rejected by the existing webhook server since the `env` label is unset, and the replacement Pod
2315+
cannot be created. Eventually, the entire Deployment for the webhook server may become unhealthy.
2316+
-->
2317+
2318+
例如,某变更性质的准入 Webhook 配置为仅当 Pod 中设置了某个标签
2319+
(例如 `"env": "prod"`)时,才接受 **create** Pod 请求。
2320+
Webhook 服务器在未设置 `"env"` 标签的 Deployment 中运行。
2321+
当运行 Webhook 服务器 Pod 的节点运行不正常时,Webhook 部署尝试将容器重新调度到另一个节点。
2322+
但是,由于未设置 `"env"` 标签,因此请求将被现有的 Webhook 服务器拒绝,并替换 Pod 不会被创建。
2323+
最终,Webhook 服务器的整个 Deployment 可能变成不健康。
2324+
2325+
<!--
2326+
If you use admission webhooks to check Pods, consider excluding the namespace where your webhook
2327+
listener is running, by specifying a
2328+
[namespaceSelector](#matching-requests-namespaceselector).
2329+
-->
2330+
2331+
如果你使用准入 Webhook 来检查 Pod,建议通过指定
2332+
[namespaceSelector](#matching-requests-namespaceselector) 来排除正在运行 Webhook 侦听器的名字空间。
22992333
2300-
For example, a mutating admission webhook is configured to admit `CREATE` pod requests only if a certain label is set in the
2301-
pod (e.g. `"env": "prod"`). The webhook server runs in a deployment which doesn't set the `"env"` label.
2302-
When a node that runs the webhook server pods
2303-
becomes unhealthy, the webhook deployment will try to reschedule the pods to another node. However the requests will
2304-
get rejected by the existing webhook server since the `"env"` label is unset, and the migration cannot happen.
2334+
<!--
2335+
* If the cluster has multiple webhooks configured (possibly from independent applications deployed on
2336+
the cluster), they can form a cycle. Webhook A must be called to process startup of webhook B's
2337+
pods and vice versa. If both webhook A and webhook B ever become unavailable at the same time (for
2338+
example, due to a cluster-wide outage or a node failure where both pods run on the same node)
2339+
deadlock occurs because neither webhook pod can be recreated without the other already running.
2340+
-->
2341+
* 如果集群中配置了多个 Webhook(可能来自集群上部署的独立应用),这些 Webhook 可能形成一个循环。
2342+
Webhook A 必须被调用以处理 Webhook B 的 Pod 启动,反之亦然。
2343+
如果 Webhook A 和 B 同时变得不可用
2344+
(例如,由于集群范围的停机故障或两个 Pod 运行在同一个节点上时出现节点故障),
2345+
将发生死锁,这是因为没有一个 Webhook Pod 可以在另一个已经运行之前被重新创建。
23052346
2306-
It is recommended to exclude the namespace where your webhook is running with a
2307-
[namespaceSelector](#matching-requests-namespaceselector).
2347+
<!--
2348+
One way to prevent this is to exclude webhook A's pods from being acted on be webhook B. This
2349+
allows webhook A's pods to start, which in turn allows webhook B's pods to start. If you had a
2350+
third webhook, webhook C, you'd need to exclude both webhook A and webhook B's pods from
2351+
webhook C. This ensures that webhook A can _always_ start, which then allows webhook B's pods
2352+
to start, which in turn allows webhook C's pods to start.
2353+
-->
2354+
2355+
防止这种情况的一种方法是排除 Webhook B 对 Webhook A 的 Pod 的作用。
2356+
这允许 Webhook A 的 Pod 启动,进而允许 Webhook B 的 Pod 启动。
2357+
如果有第三个 Webhook,即 Webhook C,你需要排除 Webhook C 对 Webhook A 和 B 的 Pod 的作用。
2358+
这确保了 Webhook A 可以始终启动,从而允许 Webhook B 的 Pod 启动,进而允许 Webhook C 的 Pod 启动。
2359+
2360+
<!--
2361+
If you want to ensure protection that avoids these risks, [ValidatingAdmissionPolicies](/docs/reference/access-authn-authz/validating-admission-policy/)
2362+
can
2363+
provide many protection capabilities without introducing dependency cycles.
2364+
-->
2365+
2366+
如果你想确保避免这些风险,
2367+
[ValidatingAdmissionPolicies](/zh-cn/docs/reference/access-authn-authz/validating-admission-policy/)
2368+
可以提供许多保护能力,而不会引入依赖循环。
2369+
2370+
<!--
2371+
* Admission webhooks can intercept resources used by critical cluster add-ons, such as CoreDNS,
2372+
network plugins, or storage plugins. These add-ons may be required to schedule or successfully run the
2373+
pods for a particular admission webhook on the cluster. This can cause a deadlock if both the
2374+
webhook and critical add-on is unavailable at the same time.
23082375
-->
2309-
### 避免自托管的 Webhooks 中出现死锁 {#avoiding-deadlocks-in-self-hosted-webhooks}
2376+
* 准入 Webhook 可以拦截关键集群附加组件所使用的资源,例如 CoreDNS、网络插件或存储插件。
2377+
这些附加组件可能是调度或成功运行集群上特定准入 Webhook 的 Pod 所必需的。
2378+
如果 Webhook 和关键附加组件同时不可用,就可能导致死锁。
23102379
2311-
如果集群内的 Webhook 配置能够拦截启动其自己的 Pod 所需的资源,
2312-
则该 Webhook 可能导致其自身部署时发生死锁。
2380+
<!--
2381+
You may wish to exclude cluster infrastructure namespaces from webhooks, or make sure that
2382+
the webhook does not depend on the particular add-on that it acts on. For exmaple, running
2383+
a webhook as a host-networked pod ensures that it does not depend on a networking plugin.
2384+
2385+
If you want to ensure protection for a core add-on / or its namespace,
2386+
[ValidatingAdmissionPolicies](/docs/reference/access-authn-authz/validating-admission-policy/)
2387+
can
2388+
provide many protection capabilities without any dependency on worker nodes and Pods.
2389+
-->
23132390
2314-
例如,某变更性质的准入 Webhook 配置为仅当 Pod 中设置了某个标签
2315-
(例如 `"env": "prod"`)时,才接受 `CREATE` Pod 请求。
2316-
Webhook 服务器在未设置 `"env"` 标签的 Deployment 中运行。当运行 Webhook 服务器的
2317-
容器的节点运行不正常时,Webhook 部署尝试将容器重新调度到另一个节点。
2318-
但是,由于未设置 `"env"` 标签,因此请求将被现有的 Webhook 服务器拒绝,并且调度迁移不会发生。
2391+
你可能希望从 Webhook 中排除集群基础设施名字空间,或者确保 Webhook 不依赖于其作用的特定附加组件。
2392+
例如,作为主机网络 Pod 运行 Webhook 可以确保 Webhook 不依赖某个网络插件。
23192393
2320-
建议使用 [namespaceSelector](#matching-requests-namespaceselector) 排除
2321-
Webhook 所在的名字空间。
2394+
如果你想确保对核心附加组件或其名字空间的保护,
2395+
[ValidatingAdmissionPolicies](/zh-cn/docs/reference/access-authn-authz/validating-admission-policy/)
2396+
可以提供许多保护能力,而无需依赖于工作节点和 Pod。
23222397
23232398
<!--
23242399
### Side effects

0 commit comments

Comments
 (0)