@@ -47,7 +47,7 @@ which are configured in the API.
47
47
并编译进 ` kube-apiserver ` 可执行文件,并且只能由集群管理员配置。
48
48
在该列表中,有两个特殊的控制器:MutatingAdmissionWebhook 和 ValidatingAdmissionWebhook。
49
49
它们根据 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 ) 。
51
51
52
52
<!--
53
53
Admission controllers may be "validating", "mutating", or both. Mutating
@@ -88,29 +88,27 @@ other admission controllers.
88
88
89
89
<!--
90
90
## Why do I need them?
91
- -->
92
- ## 为什么需要准入控制器? {#why-do-i-need-them}
93
91
94
- <!--
95
92
Many advanced features in Kubernetes require an admission controller to be enabled in order
96
93
to properly support the feature. As a result, a Kubernetes API server that is not properly
97
94
configured with the right set of admission controllers is an incomplete server and will not
98
95
support all the features you expect.
99
96
-->
97
+ ## 为什么需要准入控制器? {#why-do-i-need-them}
98
+
100
99
Kubernetes 的许多高级功能都要求启用一个准入控制器,以便正确地支持该特性。
101
100
因此,没有正确配置准入控制器的 Kubernetes API 服务器是不完整的,它无法支持你所期望的所有特性。
102
101
103
102
<!--
104
103
## How do I turn on an admission controller?
105
- -->
106
104
107
- ## 如何启用一个准入控制器? {#how-do-i-turn-on-an-admission-controller}
108
105
109
- <!--
110
106
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.
111
107
For example, the following command line enables the `NamespaceLifecycle` and the `LimitRanger`
112
108
admission control plugins:
113
109
-->
110
+ ## 如何启用一个准入控制器? {#how-do-i-turn-on-an-admission-controller}
111
+
114
112
Kubernetes API 服务器的 ` enable-admission-plugins ` 标志接受一个(以逗号分隔的)准入控制插件列表,
115
113
这些插件会在集群修改对象之前被调用。
116
114
@@ -163,7 +161,6 @@ kube-apiserver -h | grep enable-admission-plugins
163
161
<!--
164
162
In the current version, the default ones are:
165
163
-->
166
-
167
164
在目前版本中,默认启用的插件有:
168
165
169
166
```
@@ -226,7 +223,7 @@ See [Certificate Signing Requests](/docs/reference/access-authn-authz/certificat
226
223
information on the permissions required to perform different actions on CertificateSigningRequest resources.
227
224
-->
228
225
有关对 CertificateSigningRequest 资源执行不同操作所需权限的详细信息,
229
- 请参阅[ 证书签名请求] ( /zh/docs/reference/access-authn-authz/certificate-signing-requests/ ) 。
226
+ 请参阅[ 证书签名请求] ( /zh-cn /docs/reference/access-authn-authz/certificate-signing-requests/ ) 。
230
227
231
228
### CertificateSigning {#certificatesigning}
232
229
@@ -244,7 +241,7 @@ See [Certificate Signing Requests](/docs/reference/access-authn-authz/certificat
244
241
information on the permissions required to perform different actions on CertificateSigningRequest resources.
245
242
-->
246
243
有关对 CertificateSigningRequest 资源执行不同操作所需权限的详细信息,
247
- 请参阅[ 证书签名请求] ( /zh/docs/reference/access-authn-authz/certificate-signing-requests/ ) 。
244
+ 请参阅[ 证书签名请求] ( /zh-cn /docs/reference/access-authn-authz/certificate-signing-requests/ ) 。
248
245
249
246
### CertificateSubjectRestriction {#certificatesubjectrestriction}
250
247
@@ -286,7 +283,7 @@ See the [ingress](/docs/concepts/services-networking/ingress/) documentation for
286
283
classes and how to mark one as default.
287
284
-->
288
285
关于 Ingress 类以及如何将 Ingress 类标记为默认的更多信息,请参见
289
- [ Ingress] ( /zh/docs/concepts/services-networking/ingress/ ) 页面。
286
+ [ Ingress] ( /zh-cn /docs/concepts/services-networking/ingress/ ) 页面。
290
287
291
288
### DefaultStorageClass {#defaultstorageclass}
292
289
@@ -315,7 +312,7 @@ This admission controller ignores any `PersistentVolumeClaim` updates; it acts o
315
312
See [persistent volume](/docs/concepts/storage/persistent-volumes/) documentation about persistent volume claims and
316
313
storage classes and how to mark a storage class as default.
317
314
-->
318
- 关于持久卷申领和存储类,以及如何将存储类标记为默认,请参见[ 持久卷] ( /zh/docs/concepts/storage/persistent-volumes/ ) 页面。
315
+ 关于持久卷申领和存储类,以及如何将存储类标记为默认,请参见[ 持久卷] ( /zh-cn /docs/concepts/storage/persistent-volumes/ ) 页面。
319
316
320
317
### DefaultTolerationSeconds {#defaulttolerationseconds}
321
318
@@ -477,7 +474,7 @@ See the [EventRateLimit Config API (v1alpha1)](/docs/reference/config-api/apiser
477
474
for more details.
478
475
-->
479
476
详情请参见
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/)。
481
478
482
479
### ExtendedResourceToleration {#extendedresourcetoleration}
483
480
@@ -491,7 +488,7 @@ add these tolerations.
491
488
-->
492
489
此插件有助于创建带有扩展资源的专用节点。
493
490
如果运维人员想要创建带有扩展资源(如 GPU、FPGA 等)的专用节点,他们应该以扩展资源名称作为键名,
494
- [为节点设置污点](/zh/docs/concepts/scheduling-eviction/taint-and-toleration/)。
491
+ [为节点设置污点](/zh-cn /docs/concepts/scheduling-eviction/taint-and-toleration/)。
495
492
如果启用了此准入控制器,会将此类污点的容忍度自动添加到请求扩展资源的 Pod 中,
496
493
用户不必再手动添加这些容忍度。
497
494
@@ -504,13 +501,12 @@ ImagePolicyWebhook 准入控制器允许使用后端 Webhook 做出准入决策
504
501
505
502
<!--
506
503
#### Configuration File Format
507
- -->
508
- #### 配置文件格式 {#configuration-file-format}
509
504
510
- <!--
511
505
ImagePolicyWebhook uses a configuration file to set options for the behavior of the backend.
512
506
This file may be json or yaml and has the following format:
513
507
-->
508
+ #### 配置文件格式 {#configuration-file-format}
509
+
514
510
ImagePolicyWebhook 使用配置文件来为后端行为设置选项。该文件可以是 JSON 或 YAML,
515
511
并具有以下格式:
516
512
@@ -568,7 +564,7 @@ formatted file which sets up the connection to the backend.
568
564
It is required that the backend communicate over TLS.
569
565
-->
570
566
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/)
572
568
格式的文件;该文件用来设置与后端的连接。要求后端使用 TLS 进行通信。
573
569
574
570
<!--
@@ -616,20 +612,19 @@ For additional HTTP configuration, refer to the
616
612
[kubeconfig](/docs/tasks/access-application-cluster/configure-access-multiple-clusters/) documentation.
617
613
-->
618
614
关于 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/)
620
616
文档。
621
617
622
618
<!--
623
619
# ### Request payloads
624
- -->
625
- # ### 请求载荷
626
620
627
- <!--
628
621
When faced with an admission decision, the API Server POSTs a JSON serialized
629
622
` imagepolicy.k8s.io/v1alpha1` ` ImageReview` object describing the action.
630
623
This object contains fields describing the containers being admitted, as well as
631
624
any pod annotations that match `*.image-policy.k8s.io/*`.
632
625
-->
626
+ # ### 请求载荷 {#request-payloads}
627
+
633
628
当面对一个准入决策时,API 服务器发送一个描述操作的 JSON 序列化的
634
629
` imagepolicy.k8s.io/v1alpha1` ` ImageReview` 对象。
635
630
该对象包含描述被准入容器的字段,以及与 `*.image-policy.k8s.io/*` 匹配的所有 Pod 注解。
@@ -714,33 +709,31 @@ To disallow access, the service would return:
714
709
For further documentation refer to the
715
710
[`imagepolicy.v1alpha1` API](/docs/reference/config-api/imagepolicy.v1alpha1/).
716
711
-->
717
- 更多的文档,请参阅 [`imagepolicy.v1alpha1` API](/zh/docs/reference/config-api/imagepolicy.v1alpha1/)。
712
+ 更多的文档,请参阅 [`imagepolicy.v1alpha1` API](/zh-cn /docs/reference/config-api/imagepolicy.v1alpha1/)。
718
713
719
714
<!--
720
715
# ### Extending with Annotations
721
- -->
722
- # ### 使用注解进行扩展 {#extending-with-annotations}
723
716
724
- <!--
725
717
All annotations on a Pod that match `*.image-policy.k8s.io/*` are sent to the webhook.
726
718
Sending annotations allows users who are aware of the image policy backend to
727
719
send extra information to it, and for different backends implementations to
728
720
accept different information.
729
721
-->
722
+ # ### 使用注解进行扩展 {#extending-with-annotations}
723
+
730
724
一个 Pod 中匹配 `*.image-policy.k8s.io/*` 的注解都会被发送给 Webhook。
731
725
这样做使得了解后端镜像策略的用户可以向它发送额外的信息,
732
726
并让不同的后端实现接收不同的信息。
733
727
734
728
<!--
735
729
Examples of information you might put here are :
736
- -->
737
- 你可以在这里输入的信息有:
738
730
739
- <!--
740
731
* request to "break glass" to override a policy, in case of emergency.
741
732
* a ticket number from a ticket system that documents the break-glass request
742
733
* provide a hint to the policy server as to the imageID of the image being provided, to save it a lookup
743
734
-->
735
+ 你可以在这里输入的信息有:
736
+
744
737
* 在紧急情况下,请求破例覆盖某个策略。
745
738
* 从一个记录了破例的请求的工单(Ticket)系统得到的一个工单号码。
746
739
* 向策略服务器提供提示信息,用于提供镜像的 imageID,以方便它进行查找。
@@ -780,8 +773,8 @@ and the [example of LimitRange](/docs/tasks/administer-cluster/manage-resources/
780
773
for more details.
781
774
-->
782
775
请查看
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/)以了解更多细节。
785
778
786
779
# ## MutatingAdmissionWebhook {#mutatingadmissionwebhook}
787
780
@@ -993,7 +986,7 @@ allowVolumeExpansion: true
993
986
For more information about persistent volume claims, see [PersistentVolumeClaims](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims).
994
987
-->
995
988
关于持久化卷申领的更多信息,请参见
996
- [PersistentVolumeClaim](/zh/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims)。
989
+ [PersistentVolumeClaim](/zh-cn /docs/concepts/storage/persistent-volumes/#persistentvolumeclaims)。
997
990
998
991
# ## PersistentVolumeLabel {#persistentvolumelabel}
999
992
@@ -1037,7 +1030,8 @@ This file may be json or yaml and has the following format:
1037
1030
-->
1038
1031
# ### 配置文件格式 {#configuration-file-format-podnodeselector}
1039
1032
1040
- ` PodNodeSelector` 使用配置文件来设置后端行为的选项。请注意,配置文件格式将在将来某个版本中改为版本化文件。
1033
+ ` PodNodeSelector` 使用配置文件来设置后端行为的选项。
1034
+ 请注意,配置文件格式将在将来某个版本中改为版本化文件。
1041
1035
该文件可以是 JSON 或 YAML,格式如下:
1042
1036
1043
1037
` ` ` yaml
@@ -1134,10 +1128,10 @@ for more information.
1134
1128
-->
1135
1129
这是下节所讨论的已被废弃的 [PodSecurityPolicy](#podsecuritypolicy) 准入控制器的替代品。
1136
1130
此准入控制器负责在创建和修改 Pod 时,根据请求的安全上下文和
1137
- [Pod 安全标准](/zh/docs/concepts/security/pod-security-standards/)
1131
+ [Pod 安全标准](/zh-cn /docs/concepts/security/pod-security-standards/)
1138
1132
来确定是否可以执行请求。
1139
1133
1140
- 更多信息请参阅 [Pod 安全性准入控制器](/zh/docs/concepts/security/pod-security-admission/)。
1134
+ 更多信息请参阅 [Pod 安全性准入控制器](/zh-cn /docs/concepts/security/pod-security-admission/)。
1141
1135
1142
1136
# ## PodSecurityPolicy {#podsecuritypolicy}
1143
1137
@@ -1154,8 +1148,7 @@ based on the requested security context and the available Pod Security Policies.
1154
1148
See also the [PodSecurityPolicy](/docs/concepts/security/pod-security-policy/) documentation
1155
1149
for more information.
1156
1150
-->
1157
- 查看 [Pod 安全策略文档](/zh/docs/concepts/security/pod-security-policy/)
1158
- 进一步了解其间细节。
1151
+ 查看 [Pod 安全策略文档](/zh-cn/docs/concepts/security/pod-security-policy/)进一步了解其间细节。
1159
1152
1160
1153
# ## PodTolerationRestriction {#podtolerationrestriction}
1161
1154
@@ -1234,15 +1227,14 @@ See the [ResourceQuota API reference](/docs/reference/kubernetes-api/policy-reso
1234
1227
and the [example of Resource Quota](/docs/concepts/policy/resource-quotas/) for more details.
1235
1228
-->
1236
1229
请参阅
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/)了解更多细节。
1240
1232
1241
- <!--
1242
1233
# ## RuntimeClass {#runtimeclass}
1243
1234
1244
1235
{{< feature-state for_k8s_version="v1.20" state="stable" >}}
1245
1236
1237
+ <!--
1246
1238
If you define a RuntimeClass with [Pod overhead](/docs/concepts/scheduling-eviction/pod-overhead/)
1247
1239
configured, this admission controller checks incoming Pods.
1248
1240
When enabled, this admission controller rejects any Pod create requests
@@ -1254,16 +1246,13 @@ defined in the corresponding RuntimeClass.
1254
1246
See also [Pod Overhead](/docs/concepts/scheduling-eviction/pod-overhead/)
1255
1247
for more information.
1256
1248
-->
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 创建请求。
1263
1252
对于配置了 RuntimeClass 并在其 `.spec` 中选定 RuntimeClass 的 Pod,
1264
1253
此准入控制器会根据相应 RuntimeClass 中定义的值为 Pod 设置 `.spec.overhead`。
1265
1254
1266
- 详情请参见 [Pod 开销](/zh/docs/concepts/scheduling-eviction/pod-overhead/)。
1255
+ 详情请参见 [Pod 开销](/zh-cn /docs/concepts/scheduling-eviction/pod-overhead/)。
1267
1256
1268
1257
# ## SecurityContextDeny {#securitycontextdeny}
1269
1258
@@ -1276,20 +1265,21 @@ task.
1276
1265
If you don't use [Pod Security admission](/docs/concepts/security/pod-security-admission/),
1277
1266
[PodSecurityPolicies](/docs/concepts/security/pod-security-policy/), nor any external enforcement mechanism,
1278
1267
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.
1282
1268
-->
1283
1269
此准入控制器将拒绝任何试图设置特定提升
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/)
1286
1272
中所展示的那样。如果集群没有使用
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/),
1289
1275
也没有任何外部强制机制,那么你可以使用此准入控制器来限制安全上下文所能获取的值集。
1290
1276
1277
+ <!--
1278
+ See [Pod Security Standards](/docs/concepts/security/pod-security-standards/) for more context on restricting
1279
+ pod privileges.
1280
+ -->
1291
1281
有关限制 Pod 权限的更多内容,请参阅
1292
- [Pod 安全标准](/zh/docs/concepts/security/pod-security-standards/)。
1282
+ [Pod 安全标准](/zh-cn /docs/concepts/security/pod-security-standards/)。
1293
1283
1294
1284
# ## ServiceAccount {#serviceaccount}
1295
1285
@@ -1300,7 +1290,7 @@ We strongly recommend using this admission controller if you intend to make use
1300
1290
` ServiceAccount` objects.
1301
1291
-->
1302
1292
此准入控制器实现了
1303
- [ServiceAccount](/zh/docs/tasks/configure-pod-container/configure-service-account/)
1293
+ [ServiceAccount](/zh-cn /docs/tasks/configure-pod-container/configure-service-account/)
1304
1294
的自动化。
1305
1295
如果你打算使用 Kubernetes 的 ServiceAccount 对象,我们强烈建议你使用这个准入控制器。
1306
1296
@@ -1317,9 +1307,9 @@ for more detailed information.
1317
1307
-->
1318
1308
` StorageObjectInUseProtection` 插件将 `kubernetes.io/pvc-protection` 或
1319
1309
` 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)。
1323
1313
1324
1314
# ## TaintNodesByCondition {#taintnodesbycondition}
1325
1315
@@ -1353,7 +1343,7 @@ If a webhook called by this has side effects (for example, decrementing quota) i
1353
1343
*must* have a reconciliation system, as it is not guaranteed that subsequent
1354
1344
webhooks or other validating admission controllers will permit the request to finish.
1355
1345
-->
1356
- 如果以此方式调用的 Webhook 有其它副作用(如:减少配额),则它必须具有协调机制 。
1346
+ 如果以此方式调用的 Webhook 有其它副作用(如:减少配额),则它 **必须** 具有协调机制 。
1357
1347
这是因为无法保证后续的 Webhook 或其他验证性准入控制器都允许请求完成。
1358
1348
1359
1349
<!--
@@ -1378,7 +1368,7 @@ You can enable additional admission controllers beyond the default set using the
1378
1368
# # 有推荐的准入控制器吗?
1379
1369
1380
1370
有。推荐使用的准入控制器默认情况下都处于启用状态
1381
- (请查看[这里](/zh/docs/reference/command-line-tools-reference/kube-apiserver/#options))。
1371
+ (请查看[这里](/zh-cn /docs/reference/command-line-tools-reference/kube-apiserver/#options))。
1382
1372
因此,你无需显式指定它们。
1383
1373
你可以使用 `--enable-admission-plugins` 标志( **顺序不重要** )来启用默认设置以外的其他准入控制器。
1384
1374
0 commit comments