Skip to content

Commit db77994

Browse files
authored
Merge pull request #47327 from windsonsea/podsec
[zh] Sync security/pod-security-standards.md
2 parents 497acd7 + e669973 commit db77994

File tree

1 file changed

+61
-56
lines changed

1 file changed

+61
-56
lines changed

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

Lines changed: 61 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Pod 安全性标准
33
description: >
4-
详细了解 Pod 安全性标准(Pod Security Standards)中所定义的不同策略级别。
4+
详细了解 Pod 安全性标准(Pod Security Standard)中所定义的不同策略级别。
55
content_type: concept
66
weight: 15
77
---
@@ -52,17 +52,16 @@ Pod 安全性标准定义了三种不同的**策略(Policy)**,以广泛覆
5252
**The _Privileged_ policy is purposely-open, and entirely unrestricted.** This type of policy is
5353
typically aimed at system- and infrastructure-level workloads managed by privileged, trusted users.
5454
55-
The Privileged policy is defined by an absence of restrictions. Allow-by-default
56-
mechanisms (such as gatekeeper) may be Privileged by default. In contrast, for a deny-by-default mechanism (such as Pod
57-
Security Policy) the Privileged policy should disable all restrictions.
55+
The Privileged policy is defined by an absence of restrictions. If you define a Pod where the Privileged
56+
security policy applies, the Pod you define is able to bypass typical container isolation mechanisms.
57+
For example, you can define a Pod that has access to the node's host network.
5858
-->
5959
**_Privileged_ 策略是有目的地开放且完全无限制的策略。**
6060
此类策略通常针对由特权较高、受信任的用户所管理的系统级或基础设施级负载。
6161

62-
Privileged 策略定义中限制较少。默认允许的(Allow-by-default)实施机制(例如 gatekeeper)
63-
可以缺省设置为 Privileged。
64-
与此不同,对于默认拒绝(Deny-by-default)的实施机制(如 Pod 安全策略)而言,
65-
Privileged 策略应该禁止所有限制。
62+
Privileged 策略定义中限制较少。
63+
如果你定义应用了 Privileged 安全策略的 Pod,你所定义的这个 Pod 能够绕过典型的容器隔离机制。
64+
例如,你可以定义有权访问节点主机网络的 Pod。
6665

6766
### Baseline
6867

