Skip to content

Commit ca666c8

Browse files
authored
Merge pull request #34777 from tengqm/zh-resync-admission-controllers
[zh-cn] Resync admission controllers page
2 parents ecca63a + 2b9f8c5 commit ca666c8

File tree

1 file changed

+52
-62
lines changed

1 file changed

+52
-62
lines changed

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

Lines changed: 52 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ which are configured in the API.
4747
并编译进 `kube-apiserver` 可执行文件,并且只能由集群管理员配置。
4848
在该列表中,有两个特殊的控制器:MutatingAdmissionWebhook 和 ValidatingAdmissionWebhook。
4949
它们根据 API 中的配置,分别执行变更和验证
50-
[准入控制 webhook](/zh/docs/reference/access-authn-authz/extensible-admission-controllers/#admission-webhooks)
50+
[准入控制 webhook](/zh-cn/docs/reference/access-authn-authz/extensible-admission-controllers/#admission-webhooks)
5151

5252
<!--
5353
Admission controllers may be "validating", "mutating", or both. Mutating
@@ -88,29 +88,27 @@ other admission controllers.
8888

8989
<!--
9090
## Why do I need them?
91-
-->
92-
## 为什么需要准入控制器? {#why-do-i-need-them}
9391
94-
<!--
9592
Many advanced features in Kubernetes require an admission controller to be enabled in order
9693
to properly support the feature. As a result, a Kubernetes API server that is not properly
9794
configured with the right set of admission controllers is an incomplete server and will not
9895
support all the features you expect.
9996
-->
97+
## 为什么需要准入控制器? {#why-do-i-need-them}
98+
10099
Kubernetes 的许多高级功能都要求启用一个准入控制器,以便正确地支持该特性。
101100
因此,没有正确配置准入控制器的 Kubernetes API 服务器是不完整的,它无法支持你所期望的所有特性。
102101

103102
<!--
104103
## How do I turn on an admission controller?
105-
-->
106104
107-
## 如何启用一个准入控制器? {#how-do-i-turn-on-an-admission-controller}
108105
109-
<!--
110106
The Kubernetes API server flag `enable-admission-plugins` takes a comma-delimited list of admission control plugins to invoke prior to modifying objects in the cluster.
111107
For example, the following command line enables the `NamespaceLifecycle` and the `LimitRanger`
112108
admission control plugins:
113109
-->
110+
## 如何启用一个准入控制器? {#how-do-i-turn-on-an-admission-controller}
111+
114112
Kubernetes API 服务器的 `enable-admission-plugins` 标志接受一个(以逗号分隔的)准入控制插件列表,
115113
这些插件会在集群修改对象之前被调用。
116114

@@ -163,7 +161,6 @@ kube-apiserver -h | grep enable-admission-plugins
163161
<!--
164162
In the current version, the default ones are:
165163
-->
166-
167164
在目前版本中,默认启用的插件有:
168165

169166
```
@@ -226,7 +223,7 @@ See [Certificate Signing Requests](/docs/reference/access-authn-authz/certificat
226223
information on the permissions required to perform different actions on CertificateSigningRequest resources.
227224
-->
228225
有关对 CertificateSigningRequest 资源执行不同操作所需权限的详细信息,
229-
请参阅[证书签名请求](/zh/docs/reference/access-authn-authz/certificate-signing-requests/)
226+
请参阅[证书签名请求](/zh-cn/docs/reference/access-authn-authz/certificate-signing-requests/)
230227

231228
### CertificateSigning {#certificatesigning}
232229

@@ -244,7 +241,7 @@ See [Certificate Signing Requests](/docs/reference/access-authn-authz/certificat
244241
information on the permissions required to perform different actions on CertificateSigningRequest resources.
245242
-->
246243
有关对 CertificateSigningRequest 资源执行不同操作所需权限的详细信息,
247-
请参阅[证书签名请求](/zh/docs/reference/access-authn-authz/certificate-signing-requests/)
244+
请参阅[证书签名请求](/zh-cn/docs/reference/access-authn-authz/certificate-signing-requests/)
248245

249246
### CertificateSubjectRestriction {#certificatesubjectrestriction}
250247

@@ -286,7 +283,7 @@ See the [ingress](/docs/concepts/services-networking/ingress/) documentation for
286283
classes and how to mark one as default.
287284
-->
288285
关于 Ingress 类以及如何将 Ingress 类标记为默认的更多信息,请参见
289-
[Ingress](/zh/docs/concepts/services-networking/ingress/) 页面。
286+
[Ingress](/zh-cn/docs/concepts/services-networking/ingress/) 页面。
290287

291288
### DefaultStorageClass {#defaultstorageclass}
292289

@@ -315,7 +312,7 @@ This admission controller ignores any `PersistentVolumeClaim` updates; it acts o
315312
See [persistent volume](/docs/concepts/storage/persistent-volumes/) documentation about persistent volume claims and
316313
storage classes and how to mark a storage class as default.
317314
-->
318-
关于持久卷申领和存储类,以及如何将存储类标记为默认,请参见[持久卷](/zh/docs/concepts/storage/persistent-volumes/)页面。
315+
关于持久卷申领和存储类,以及如何将存储类标记为默认,请参见[持久卷](/zh-cn/docs/concepts/storage/persistent-volumes/)页面。
319316

320317
### DefaultTolerationSeconds {#defaulttolerationseconds}
321318

@@ -477,7 +474,7 @@ See the [EventRateLimit Config API (v1alpha1)](/docs/reference/config-api/apiser
477474
for more details.
478475
-->
479476
详情请参见
480-
[EventRateLimit 配置 API 文档(v1alpha1)](/zh/docs/reference/config-api/apiserver-eventratelimit.v1alpha1/)。
477+
[EventRateLimit 配置 API 文档(v1alpha1)](/zh-cn/docs/reference/config-api/apiserver-eventratelimit.v1alpha1/)。
481478
482479
### ExtendedResourceToleration {#extendedresourcetoleration}
483480
@@ -491,7 +488,7 @@ add these tolerations.
491488
-->
492489
此插件有助于创建带有扩展资源的专用节点。
493490
如果运维人员想要创建带有扩展资源(如 GPU、FPGA 等)的专用节点,他们应该以扩展资源名称作为键名,
494-
[为节点设置污点](/zh/docs/concepts/scheduling-eviction/taint-and-toleration/)。
491+
[为节点设置污点](/zh-cn/docs/concepts/scheduling-eviction/taint-and-toleration/)。
495492
如果启用了此准入控制器,会将此类污点的容忍度自动添加到请求扩展资源的 Pod 中,
496493
用户不必再手动添加这些容忍度。
497494
@@ -504,13 +501,12 @@ ImagePolicyWebhook 准入控制器允许使用后端 Webhook 做出准入决策
504501
505502
<!--
506503
#### Configuration File Format
507-
-->
508-
#### 配置文件格式 {#configuration-file-format}
509504
510-
<!--
511505
ImagePolicyWebhook uses a configuration file to set options for the behavior of the backend.
512506
This file may be json or yaml and has the following format:
513507
-->
508+
#### 配置文件格式 {#configuration-file-format}
509+
514510
ImagePolicyWebhook 使用配置文件来为后端行为设置选项。该文件可以是 JSON 或 YAML,
515511
并具有以下格式:
516512
@@ -568,7 +564,7 @@ formatted file which sets up the connection to the backend.
568564
It is required that the backend communicate over TLS.
569565
-->
570566
ImagePolicyWebhook 的配置文件必须引用
571-
[kubeconfig](/zh/docs/tasks/access-application-cluster/configure-access-multiple-clusters/)
567+
[kubeconfig](/zh-cn/docs/tasks/access-application-cluster/configure-access-multiple-clusters/)
572568
格式的文件;该文件用来设置与后端的连接。要求后端使用 TLS 进行通信。
573569

574570
<!--
@@ -616,20 +612,19 @@ For additional HTTP configuration, refer to the
616612
[kubeconfig](/docs/tasks/access-application-cluster/configure-access-multiple-clusters/) documentation.
617613
-->
618614
关于 HTTP 配置的更多信息,请参阅
619-
[kubeconfig](/zh/docs/tasks/access-application-cluster/configure-access-multiple-clusters/)
615+
[kubeconfig](/zh-cn/docs/tasks/access-application-cluster/configure-access-multiple-clusters/)
620616
文档。
621617

622618
<!--
623619
#### Request payloads
624-
-->
625-
#### 请求载荷
626620

627-
<!--
628621
When faced with an admission decision, the API Server POSTs a JSON serialized
629622
`imagepolicy.k8s.io/v1alpha1` `ImageReview` object describing the action.
630623
This object contains fields describing the containers being admitted, as well as
631624
any pod annotations that match `*.image-policy.k8s.io/*`.
632625
-->
626+
#### 请求载荷 {#request-payloads}
627+
633628
当面对一个准入决策时,API 服务器发送一个描述操作的 JSON 序列化的
634629
`imagepolicy.k8s.io/v1alpha1` `ImageReview` 对象。
635630
该对象包含描述被准入容器的字段,以及与 `*.image-policy.k8s.io/*` 匹配的所有 Pod 注解。
@@ -714,33 +709,31 @@ To disallow access, the service would return:
714709
For further documentation refer to the
715710
[`imagepolicy.v1alpha1` API](/docs/reference/config-api/imagepolicy.v1alpha1/).
716711
-->
717-
更多的文档,请参阅 [`imagepolicy.v1alpha1` API](/zh/docs/reference/config-api/imagepolicy.v1alpha1/)。
712+
更多的文档,请参阅 [`imagepolicy.v1alpha1` API](/zh-cn/docs/reference/config-api/imagepolicy.v1alpha1/)。
718713

719714
<!--
720715
#### Extending with Annotations
721-
-->
722-
#### 使用注解进行扩展 {#extending-with-annotations}
723716

724-
<!--
725717
All annotations on a Pod that match `*.image-policy.k8s.io/*` are sent to the webhook.
726718
Sending annotations allows users who are aware of the image policy backend to
727719
send extra information to it, and for different backends implementations to
728720
accept different information.
729721
-->
722+
#### 使用注解进行扩展 {#extending-with-annotations}
723+
730724
一个 Pod 中匹配 `*.image-policy.k8s.io/*` 的注解都会被发送给 Webhook。
731725
这样做使得了解后端镜像策略的用户可以向它发送额外的信息,
732726
并让不同的后端实现接收不同的信息。
733727

734728
<!--
735729
Examples of information you might put here are:
736-
-->
737-
你可以在这里输入的信息有:
738730

739-
<!--
740731
* request to "break glass" to override a policy, in case of emergency.
741732
* a ticket number from a ticket system that documents the break-glass request
742733
* provide a hint to the policy server as to the imageID of the image being provided, to save it a lookup
743734
-->
735+
你可以在这里输入的信息有:
736+
744737
* 在紧急情况下,请求破例覆盖某个策略。
745738
* 从一个记录了破例的请求的工单(Ticket)系统得到的一个工单号码。
746739
* 向策略服务器提供提示信息,用于提供镜像的 imageID,以方便它进行查找。
@@ -780,8 +773,8 @@ and the [example of LimitRange](/docs/tasks/administer-cluster/manage-resources/
780773
for more details.
781774
-->
782775
请查看
783-
[limitRange API 文档](/zh/docs/reference/kubernetes-api/policy-resources/limit-range-v1/)和
784-
[LimitRange 例子](/zh/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/)以了解更多细节。
776+
[limitRange API 文档](/zh-cn/docs/reference/kubernetes-api/policy-resources/limit-range-v1/)和
777+
[LimitRange 例子](/zh-cn/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/)以了解更多细节。
785778

786779
### MutatingAdmissionWebhook {#mutatingadmissionwebhook}
787780

@@ -993,7 +986,7 @@ allowVolumeExpansion: true
993986
For more information about persistent volume claims, see [PersistentVolumeClaims](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims).
994987
-->
995988
关于持久化卷申领的更多信息,请参见
996-
[PersistentVolumeClaim](/zh/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims)。
989+
[PersistentVolumeClaim](/zh-cn/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims)。
997990

998991
### PersistentVolumeLabel {#persistentvolumelabel}
999992

@@ -1037,7 +1030,8 @@ This file may be json or yaml and has the following format:
10371030
-->
10381031
#### 配置文件格式 {#configuration-file-format-podnodeselector}
10391032

1040-
`PodNodeSelector` 使用配置文件来设置后端行为的选项。请注意,配置文件格式将在将来某个版本中改为版本化文件。
1033+
`PodNodeSelector` 使用配置文件来设置后端行为的选项。
1034+
请注意,配置文件格式将在将来某个版本中改为版本化文件。
10411035
该文件可以是 JSON 或 YAML,格式如下:
10421036

10431037
```yaml
@@ -1134,10 +1128,10 @@ for more information.
11341128
-->
11351129
这是下节所讨论的已被废弃的 [PodSecurityPolicy](#podsecuritypolicy) 准入控制器的替代品。
11361130
此准入控制器负责在创建和修改 Pod 时,根据请求的安全上下文和
1137-
[Pod 安全标准](/zh/docs/concepts/security/pod-security-standards/)
1131+
[Pod 安全标准](/zh-cn/docs/concepts/security/pod-security-standards/)
11381132
来确定是否可以执行请求。
11391133

1140-
更多信息请参阅 [Pod 安全性准入控制器](/zh/docs/concepts/security/pod-security-admission/)。
1134+
更多信息请参阅 [Pod 安全性准入控制器](/zh-cn/docs/concepts/security/pod-security-admission/)。
11411135

11421136
### PodSecurityPolicy {#podsecuritypolicy}
11431137

@@ -1154,8 +1148,7 @@ based on the requested security context and the available Pod Security Policies.
11541148
See also the [PodSecurityPolicy](/docs/concepts/security/pod-security-policy/) documentation
11551149
for more information.
11561150
-->
1157-
查看 [Pod 安全策略文档](/zh/docs/concepts/security/pod-security-policy/)
1158-
进一步了解其间细节。
1151+
查看 [Pod 安全策略文档](/zh-cn/docs/concepts/security/pod-security-policy/)进一步了解其间细节。
11591152

11601153
### PodTolerationRestriction {#podtolerationrestriction}
11611154

@@ -1234,15 +1227,14 @@ See the [ResourceQuota API reference](/docs/reference/kubernetes-api/policy-reso
12341227
and the [example of Resource Quota](/docs/concepts/policy/resource-quotas/) for more details.
12351228
-->
12361229
请参阅
1237-
[resourceQuota API 参考](/zh/docs/reference/kubernetes-api/policy-resources/resource-quota-v1/)
1238-
和 [Resource Quota 例子](/zh/docs/concepts/policy/resource-quotas/)了解更多细节。
1239-
1230+
[resourceQuota API 参考](/zh-cn/docs/reference/kubernetes-api/policy-resources/resource-quota-v1/)
1231+
和 [Resource Quota 例子](/zh-cn/docs/concepts/policy/resource-quotas/)了解更多细节。
12401232

1241-
<!--
12421233
### RuntimeClass {#runtimeclass}
12431234

12441235
{{< feature-state for_k8s_version="v1.20" state="stable" >}}
12451236

1237+
<!--
12461238
If you define a RuntimeClass with [Pod overhead](/docs/concepts/scheduling-eviction/pod-overhead/)
12471239
configured, this admission controller checks incoming Pods.
12481240
When enabled, this admission controller rejects any Pod create requests
@@ -1254,16 +1246,13 @@ defined in the corresponding RuntimeClass.
12541246
See also [Pod Overhead](/docs/concepts/scheduling-eviction/pod-overhead/)
12551247
for more information.
12561248
-->
1257-
### RuntimeClass {#runtimeclass}
1258-
1259-
{{< feature-state for_k8s_version="v1.20" state="stable" >}}
1260-
1261-
如果你所定义的 RuntimeClass 包含 [Pod 开销](/zh/docs/concepts/scheduling-eviction/pod-overhead/),
1262-
这个准入控制器会检查新的 Pod。被启用后,此准入控制器会拒绝所有已经设置了 overhead 字段的 Pod 创建请求。
1249+
如果你所定义的 RuntimeClass 包含 [Pod 开销](/zh-cn/docs/concepts/scheduling-eviction/pod-overhead/),
1250+
这个准入控制器会检查新的 Pod。
1251+
被启用后,此准入控制器会拒绝所有已经设置了 overhead 字段的 Pod 创建请求。
12631252
对于配置了 RuntimeClass 并在其 `.spec` 中选定 RuntimeClass 的 Pod,
12641253
此准入控制器会根据相应 RuntimeClass 中定义的值为 Pod 设置 `.spec.overhead`。
12651254

1266-
详情请参见 [Pod 开销](/zh/docs/concepts/scheduling-eviction/pod-overhead/)。
1255+
详情请参见 [Pod 开销](/zh-cn/docs/concepts/scheduling-eviction/pod-overhead/)。
12671256

12681257
### SecurityContextDeny {#securitycontextdeny}
12691258

@@ -1276,20 +1265,21 @@ task.
12761265
If you don't use [Pod Security admission](/docs/concepts/security/pod-security-admission/),
12771266
[PodSecurityPolicies](/docs/concepts/security/pod-security-policy/), nor any external enforcement mechanism,
12781267
then you could use this admission controller to restrict the set of values a security context can take.
1279-
1280-
See [Pod Security Standards](/docs/concepts/security/pod-security-standards/) for more context on restricting
1281-
pod privileges.
12821268
-->
12831269
此准入控制器将拒绝任何试图设置特定提升
1284-
[SecurityContext](/zh/docs/tasks/configure-pod-container/security-context/)
1285-
中某些字段的 Pod,正如任务[为 Pod 或 Container 配置安全上下文](/zh/docs/tasks/configure-pod-container/security-context/)
1270+
[SecurityContext](/zh-cn/docs/tasks/configure-pod-container/security-context/)
1271+
中某些字段的 Pod,正如任务[为 Pod 或 Container 配置安全上下文](/zh-cn/docs/tasks/configure-pod-container/security-context/)
12861272
中所展示的那样。如果集群没有使用
1287-
[Pod 安全性准入](/zh/docs/concepts/security/pod-security-admission/)、
1288-
[PodSecurityPolicy](/zh/docs/concepts/security/pod-security-policy/),
1273+
[Pod 安全性准入](/zh-cn/docs/concepts/security/pod-security-admission/)、
1274+
[PodSecurityPolicy](/zh-cn/docs/concepts/security/pod-security-policy/),
12891275
也没有任何外部强制机制,那么你可以使用此准入控制器来限制安全上下文所能获取的值集。
12901276

1277+
<!--
1278+
See [Pod Security Standards](/docs/concepts/security/pod-security-standards/) for more context on restricting
1279+
pod privileges.
1280+
-->
12911281
有关限制 Pod 权限的更多内容,请参阅
1292-
[Pod 安全标准](/zh/docs/concepts/security/pod-security-standards/)。
1282+
[Pod 安全标准](/zh-cn/docs/concepts/security/pod-security-standards/)。
12931283

12941284
### ServiceAccount {#serviceaccount}
12951285

@@ -1300,7 +1290,7 @@ We strongly recommend using this admission controller if you intend to make use
13001290
`ServiceAccount` objects.
13011291
-->
13021292
此准入控制器实现了
1303-
[ServiceAccount](/zh/docs/tasks/configure-pod-container/configure-service-account/)
1293+
[ServiceAccount](/zh-cn/docs/tasks/configure-pod-container/configure-service-account/)
13041294
的自动化。
13051295
如果你打算使用 Kubernetes 的 ServiceAccount 对象,我们强烈建议你使用这个准入控制器。
13061296

@@ -1317,9 +1307,9 @@ for more detailed information.
13171307
-->
13181308
`StorageObjectInUseProtection` 插件将 `kubernetes.io/pvc-protection` 或
13191309
`kubernetes.io/pv-protection` finalizers 添加到新创建的持久卷申领(PVC)
1320-
或持久卷(PV)中。如果用户尝试删除 PVC/PV,除非 PVC/PV 的保护控制器移除 finalizers,
1321-
否则 PVC/PV 不会被删除。有关更多详细信息,请参考
1322-
[保护使用中的存储对象](/zh/docs/concepts/storage/persistent-volumes/#storage-object-in-use-protection)。
1310+
或持久卷(PV)中。如果用户尝试删除 PVC/PV,除非 PVC/PV 的保护控制器移除终结器(finalizers
1311+
否则 PVC/PV 不会被删除。有关更多详细信息,
1312+
请参考[保护使用中的存储对象](/zh-cn/docs/concepts/storage/persistent-volumes/#storage-object-in-use-protection)。
13231313

13241314
### TaintNodesByCondition {#taintnodesbycondition}
13251315

@@ -1353,7 +1343,7 @@ If a webhook called by this has side effects (for example, decrementing quota) i
13531343
*must* have a reconciliation system, as it is not guaranteed that subsequent
13541344
webhooks or other validating admission controllers will permit the request to finish.
13551345
-->
1356-
如果以此方式调用的 Webhook 有其它副作用(如:减少配额),则它必须具有协调机制
1346+
如果以此方式调用的 Webhook 有其它副作用(如:减少配额),则它 **必须** 具有协调机制
13571347
这是因为无法保证后续的 Webhook 或其他验证性准入控制器都允许请求完成。
13581348

13591349
<!--
@@ -1378,7 +1368,7 @@ You can enable additional admission controllers beyond the default set using the
13781368
## 有推荐的准入控制器吗?
13791369

13801370
有。推荐使用的准入控制器默认情况下都处于启用状态
1381-
(请查看[这里](/zh/docs/reference/command-line-tools-reference/kube-apiserver/#options))。
1371+
(请查看[这里](/zh-cn/docs/reference/command-line-tools-reference/kube-apiserver/#options))。
13821372
因此,你无需显式指定它们。
13831373
你可以使用 `--enable-admission-plugins` 标志( **顺序不重要** )来启用默认设置以外的其他准入控制器。
13841374

0 commit comments

Comments
 (0)