@@ -5,7 +5,6 @@ description: >
5
5
6
6
content_type : concept
7
7
weight : 20
8
- min-kubernetes-server-version : v1.22
9
8
---
10
9
<!--
11
10
reviewers:
@@ -17,12 +16,11 @@ description: >
17
16
Standards.
18
17
content_type: concept
19
18
weight: 20
20
- min-kubernetes-server-version: v1.22
21
19
-->
22
20
23
21
<!-- overview -->
24
22
25
- {{< feature-state for_k8s_version="v1.23 " state="beta " >}}
23
+ {{< feature-state for_k8s_version="v1.25 " state="stable " >}}
26
24
27
25
<!--
28
26
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
33
31
为 Pod 定义不同的隔离级别。这些标准能够让你以一种清晰、一致的方式定义如何限制 Pod 行为。
34
32
35
33
<!--
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.
41
38
-->
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 安全限制。
65
43
66
44
<!--
67
45
### Built-in Pod Security admission enforcement
68
46
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.
70
47
This page is part of the documentation for Kubernetes v{{< skew currentVersion >}}.
71
48
If you are running a different version of Kubernetes, consult the documentation for that release.
72
49
-->
73
- ### 内置 Pod 安全准入强制执行
50
+ ### 内置 Pod 安全准入强制执行 {#built-in-pod-security-admission-enforcement}
74
51
75
- 在 Kubernetes v1.23 中,` PodSecurity `
76
- [ 特性门控] ( /zh-cn/docs/reference/command-line-tools-reference/feature-gates/ ) 是一项 Beta 特性,
77
- 默认被启用。
78
52
本页面是 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,请查阅该版本的文档。
118
54
119
55
<!-- body -->
120
56
@@ -131,9 +67,10 @@ Standards](/docs/concepts/security/pod-security-standards): `privileged`, `basel
131
67
`restricted`. Refer to the [Pod Security Standards](/docs/concepts/security/pod-security-standards)
132
68
page for an in-depth look at those requirements.
133
69
-->
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 ` )对其他字段也有要求。
137
74
关于这些需求的更进一步讨论,请参阅
138
75
[ Pod 安全性标准] ( /zh-cn/docs/concepts/security/pod-security-standards/ ) 页面。
139
76
@@ -153,8 +90,8 @@ takes if a potential violation is detected:
153
90
Pod 安全性准入控制模式。
154
91
Kubernetes 定义了一组{{< glossary_tooltip term_id="label" text="标签" >}},
155
92
你可以设置这些标签来定义某个名字空间上要使用的预定义的 Pod 安全性标准级别。
156
- 你所选择的标签定义了检测到潜在违例时,{{< glossary_tooltip text="控制面" term_id="control-plane" >}}
157
- 要采取什么样的动作。
93
+ 你所选择的标签定义了检测到潜在违例时,
94
+ {{< glossary_tooltip text="控制面" term_id="control-plane" >}} 要采取什么样的动作。
158
95
159
96
<!--
160
97
Mode | Description
@@ -194,7 +131,7 @@ pod-security.kubernetes.io/<MODE>: <LEVEL>
194
131
# VERSION must be a valid Kubernetes minor version, or `latest`.
195
132
pod-security.kubernetes.io/<MODE>-version: <VERSION>
196
133
-->
197
- ```
134
+ ``` yaml
198
135
# 模式的级别标签用来标示对应模式所应用的策略级别
199
136
#
200
137
# MODE 必须是 `enforce`、`audit` 或 `warn` 之一
@@ -233,7 +170,7 @@ Pod 通常是通过创建 {{< glossary_tooltip term_id="deployment" >}} 或
233
170
来间接创建的。工作负载对象为工作负载资源定义一个 **Pod 模板**
234
171
和一个对应的负责基于该模板来创建 Pod 的{{< glossary_tooltip term_id="controller" text="控制器" >}}。
235
172
为了尽早地捕获违例状况,` audit` 和 `warn` 模式都应用到负载资源。
236
- 不过,` enforce ` 模式并 ** 不** 应用到工作负载资源,仅应用到所生成的 Pod 对象上。
173
+ 不过,`enforce` 模式并 **不** 应用到工作负载资源,仅应用到所生成的 Pod 对象上。
237
174
238
175
<!--
239
176
# # Exemptions
@@ -268,8 +205,7 @@ Admission Controller (all `enforce`, `audit` and `warn` behaviors are skipped).
268
205
- **Username:** 来自用户名已被豁免的、已认证的(或伪装的)的用户的请求会被忽略。
269
206
- **RuntimeClassName:** 指定了已豁免的运行时类名称的 Pod
270
207
和[负载资源](#workload-resources-and-pod-templates)会被忽略。
271
- - ** Namespace:** 位于被豁免的名字空间中的 Pod 和[ 负载资源] ( #workload-resources-and-pod-templates )
272
- 会被忽略。
208
+ - **Namespace:** 位于被豁免的名字空间中的 Pod 和[负载资源](#workload-resources-and-pod-templates)会被忽略。
273
209
274
210
{{< caution >}}
275
211
<!--
0 commit comments