@@ -99,9 +98,15 @@ fail validation.
9998
<tr>
10099
<td style="white-space: nowrap">HostProcess</td>
101100
<td>
102-
<p><!--Windows pods offer the ability to run <a href="/docs/tasks/configure-pod-container/create-hostprocess-pod">HostProcess containers</a> which enables privileged access to the Windows node. Privileged access to the host is disallowed in the baseline policy. -->
103-
Windows Pod 提供了运行 <a href="/zh-cn/docs/tasks/configure-pod-container/create-hostprocess-pod">HostProcess 容器</a> 的能力,这使得对 Windows 节点的特权访问成为可能。Baseline 策略中禁止对宿主的特权访问。{{< feature-state for_k8s_version="v1.26" state="stable" >}}
104-
</p>
101+
<p>
102+
<!--
103+
Windows Pods offer the ability to run <a href="/docs/tasks/configure-pod-container/create-hostprocess-pod">HostProcess containers</a> which enables privileged access to the Windows host machine. Privileged access to the host is disallowed in the Baseline policy.
104+
-->
105+
Windows Pod 提供了运行
106+
<a href="/zh-cn/docs/tasks/configure-pod-container/create-hostprocess-pod">HostProcess 容器</a>的能力,
107+
这使得对 Windows 宿主的特权访问成为可能。Baseline 策略中禁止对宿主的特权访问。
108+
{{< feature-state for_k8s_version="v1.26" state="stable" >}}
109+
</p>
105110
<p><strong><!--Restricted Fields-->限制的字段</strong></p>
106111
<ul>
107112
<li><code>spec.securityContext.windowsOptions.hostProcess</code></li>
@@ -206,7 +211,8 @@ fail validation.
206211
<p><strong><!--Allowed Values-->准许的取值</strong></p>
207212
<ul>
208213
<li><!--Undefined/nil-->未定义、nil</li>
209-
<li><!--Known list (not supported by the built-in <a href="/docs/concepts/security/pod-security-admission/">Pod Security Admission controller</a>)-->已知列表(不支持内置的 <a href="/docs/concepts/security/pod-security-admission/">Pod 安全性准入控制器</a> )</li>
214+
<li><!--Known list (not supported by the built-in <a href="/docs/concepts/security/pod-security-admission/">Pod Security Admission controller</a>)-->
215+
已知列表(不支持内置的 <a href="/zh-cn/docs/concepts/security/pod-security-admission/">Pod 安全性准入控制器</a> )</li>
210216
<li><code>0</code></li>
211217
</ul>
212218
</td>
@@ -215,14 +221,14 @@ fail validation.
215221
<td style="white-space: nowrap">AppArmor</td>
216222
<td>
217223
<p>
218-
<!--
219-
On supported hosts, the <code>RuntimeDefault</code> AppArmor profile is applied by default. The baseline policy should prevent overriding or disabling the default AppArmor profile, or restrict overrides to an allowed set of profiles.
220-
-->
221-
在受支持的主机上,默认使用 <code>RuntimeDefault</code> AppArmor 配置。Baseline
222-
策略应避免覆盖或者禁用默认策略,以及限制覆盖一些配置集合的权限。
223-
</p>
224+
<!--
225+
On supported hosts, the <code>RuntimeDefault</code> AppArmor profile is applied by default. The baseline policy should prevent overriding or disabling the default AppArmor profile, or restrict overrides to an allowed set of profiles.
226+
-->
227+
在受支持的主机上,默认使用 <code>RuntimeDefault</code> AppArmor 配置。Baseline
228+
策略应避免覆盖或者禁用默认策略,以及限制覆盖一些配置集合的权限。
229+
</p>
224230
<p><strong><!--Restricted Fields-->限制的字段</strong></p>
225-
<ul>
231+
<ul>
226232
<li><code>spec.securityContext.appArmorProfile.type</code></li>
227233
<li><code>spec.containers[*].securityContext.appArmorProfile.type</code></li>
228234
<li><code>spec.initContainers[*].securityContext.appArmorProfile.type</code></li>
@@ -250,11 +256,11 @@ fail validation.
250256
<td style="white-space: nowrap">SELinux</td>
251257
<td>
252258
<p>
253-
<!--
254-
Setting the SELinux type is restricted, and setting a custom SELinux user or role option is forbidden.
255-
-->
256-
设置 SELinux 类型的操作是被限制的,设置自定义的 SELinux 用户或角色选项是被禁止的。
257-
</p>
259+
<!--
260+
Setting the SELinux type is restricted, and setting a custom SELinux user or role option is forbidden.
261+
-->
262+
设置 SELinux 类型的操作是被限制的,设置自定义的 SELinux 用户或角色选项是被禁止的。
263+
</p>
258264
<p><strong><!--Restricted Fields-->限制的字段</strong></p>
259265
<ul>
260266
<li><code>spec.securityContext.seLinuxOptions.type</code></li>
@@ -327,12 +333,12 @@ fail validation.
327333
<td style="white-space: nowrap">Sysctls</td>
328334
<td>
329335
<p>
330-
<!--
331-
Sysctls can disable security mechanisms or affect all containers on a host, and should be disallowed except for an allowed "safe" subset. A sysctl is considered safe if it is namespaced in the container or the Pod, and it is isolated from other Pods or processes on the same Node.
332-
-->
333-
sysctl 可以禁用安全机制或影响宿主上所有容器,因此除了若干“安全”的允许子集之外,其他都应该被禁止。
334-
如果某 sysctl 是受容器或 Pod 的名字空间限制,且与节点上其他 Pod 或进程相隔离,可认为是安全的。
335-
</p>
336+
<!--
337+
Sysctls can disable security mechanisms or affect all containers on a host, and should be disallowed except for an allowed "safe" subset. A sysctl is considered safe if it is namespaced in the container or the Pod, and it is isolated from other Pods or processes on the same Node.
338+
-->
339+
sysctl 可以禁用安全机制或影响宿主上所有容器,因此除了若干“安全”的允许子集之外,其他都应该被禁止。
340+
如果某 sysctl 是受容器或 Pod 的名字空间限制,且与节点上其他 Pod 或进程相隔离,可认为是安全的。
341+
</p>
336342
<p><strong><!--Restricted Fields-->限制的字段</strong></p>
337343
<ul>
338344
<li><code>spec.securityContext.sysctls[*].name</code></li>
@@ -370,7 +376,7 @@ enforced/disallowed:
370376

