Skip to content

Commit 791f06c

Browse files
authored
Merge pull request #36222 from windsonsea/podsecadm
[zh-cn] sync1.25 pod-security-admission.md
2 parents d0f6a5b + b1ece10 commit 791f06c

File tree

1 file changed

+20
-84
lines changed

1 file changed

+20
-84
lines changed

content/zh-cn/docs/concepts/security/pod-security-admission.md

Lines changed: 20 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ description: >
55
66
content_type: concept
77
weight: 20
8-
min-kubernetes-server-version: v1.22
98
---
109
<!--
1110
reviewers:
@@ -17,12 +16,11 @@ description: >
1716
Standards.
1817
content_type: concept
1918
weight: 20
20-
min-kubernetes-server-version: v1.22
2119
-->
2220

2321
<!-- overview -->
2422

25-
{{< feature-state for_k8s_version="v1.23" state="beta" >}}
23+
{{< feature-state for_k8s_version="v1.25" state="stable" >}}
2624

2725
<!--
2826
The Kubernetes [Pod Security Standards](/docs/concepts/security/pod-security-standards/) define
@@ -33,88 +31,26 @@ Kubernetes [Pod 安全性标准(Security Standards)](/zh-cn/docs/concepts/se
3331
为 Pod 定义不同的隔离级别。这些标准能够让你以一种清晰、一致的方式定义如何限制 Pod 行为。
3432

3533
<!--
36-
As a beta feature, Kubernetes offers a built-in _Pod Security_ {{< glossary_tooltip
37-
text="admission controller" term_id="admission-controller" >}}, the successor
38-
to [PodSecurityPolicies](/docs/concepts/security/pod-security-policy/). Pod security restrictions
39-
are applied at the {{< glossary_tooltip text="namespace" term_id="namespace" >}} level when pods
40-
are created.
34+
Kubernetes offers a built-in _Pod Security_ {{< glossary_tooltip text="admission controller"
35+
term_id="admission-controller" >}} to enforce the Pod Security Standards. Pod security restrictions
36+
are applied at the {{< glossary_tooltip text="namespace" term_id="namespace" >}} level when pods are
37+
created.
4138
-->
42-
作为一项 Beta 功能特性,Kubernetes 提供一种内置的 _Pod 安全性_
43-
{{< glossary_tooltip text="准入控制器" term_id="admission-controller" >}},
44-
作为 [PodSecurityPolicies](/zh-cn/docs/concepts/security/pod-security-policy/)
45-
特性的后继演化版本。Pod 安全性限制是在 Pod 被创建时在
46-
{{< glossary_tooltip text="名字空间" term_id="namespace" >}}层面实施的。
47-
48-
{{< note >}}
49-
<!--
50-
The PodSecurityPolicy API is deprecated and will be
51-
[removed](/docs/reference/using-api/deprecation-guide/#v1-25) from Kubernetes in v1.25.
52-
-->
53-
PodSecurityPolicy API 已经被废弃,会在 Kubernetes v1.25 发行版中
54-
[移除](/zh-cn/docs/reference/using-api/deprecation-guide/#v1-25)
55-
{{< /note >}}
56-
57-
<!-- body -->
58-
59-
## {{% heading "prerequisites" %}}
60-
61-
<!--
62-
To use this mechanism, your cluster must enforce Pod Security admission.
63-
-->
64-
要使用此机制,你的集群必须强制执行 Pod 安全准入。
39+
Kubernetes 提供了一个内置的 **Pod Security**
40+
{{< glossary_tooltip text="准入控制器" term_id="admission-controller" >}}来执行 Pod 安全标准
41+
(Pod Security Standard)。
42+
创建 Pod 时在{{< glossary_tooltip text="名字空间" term_id="namespace" >}}级别应用这些 Pod 安全限制。
6543

6644
<!--
6745
### Built-in Pod Security admission enforcement
6846
69-
In Kubernetes v1.23, the `PodSecurity` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) is a beta feature and is enabled by default.
7047
This page is part of the documentation for Kubernetes v{{< skew currentVersion >}}.
7148
If you are running a different version of Kubernetes, consult the documentation for that release.
7249
-->
73-
### 内置 Pod 安全准入强制执行
50+
### 内置 Pod 安全准入强制执行 {#built-in-pod-security-admission-enforcement}
7451

75-
在 Kubernetes v1.23 中,`PodSecurity`
76-
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)是一项 Beta 特性,
77-
默认被启用。
7852
本页面是 Kubernetes v{{< skew currentVersion >}} 文档的一部分。
79-
如果你运行的是其它版本的 Kubernetes,请查阅该版本的文档。
80-
81-
<!--
82-
### Alternative: installing the `PodSecurity` admission webhook {#webhook}
83-
84-
The `PodSecurity` admission logic is also available as a [validating admission webhook](https://git.k8s.io/pod-security-admission/webhook). This implementation is also beta.
85-
For environments where the built-in `PodSecurity` admission plugin cannot be enabled, you can instead enable that logic via a validating admission webhook.
86-
-->
87-
### 替代方案:安装 `PodSecurity` 准入 Webhook {#webhook}
88-
89-
`PodSecurity` 准入逻辑也可用作[验证性准入 Webhook](https://git.k8s.io/pod-security-admission/webhook)
90-
该实现也是 Beta 版本。
91-
对于无法启用内置 `PodSecurity` 准入插件的环境,你可以改为通过验证准入 Webhook 启用该逻辑。
92-
93-
<!--
94-
A pre-built container image, certificate generation scripts, and example manifests
95-
are available at [https://git.k8s.io/pod-security-admission/webhook](https://git.k8s.io/pod-security-admission/webhook).
96-
97-
To install:
98-
-->
99-
[https://git.k8s.io/pod-security-admission/webhook](https://git.k8s.io/pod-security-admission/webhook)
100-
上可以找到一个预先构建的容器镜像、证书生成脚本以及一些示例性质的清单。
101-
执行下面的命令来安装:
102-
103-
```shell
104-
git clone [email protected]:kubernetes/pod-security-admission.git
105-
cd pod-security-admission/webhook
106-
make certs
107-
kubectl apply -k .
108-
```
109-
110-
{{< note >}}
111-
<!--
112-
The generated certificate is valid for 2 years. Before it expires,
113-
regenerate the certificate or remove the webhook in favor of the built-in admission plugin.
114-
-->
115-
所生成的证书合法期限为 2 年。在证书过期之前,
116-
需要重新生成证书或者去掉 Webhook 以使用内置的准入插件。
117-
{{< /note >}}
53+
如果你运行的是其他版本的 Kubernetes,请查阅该版本的文档。
11854

11955
<!-- body -->
12056

@@ -131,9 +67,10 @@ Standards](/docs/concepts/security/pod-security-standards): `privileged`, `basel
13167
`restricted`. Refer to the [Pod Security Standards](/docs/concepts/security/pod-security-standards)
13268
page for an in-depth look at those requirements.
13369
-->
134-
Pod 安全性准入插件对 Pod 的[安全性上下文](/zh-cn/docs/tasks/configure-pod-container/security-context/)
135-
有一定的要求,并且依据 [Pod 安全性标准](/zh-cn/docs/concepts/security/pod-security-standards)
136-
所定义的三个级别(`privileged``baseline``restricted`)对其他字段也有要求。
70+
Pod 安全性准入插件对 Pod
71+
[安全性上下文](/zh-cn/docs/tasks/configure-pod-container/security-context/)有一定的要求,
72+
并且依据 [Pod 安全性标准](/zh-cn/docs/concepts/security/pod-security-standards)所定义的三个级别
73+
`privileged``baseline``restricted`)对其他字段也有要求。
13774
关于这些需求的更进一步讨论,请参阅
13875
[Pod 安全性标准](/zh-cn/docs/concepts/security/pod-security-standards/)页面。
13976

@@ -153,8 +90,8 @@ takes if a potential violation is detected:
15390
Pod 安全性准入控制模式。
15491
Kubernetes 定义了一组{{< glossary_tooltip term_id="label" text="标签" >}},
15592
你可以设置这些标签来定义某个名字空间上要使用的预定义的 Pod 安全性标准级别。
156-
你所选择的标签定义了检测到潜在违例时,{{< glossary_tooltip text="控制面" term_id="control-plane" >}}
157-
要采取什么样的动作。
93+
你所选择的标签定义了检测到潜在违例时,
94+
{{< glossary_tooltip text="控制面" term_id="control-plane" >}}要采取什么样的动作。
15895

15996
<!--
16097
Mode | Description
@@ -194,7 +131,7 @@ pod-security.kubernetes.io/<MODE>: <LEVEL>
194131
# VERSION must be a valid Kubernetes minor version, or `latest`.
195132
pod-security.kubernetes.io/<MODE>-version: <VERSION>
196133
-->
197-
```
134+
```yaml
198135
# 模式的级别标签用来标示对应模式所应用的策略级别
199136
#
200137
# MODE 必须是 `enforce`、`audit` 或 `warn` 之一
@@ -233,7 +170,7 @@ Pod 通常是通过创建 {{< glossary_tooltip term_id="deployment" >}} 或
233170
来间接创建的。工作负载对象为工作负载资源定义一个 **Pod 模板**
234171
和一个对应的负责基于该模板来创建 Pod 的{{< glossary_tooltip term_id="controller" text="控制器" >}}。
235172
为了尽早地捕获违例状况,`audit` 和 `warn` 模式都应用到负载资源。
236-
不过,`enforce` 模式并 **** 应用到工作负载资源,仅应用到所生成的 Pod 对象上。
173+
不过,`enforce` 模式并 **不** 应用到工作负载资源,仅应用到所生成的 Pod 对象上。
237174

238175
<!--
239176
## Exemptions
@@ -268,8 +205,7 @@ Admission Controller (all `enforce`, `audit` and `warn` behaviors are skipped).
268205
- **Username:** 来自用户名已被豁免的、已认证的(或伪装的)的用户的请求会被忽略。
269206
- **RuntimeClassName:** 指定了已豁免的运行时类名称的 Pod
270207
和[负载资源](#workload-resources-and-pod-templates)会被忽略。
271-
- **Namespace:** 位于被豁免的名字空间中的 Pod 和[负载资源](#workload-resources-and-pod-templates)
272-
会被忽略。
208+
- **Namespace:** 位于被豁免的名字空间中的 Pod 和[负载资源](#workload-resources-and-pod-templates)会被忽略。
273209

274210
{{< caution >}}
275211
<!--

0 commit comments

Comments
 (0)