Skip to content

Commit

Permalink
Merge pull request #46057 from windsonsea/admcon
Browse files Browse the repository at this point in the history
[zh] Sync admission-controllers.md and extensible-admission-controllers.md
  • Loading branch information
k8s-ci-robot committed Apr 29, 2024
2 parents a4ea4d6 + 194c3a3 commit 4f2dd5a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 准入控制器参考
linkTitle: 准入控制器
content_type: concept
weight: 30
weight: 40
---
<!--
reviewers:
Expand All @@ -15,14 +15,14 @@ reviewers:
title: Admission Controllers Reference
linkTitle: Admission Controllers
content_type: concept
weight: 30
weight: 40
-->

<!-- overview -->
<!--
This page provides an overview of Admission Controllers.
-->
此页面提供准入控制器(Admission Controllers)的概述。
此页面提供准入控制器(Admission Controller)的概述。

<!-- body -->

Expand Down Expand Up @@ -69,7 +69,7 @@ Kubernetes {{< skew currentVersion >}}
并编译进 `kube-apiserver` 可执行文件,并且只能由集群管理员配置。
在该列表中,有两个特殊的控制器:MutatingAdmissionWebhook 和 ValidatingAdmissionWebhook。
它们根据 API 中的配置,
分别执行变更和验证[准入控制 webhook](/zh-cn/docs/reference/access-authn-authz/extensible-admission-controllers/#admission-webhooks)
分别执行变更和验证[准入控制 Webhook](/zh-cn/docs/reference/access-authn-authz/extensible-admission-controllers/#admission-webhooks)

<!--
## Admission control phases
Expand Down Expand Up @@ -1401,80 +1401,6 @@ for more information.

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

### SecurityContextDeny {#securitycontextdeny}

<!--
**Type**: Validating.
-->
**类别**:验证。

{{< feature-state for_k8s_version="v1.27" state="deprecated" >}}

{{< caution >}}
<!--
The Kubernetes project recommends that you **do not use** the
`SecurityContextDeny` admission controller.
The `SecurityContextDeny` admission controller plugin is deprecated and disabled
by default. It will be removed in a future version. If you choose to enable the
`SecurityContextDeny` admission controller plugin, you must enable the
`SecurityContextDeny` feature gate as well.
-->
Kubernetes 项目建议你**不要使用** `SecurityContextDeny` 准入控制器。

`SecurityContextDeny` 准入控制器插件已被弃用,并且默认处于禁用状态。
此插件将在后续的版本中被移除。如果你选择启用 `SecurityContextDeny` 准入控制器插件,
也必须同时启用 `SecurityContextDeny` 特性门控。

<!--
The `SecurityContextDeny` admission plugin is deprecated because it is outdated
and incomplete; it may be unusable or not do what you would expect. As
implemented, this plugin is unable to restrict all security-sensitive attributes
of the Pod API. For example, the `privileged` and `ephemeralContainers` fields
were never restricted by this plugin.
-->
`SecurityContextDeny` 准入插件已被弃用,因为它已经过时且不完整;
它可能无法使用或无法达到你的预期。该插件实现之时,就无法限制 Pod API 的所有与安全相关的属性。
例如,`privileged``ephemeralContainers` 字段就从未受过此插件的限制。

<!--
The [Pod Security Admission](/docs/concepts/security/pod-security-admission/)
plugin enforcing the [Pod Security Standards](/docs/concepts/security/pod-security-standards/)
`Restricted` profile captures what this plugin was trying to achieve in a better
and up-to-date way.
-->
采用 [Pod 安全性标准](/zh-cn/docs/concepts/security/pod-security-standards/)中的 `Restricted`
方案的 [Pod 安全性准入](/zh-cn/docs/concepts/security/pod-security-admission/)插件,
能以更好和最新的方式来表述此插件所要实现的目标。
{{< /caution >}}

<!--
This admission controller will deny any Pod that attempts to set the following
[SecurityContext](/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context)
fields:
-->
此准入控制器将拒绝任何尝试设置以下
[SecurityContext](/zh-cn/docs/tasks/configure-pod-container/security-context/)
字段的 Pod:

- `.spec.securityContext.supplementalGroups`
- `.spec.securityContext.seLinuxOptions`
- `.spec.securityContext.runAsUser`
- `.spec.securityContext.fsGroup`
- `.spec.(init)Containers[*].securityContext.seLinuxOptions`
- `.spec.(init)Containers[*].securityContext.runAsUser`

<!--
For more historical context on this plugin, see
[The birth of PodSecurityPolicy](/blog/2022/08/23/podsecuritypolicy-the-historical-context/#the-birth-of-podsecuritypolicy)
from the Kubernetes blog article about PodSecurityPolicy and its removal. The
article details the PodSecurityPolicy historical context and the birth of the
`securityContext` field for Pods.
-->
有关此插件的更多历史背景,请参阅 Kubernetes 博客中这篇有关 PodSecurityPolicy 及其移除的文章:
[The birth of PodSecurityPolicy](/blog/2022/08/23/podsecuritypolicy-the-historical-context/#the-birth-of-podsecuritypolicy)
这篇文章详细地介绍了 PodSecurityPolicy 的历史背景以及 Pod 的 `securityContext` 字段的诞生。

### ServiceAccount {#serviceaccount}

<!--
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 动态准入控制
content_type: concept
weight: 40
weight: 45
---
<!--
reviewers:
Expand All @@ -13,7 +13,7 @@ reviewers:
- jpbetz
title: Dynamic Admission Control
content_type: concept
weight: 40
weight: 45
-->

<!-- overview -->
Expand Down Expand Up @@ -93,8 +93,8 @@ In the following, we describe how to quickly experiment with admission webhooks.
### 先决条件 {#prerequisites}

* 确保启用 MutatingAdmissionWebhook 和 ValidatingAdmissionWebhook 控制器。
[这里](/zh-cn/docs/reference/access-authn-authz/admission-controllers/#is-there-a-recommended-set-of-admission-controllers-to-use)
是一组推荐的 admission 控制器,通常可以启用。
[这里](/zh-cn/docs/reference/access-authn-authz/admission-controllers/#is-there-a-recommended-set-of-admission-controllers-to-use)是一组推荐的准入控制器,
通常可以启用。

* 确保启用了 `admissionregistration.k8s.io/v1` API。

Expand All @@ -110,8 +110,8 @@ that is validated in a Kubernetes e2e test. The webhook handles the
as an `AdmissionReview` object in the same version it received.
-->
请参阅 Kubernetes e2e 测试中的
[Admission Webhook 服务器](https://github.com/kubernetes/kubernetes/blob/release-1.21/test/images/agnhost/webhook/main.go)
的实现。Webhook 处理由 API 服务器发送的 `AdmissionReview` 请求,并且将其决定作为
[Admission Webhook 服务器](https://github.com/kubernetes/kubernetes/blob/release-1.21/test/images/agnhost/webhook/main.go)的实现。
Webhook 处理由 API 服务器发送的 `AdmissionReview` 请求,并且将其决定作为
`AdmissionReview` 对象以相同版本发送回去。

<!--
Expand Down Expand Up @@ -284,8 +284,8 @@ Webhook 提供身份证明。完成此配置需要三个步骤。
* 启动 API 服务器时,通过 `--admission-control-config-file` 参数指定准入控制配置文件的位置。

* 在准入控制配置文件中,指定 MutatingAdmissionWebhook 控制器和 ValidatingAdmissionWebhook 控制器应该读取凭据的位置。
凭证存储在 kubeConfig 文件中(是​​的,与 kubectl 使用的模式相同),因此字段名称为 `kubeConfigFile`
以下是一个准入控制配置文件示例:
凭证存储在 kubeConfig 文件中(是​​的,与 kubectl 使用的模式相同),因此字段名称为 `kubeConfigFile`
以下是一个准入控制配置文件示例:

{{< tabs name="admissionconfiguration_example1" >}}
{{% tab name="apiserver.config.k8s.io/v1" %}}
Expand Down Expand Up @@ -1161,7 +1161,7 @@ The `matchPolicy` for an admission webhooks defaults to `Equivalent`.
-->
### 匹配请求:`matchConditions` {#matching-requests-matchConditions}

{{< feature-state state="beta" for_k8s_version="v1.28" >}}
{{< feature-state feature_gate_name="AdmissionWebhookMatchConditions" >}}

<!--
You can define _match conditions_ for webhooks if you need fine-grained request filtering. These
Expand Down

0 comments on commit 4f2dd5a

Please sign in to comment.