371377
{{< note >}}
372378
<!--
373-
In this table, wildcards (`*`) indicate all elements in a list. For example,
379+
In this table, wildcards (`*`) indicate all elements in a list. For example,
374380
`spec.containers[*].securityContext` refers to the Security Context object for _all defined
375381
containers_. If any of the listed containers fails to meet the requirements, the entire pod will
376382
fail validation.
@@ -388,16 +394,16 @@ fail validation.
388394
<td><strong><!--Policy-->策略</strong></td>
389395
</tr>
390396
<tr>
391-
<td colspan="2"><em><!--Everything from the baseline profile.-->Baseline 策略的所有要求</em></td>
397+
<td colspan="2"><em><!--Everything from the Baseline policy-->Baseline 策略的所有要求</em></td>
392398
</tr>
393399
<tr>
394400
<td style="white-space: nowrap"><!--Volume Types-->卷类型</td>
395401
<td>
396402
<p>
397403
<!--
398-
In addition to restricting HostPath volumes, the restricted policy limits usage of non-core volume types to those defined through PersistentVolumes.
404+
The Restricted policy only permits the following volume types.
399405
-->
400-
除了限制 HostPath 卷之外,此类策略还限制可以通过 PersistentVolumes 定义的非核心卷类型
406+
Restricted 策略仅允许以下卷类型
401407
</p>
402408
<p><strong><!--Restricted Fields-->限制的字段</strong></p>
403409
<ul>
@@ -427,7 +433,7 @@ fail validation.
427433
<li><code>spec.initContainers[*].securityContext.allowPrivilegeEscalation</code></li>
428434
<li><code>spec.ephemeralContainers[*].securityContext.allowPrivilegeEscalation</code></li>
429435
</ul>
430-
<p><strong><!--Allowed Values-->允许的取值</strong></p>
436+
<p><strong><!--Allowed Values-->准许的取值</strong></p>
431437
<ul>
432438
<li><code>false</code></li>
433439
</ul>
@@ -574,7 +580,7 @@ of individual policies are not defined here.
574580
{{% thirdparty-content %}}
575581

576582
<!--
577-
Other alternatives for enforcing policies are being developed in the Kubernetes ecosystem, such as:
583+
Other alternatives for enforcing policies are being developed in the Kubernetes ecosystem, such as:
578584
-->
579585
在 Kubernetes 生态系统中还在开发一些其他的替代方案,例如:
580586

@@ -601,21 +607,21 @@ Kubernetes 中的 Windows 与基于 Linux 的工作负载相比有一些限制
601607

602608
{{< note >}}
603609
<!--
604-
Kubelets prior to v1.24 don't enforce the pod OS field, and if a cluster has nodes on versions earlier than v1.24 the restricted policies should be pinned to a version prior to v1.25.
610+
Kubelets prior to v1.24 don't enforce the pod OS field, and if a cluster has nodes on versions earlier than v1.24 the Restricted policies should be pinned to a version prior to v1.25.
605611
-->
606-
v1.24 之前的 Kubelet 不强制处理 Pod OS 字段,如果集群中有些节点运行早于 v1.24 的版本,
607-
则应将限制性的策略锁定到 v1.25 之前的版本。
612+
v1.24 之前的 kubelet 不强制处理 Pod OS 字段,如果集群中有些节点运行早于 v1.24 的版本,
613+
则应将 Restricted 策略锁定到 v1.25 之前的版本。
608614
{{< /note >}}
609615

610616
<!--
611617
### Restricted Pod Security Standard changes
612-
Another important change, made in Kubernetes v1.25 is that the _restricted_ Pod security
618+
Another important change, made in Kubernetes v1.25 is that the _Restricted_ policy
613619
has been updated to use the `pod.spec.os.name` field. Based on the OS name, certain policies that are specific
614620
to a particular OS can be relaxed for the other OS.
615621
-->
616622
### 限制性的 Pod Security Standard 变更 {#restricted-pod-security-standard-changes}
617623

618-
Kubernetes v1.25 中的另一个重要变化是**限制性的(Restricted)** Pod 安全性已更新
624+
Kubernetes v1.25 中的另一个重要变化是 _Restricted_ 策略已更新
619625
能够处理 `pod.spec.os.name` 字段。根据 OS 名称,专用于特定 OS 的某些策略对其他 OS 可以放宽限制。
620626

621627
<!--
@@ -629,6 +635,7 @@ Restrictions on the following controls are only required if `.spec.os.name` is n
629635
#### OS 特定的策略控制
630636

631637
仅当 `.spec.os.name` 不是 `windows` 时,才需要对以下控制进行限制:
638+
632639
- 特权提升
633640
- Seccomp
634641
- Linux 权能
@@ -644,32 +651,30 @@ the [documentation](/docs/concepts/workloads/pods/user-namespaces#integration-wi
644651

645652
用户命名空间是 Linux 特有的功能,可在运行工作负载时提高隔离度。
646653
关于用户命名空间如何与 PodSecurityStandard 协同工作,
647-
请参阅
648-
[文档](/zh-cn/docs/concepts/workloads/pods/user-namespaces#integration-with-pod-security-admission-checks)
649-
了解 Pod 如何使用用户命名空间。
654+
请参阅[文档](/zh-cn/docs/concepts/workloads/pods/user-namespaces#integration-with-pod-security-admission-checks)了解
655+
Pod 如何使用用户命名空间。
650656

651657
<!--
652658
## FAQ
653659
654-
### Why isn't there a profile between privileged and baseline?
660+
### Why isn't there a profile between Privileged and Baseline?
655661
-->
656662
## 常见问题 {#faq}
657663

658-
### 为什么不存在介于 Privileged 和 Baseline 之间的策略类型
664+
### 为什么不存在介于 Privileged 和 Baseline 之间的策略类型 {#why-isnt-there-a-profile-between-privileged-and-baseline}
659665

660666
<!--
661-
The three profiles defined here have a clear linear progression from most secure (restricted) to least
662-
secure (privileged), and cover a broad set of workloads. Privileges required above the baseline
667+
The three profiles defined here have a clear linear progression from most secure (Restricted) to least
668+
secure (Privileged), and cover a broad set of workloads. Privileges required above the Baseline
663669
policy are typically very application specific, so we do not offer a standard profile in this
664670
niche. This is not to say that the privileged profile should always be used in this case, but that
665671
policies in this space need to be defined on a case-by-case basis.
666672
667673
SIG Auth may reconsider this position in the future, should a clear need for other profiles arise.
668674
-->
669-
这里定义的三种策略框架有一个明晰的线性递进关系,从最安全(Restricted)到最不安全,
670-
并且覆盖了很大范围的工作负载。特权要求超出 Baseline 策略者通常是特定于应用的需求,
671-
所以我们没有在这个范围内提供标准框架。
672-
这并不意味着在这样的情形下仍然只能使用 Privileged 框架,
675+
这里定义的三种策略框架有一个明晰的线性递进关系,从最安全(Restricted)到最不安全(Privileged),
676+
并且覆盖了很大范围的工作负载。特权要求超出 Baseline 策略,这通常是特定于应用的需求,
677+
所以我们没有在这个范围内提供标准框架。这并不意味着在这样的情形下仍然只能使用 Privileged 框架,
673678
只是说处于这个范围的策略需要因地制宜地定义。
674679

675680
SIG Auth 可能会在将来考虑这个范围的框架,前提是有对其他框架的需求。
@@ -681,20 +686,20 @@ SIG Auth 可能会在将来考虑这个范围的框架,前提是有对其他
681686
Containers at runtime. Security contexts are defined as part of the Pod and container specifications
682687
in the Pod manifest, and represent parameters to the container runtime.
683688
-->
684-
### 安全配置与安全上下文的区别是什么?
689+
### 安全配置与安全上下文的区别是什么? {#whats-the-difference-between-security-profile-and-security-context}
685690

686691
[安全上下文](/zh-cn/docs/tasks/configure-pod-container/security-context/)在运行时配置 Pod
687692
和容器。安全上下文是在 Pod 清单中作为 Pod 和容器规约的一部分来定义的,
688693
所代表的是传递给容器运行时的参数。
689694

690695
<!--
691696
Security profiles are control plane mechanisms to enforce specific settings in the Security Context,
692-
as well as other related parameters outside the Security Context. As of July 2021,
697+
as well as other related parameters outside the Security Context. As of July 2021,
693698
[Pod Security Policies](/docs/concepts/security/pod-security-policy/) are deprecated in favor of the
694-
built-in [Pod Security Admission Controller](/docs/concepts/security/pod-security-admission/).
699+
built-in [Pod Security Admission Controller](/docs/concepts/security/pod-security-admission/).
695700
-->
696701
安全策略则是控制面用来对安全上下文以及安全性上下文之外的参数实施某种设置的机制。
697-
2020 年 7 月,
702+
2021 年 7 月,
698703
[Pod 安全性策略](/zh-cn/docs/concepts/security/pod-security-policy/)已被废弃,
699704
取而代之的是内置的 [Pod 安全性准入控制器](/zh-cn/docs/concepts/security/pod-security-admission/)
700705

0 commit comments

Comments
 (0)