Skip to content

Commit 9d2065c

Browse files
authored
Merge pull request #34238 from tengqm/zh-34221-concepts-1
[zh] Resync concepts page (concepts-1)
2 parents 06273bf + f0a71f5 commit 9d2065c

File tree

5 files changed

+112
-75
lines changed

5 files changed

+112
-75
lines changed

content/zh-cn/docs/concepts/configuration/secret.md

Lines changed: 57 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,15 @@ You can still [manually create](/docs/tasks/configure-pod-container/configure-se
447447
a service account token Secret; for example, if you need a token that never expires.
448448
However, using the [TokenRequest](/docs/reference/kubernetes-api/authentication-resources/token-request-v1/)
449449
subresource to obtain a token to access the API is recommended instead.
450+
You can use the [`kubectl create token`](/docs/reference/generated/kubectl/kubectl-commands#-em-token-em-)
451+
command to obtain a token from the `TokenRequest` API.
450452
-->
451453
你仍然可以[手动创建](/zh/docs/tasks/configure-pod-container/configure-service-account/#manually-create-a-service-account-api-token)
452454
服务账号令牌。例如,当你需要一个永远都不过期的令牌时。
453455
不过,仍然建议使用 [TokenRequest](/docs/reference/kubernetes-api/authentication-resources/token-request-v1/)
454456
子资源来获得访问 API 服务器的令牌。
457+
你可以使用 [`kubectl create token`](/docs/reference/generated/kubectl/kubectl-commands#-em-token-em-)
458+
命令调用 `TokenRequest` API 获得令牌。
455459
{{< /note >}}
456460

457461
<!--
@@ -1446,26 +1450,61 @@ In this case, `0` means you have created an empty Secret.
14461450
### Service account token Secrets
14471451
14481452
A `kubernetes.io/service-account-token` type of Secret is used to store a
1449-
token that identifies a
1453+
token credential that identifies a
14501454
{{< glossary_tooltip text="service account" term_id="service-account" >}}.
1455+
-->
1456+
### 服务账号令牌 Secret {#service-account-token-secrets}
1457+
1458+
类型为 `kubernetes.io/service-account-token` 的 Secret
1459+
用来存放标识某{{< glossary_tooltip text="服务账号" term_id="service-account" >}}的令牌凭据。
1460+
1461+
<!--
1462+
Since 1.22, this type of Secret is no longer used to mount credentials into Pods,
1463+
and obtaining tokens via the [TokenRequest](/docs/reference/kubernetes-api/authentication-resources/token-request-v1/)
1464+
API is recommended instead of using service account token Secret objects.
1465+
Tokens obtained from the `TokenRequest` API are more secure than ones stored in Secret objects,
1466+
because they have a bounded lifetime and are not readable by other API clients.
1467+
You can use the [`kubectl create token`](/docs/reference/generated/kubectl/kubectl-commands#-em-token-em-)
1468+
command to obtain a token from the `TokenRequest` API.
1469+
-->
1470+
从 v1.22 开始,这种类型的 Secret 不再被用来向 Pod 中加载凭据数据,
1471+
建议通过 [TokenRequest](/zh-cn/docs/reference/kubernetes-api/authentication-resources/token-request-v1/)
1472+
API 来获得令牌,而不是使用服务账号令牌 Secret 对象。
1473+
通过 `TokenRequest` API 获得的令牌比保存在 Secret 对象中的令牌更加安全,
1474+
因为这些令牌有着被限定的生命期,并且不会被其他 API 客户端读取。
1475+
你可以使用 [`kubectl create token`](/docs/reference/generated/kubectl/kubectl-commands#-em-token-em-)
1476+
命令调用 `TokenRequest` API 获得令牌。
1477+
1478+
<!--
1479+
You should only create a service account token Secret object
1480+
if you can't use the `TokenRequest` API to obtain a token,
1481+
and the security exposure of persisting a non-expiring token credential
1482+
in a readable API object is acceptable to you.
1483+
-->
1484+
只有在你无法使用 `TokenRequest` API 来获取令牌,
1485+
并且你能够接受因为将永不过期的令牌凭据写入到可读取的 API 对象而带来的安全风险时,
1486+
才应该创建服务账号令牌 Secret 对象。
1487+
1488+
<!--
14511489
When using this Secret type, you need to ensure that the
14521490
`kubernetes.io/service-account.name` annotation is set to an existing
1453-
service account name. A Kubernetes
1454-
{{< glossary_tooltip text="controller" term_id="controller" >}} fills in some
1455-
other fields such as the `kubernetes.io/service-account.uid` annotation, and the
1456-
`token` key in the `data` field, which is set to contain an authentication
1457-
token.
1491+
service account name. If you are creating both the ServiceAccount and
1492+
the Secret objects, you should create the ServiceAccount object first.
1493+
-->
1494+
使用这种 Secret 类型时,你需要确保对象的注解 `kubernetes.io/service-account-name`
1495+
被设置为某个已有的服务账号名称。
1496+
如果你同时负责 ServiceAccount 和 Secret 对象的创建,应该先创建 ServiceAccount 对象。
1497+
1498+
<!--
1499+
1500+
After the Secret is created, a Kubernetes {{< glossary_tooltip text="controller" term_id="controller" >}}
1501+
fills in some other fields such as the `kubernetes.io/service-account.uid` annotation, and the
1502+
`token` key in the `data` field, which is set to contain an authentication token.
14581503
14591504
The following example configuration declares a service account token Secret:
14601505
-->
1461-
### 服务账号令牌 Secret {#service-account-token-secrets}
1462-
1463-
类型为 `kubernetes.io/service-account-token` 的 Secret 用来存放标识某
1464-
{{< glossary_tooltip text="服务账号" term_id="service-account" >}}的令牌。
1465-
使用这种 Secret 类型时,你需要确保对象的注解 `kubernetes.io/service-account-name`
1466-
被设置为某个已有的服务账号名称。某个 Kubernetes
1467-
{{< glossary_tooltip text="控制器" term_id="controller" >}}会填写 Secret
1468-
的其它字段,例如 `kubernetes.io/service-account.uid` 注解以及 `data` 字段中的
1506+
当 Secret 对象被创建之后,某个 Kubernetes{{< glossary_tooltip text="控制器" term_id="controller" >}}会填写
1507+
Secret 的其它字段,例如 `kubernetes.io/service-account.uid` 注解以及 `data` 字段中的
14691508
`token` 键值,使之包含实际的令牌内容。
14701509
14711510
下面的配置实例声明了一个服务账号令牌 Secret:
@@ -1498,34 +1537,23 @@ data:
14981537
```
14991538
15001539
<!--
1501-
When creating a `Pod`, Kubernetes automatically finds or creates a service account
1502-
Secret and then automatically modifies your Pod to use this Secret. The service account
1503-
token Secret contains credentials for accessing the Kubernetes API.
1504-
1505-
The automatic creation and use of API credentials can be disabled or
1506-
overridden if desired. However, if all you need to do is securely access the
1507-
API server, this is the recommended workflow.
1540+
After creating the Secret, wait for Kubernetes to populate the `token` key in the `data` field.
15081541
-->
1509-
Kubernetes 在创建 Pod 时会自动寻找或创建一个服务账号 Secret 并自动修改你的 Pod
1510-
以使用该 Secret。该服务账号令牌 Secret 中包含了访问 Kubernetes API
1511-
所需要的凭据。
1512-
1513-
如果需要,可以禁止或者重载这种自动创建并使用 API 凭据的操作。
1514-
不过,如果你仅仅是希望能够安全地访问 API 服务器,这是建议的工作方式。
1542+
创建了 Secret 之后,等待 Kubernetes 在 `data` 字段中填充 `token` 主键。
15151543

15161544
<!--
15171545
See the [ServiceAccount](/docs/tasks/configure-pod-container/configure-service-account/)
15181546
documentation for more information on how service accounts work.
15191547
You can also check the `automountServiceAccountToken` field and the
15201548
`serviceAccountName` field of the
15211549
[`Pod`](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#pod-v1-core)
1522-
for information on referencing service account from Pods.
1550+
for information on referencing service account credentials from within Pods.
15231551
-->
15241552
参考 [ServiceAccount](/zh/docs/tasks/configure-pod-container/configure-service-account/)
15251553
文档了解服务账号的工作原理。你也可以查看
15261554
[`Pod`](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#pod-v1-core)
15271555
资源中的 `automountServiceAccountToken` 和 `serviceAccountName` 字段文档,
1528-
进一步了解从 Pod 中引用服务账号
1556+
进一步了解从 Pod 中引用服务账号凭据
15291557

15301558
<!--
15311559
### Docker config Secrets

content/zh-cn/docs/concepts/scheduling-eviction/assign-pod-node.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,11 @@ same zone currently running Pods with the `Security=S2` Pod label.
551551
并且节点具有标签 `topology.kubernetes.io/zone=R`,Pod 不能被调度到该节点上。
552552

553553
<!--
554-
See the
555-
[design doc](https://git.k8s.io/community/contributors/design-proposals/scheduling/podaffinity.md)
556-
for many more examples of Pod affinity and anti-affinity.
554+
To get yourself more familiar with the examples of Pod affinity and anti-affinity,
555+
refer to the [design proposal](https://github.com/kubernetes/design-proposals-archive/blob/main/scheduling/podaffinity.md).
557556
-->
558-
查阅[设计文档](https://git.k8s.io/community/contributors/design-proposals/scheduling/podaffinity.md)
559-
以了解 Pod 亲和性与反亲和性的更多示例
557+
查阅[设计文档](https://github.com/kubernetes/design-proposals-archive/blob/main/scheduling/podaffinity.md)
558+
以进一步熟悉 Pod 亲和性与反亲和性的示例
560559

561560
<!--
562561
You can use the `In`, `NotIn`, `Exists` and `DoesNotExist` values in the

content/zh-cn/docs/concepts/scheduling-eviction/pod-overhead.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,11 @@ map[cpu:250m memory:120Mi]
151151
```
152152
153153
<!--
154-
If a ResourceQuota is defined, the sum of container requests as well as the
154+
If a [ResourceQuota](/docs/concepts/policy/resource-quotas/) is defined, the sum of container requests as well as the
155155
`overhead` field are counted.
156156
-->
157-
如果定义了 ResourceQuata, 则容器请求的总量以及 `overhead` 字段都将计算在内。
157+
如果定义了 [ResourceQuata](/zh/docs/concepts/policy/resource-quotas/),
158+
则容器请求的总量以及 `overhead` 字段都将计算在内。
158159
159160
<!--
160161
When the kube-scheduler is deciding which node should run a new Pod, the scheduler considers that Pod's

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

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
---
22
title: Pod 安全性标准
3+
description: >
4+
详细了解 Pod 安全性标准(Pod Security Standards)中所定义的不同策略级别。
35
content_type: concept
46
weight: 10
57
---
68
<!--
79
reviewers:
810
- tallclair
911
title: Pod Security Standards
12+
description: >
13+
A detailed look at the different policy levels defined in the Pod Security Standards.
1014
content_type: concept
1115
weight: 10
1216
-->
@@ -49,18 +53,17 @@ Pod 安全性标准定义了三种不同的 _策略(Policy)_,以广泛覆
4953
**The _Privileged_ policy is purposely-open, and entirely unrestricted.** This type of policy is
5054
typically aimed at system- and infrastructure-level workloads managed by privileged, trusted users.
5155
52-
The privileged policy is defined by an absence of restrictions. For allow-by-default enforcement
53-
mechanisms (such as gatekeeper), the privileged profile may be an absence of applied constraints
54-
rather than an instantiated policy. In contrast, for a deny-by-default mechanism (such as Pod
55-
Security Policy) the privileged policy should enable all controls (disable all restrictions).
56+
The Privileged policy is defined by an absence of restrictions. Allow-by-default
57+
mechanisms (such as gatekeeper) may be Privileged by default. In contrast, for a deny-by-default mechanism (such as Pod
58+
Security Policy) the Privileged policy should disable all restrictions.
5659
-->
5760
**_Privileged_ 策略是有目的地开放且完全无限制的策略。**
5861
此类策略通常针对由特权较高、受信任的用户所管理的系统级或基础设施级负载。
5962

60-
Privileged 策略定义中限制较少。对于默认允许(Allow-by-default)实施机制(例如 gatekeeper)
61-
Privileged 框架可能意味着不应用任何约束而不是实施某策略实例
62-
与此不同,对于默认拒绝(Deny-by-default)实施机制(如 Pod 安全策略)而言,
63-
Privileged 策略应该默认允许所有控制(即,禁止所有限制)
63+
Privileged 策略定义中限制较少。默认允许的(Allow-by-default)实施机制(例如 gatekeeper)
64+
可以缺省设置为 Privileged
65+
与此不同,对于默认拒绝(Deny-by-default)的实施机制(如 Pod 安全策略)而言,
66+
Privileged 策略应该禁止所有限制
6467

6568
### Baseline
6669

@@ -842,6 +845,22 @@ of individual policies are not defined here.
842845
- {{< example file="policy/baseline-psp.yaml" >}}Baseline{{< /example >}}
843846
- {{< example file="policy/restricted-psp.yaml" >}}Restricted{{< /example >}}
844847

848+
<!--
849+
### Alternatives
850+
-->
851+
### 替代方案 {#alternatives}
852+
853+
{{% thirdparty-content %}}
854+
855+
<!--
856+
Other alternatives for enforcing policies are being developed in the Kubernetes ecosystem, such as:
857+
-->
858+
在 Kubernetes 生态系统中还在开发一些其他的替代方案,例如:
859+
860+
- [Kubewarden](https://github.com/kubewarden)
861+
- [Kyverno](https://kyverno.io/policies/pod-security/)
862+
- [OPA Gatekeeper](https://github.com/open-policy-agent/gatekeeper)
863+
845864
<!--
846865
## FAQ
847866
@@ -863,8 +882,8 @@ SIG Auth may reconsider this position in the future, should a clear need for oth
863882
这里定义的三种策略框架有一个明晰的线性递进关系,从最安全(Restricted)到最不安全,
864883
并且覆盖了很大范围的工作负载。特权要求超出 Baseline 策略者通常是特定于应用的需求,
865884
所以我们没有在这个范围内提供标准框架。
866-
这并不意味着在这样的情形下仍然只能使用 Privileged 框架,只是说处于这个范围的
867-
策略需要因地制宜地定义
885+
这并不意味着在这样的情形下仍然只能使用 Privileged 框架,
886+
只是说处于这个范围的策略需要因地制宜地定义
868887

869888
SIG Auth 可能会在将来考虑这个范围的框架,前提是有对其他框架的需求。
870889

@@ -878,31 +897,20 @@ in the Pod manifest, and represent parameters to the container runtime.
878897
### 安全策略与安全上下文的区别是什么?
879898

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

884903
<!--
885904
Security profiles are control plane mechanisms to enforce specific settings in the Security Context,
886905
as well as other related parameters outside the Security Context. As of July 2021,
887906
[Pod Security Policies](/docs/concepts/security/pod-security-policy/) are deprecated in favor of the
888907
built-in [Pod Security Admission Controller](/docs/concepts/security/pod-security-admission/).
889-
890-
Other alternatives for enforcing security profiles are being developed in the Kubernetes
891-
ecosystem, such as:
892-
- [OPA Gatekeeper](https://github.com/open-policy-agent/gatekeeper).
893-
- [Kubewarden](https://github.com/kubewarden).
894-
- [Kyverno](https://kyverno.io/policies/pod-security/).
895908
-->
896909
安全策略则是控制面用来对安全上下文以及安全性上下文之外的参数实施某种设置的机制。
897910
在 2020 年 7 月,
898911
[Pod 安全性策略](/zh/docs/concepts/security/pod-security-policy/)已被废弃,
899912
取而代之的是内置的 [Pod 安全性准入控制器](/zh/docs/concepts/security/pod-security-admission/)
900913

901-
Kubernetes 生态系统中还在开发一些其他的替代方案,例如
902-
- [OPA Gatekeeper](https://github.com/open-policy-agent/gatekeeper)
903-
- [Kubewarden](https://github.com/kubewarden)
904-
- [Kyverno](https://kyverno.io/policies/pod-security/)
905-
906914
<!--
907915
### What profiles should I apply to my Windows Pods?
908916
@@ -914,27 +922,26 @@ such, no standardized Pod Security profiles currently exists.
914922
### 我应该为我的 Windows Pod 实施哪种框架?
915923

916924
Kubernetes 中的 Windows 负载与标准的基于 Linux 的负载相比有一些局限性和区别。
917-
尤其是 Pod SecurityContext 字段
918-
[对 Windows 不起作用](/zh/docs/setup/production-environment/windows/intro-windows-in-kubernetes/#v1-podsecuritycontext)
925+
尤其是 Pod SecurityContext
926+
字段[对 Windows 不起作用](/zh/docs/setup/production-environment/windows/intro-windows-in-kubernetes/#v1-podsecuritycontext)
919927
因此,目前没有对应的标准 Pod 安全性框架。
920928

921-
922929
<!--
923930
If you apply the restricted profile for a Windows pod, this **may** have an impact on the pod
924931
at runtime. The restricted profile requires enforcing Linux-specific restrictions (such as seccomp
925932
profile, and disallowing privilege escalation). If the kubelet and / or its container runtime ignore
926933
these Linux-specific values, then the Windows pod should still work normally within the restricted
927934
profile. However, the lack of enforcement means that there is no additional restriction, for Pods
928935
that use Windows containers, compared to the baseline profile.
929-
930-
The use of the HostProcess flag to create a HostProcess pod should only be done in alignment with the privileged policy. Creation of a Windows HostProcess pod is blocked under the baseline and restricted policies, so any HostProcess pod should be considered privileged.
931936
-->
932-
933937
如果你为一个 Windows Pod 应用了 Restricted 策略,**可能会** 对该 Pod 的运行时产生影响。
934938
Restricted 策略需要强制执行 Linux 特有的限制(如 seccomp Profile,并且禁止特权提升)。
935939
如果 kubelet 和/或其容器运行时忽略了 Linux 特有的值,那么应该不影响 Windows Pod 正常工作。
936940
然而,对于使用 Windows 容器的 Pod 来说,缺乏强制执行意味着相比于 Restricted 策略,没有任何额外的限制。
937941

942+
<!--
943+
The use of the HostProcess flag to create a HostProcess pod should only be done in alignment with the privileged policy. Creation of a Windows HostProcess pod is blocked under the baseline and restricted policies, so any HostProcess pod should be considered privileged.
944+
-->
938945
你应该只在 Privileged 策略下使用 HostProcess 标志来创建 HostProcess Pod。
939946
在 Baseline 和 Restricted 策略下,创建 Windows HostProcess Pod 是被禁止的,
940947
因此任何 HostProcess Pod 都应该被认为是有特权的。
@@ -945,22 +952,24 @@ Restricted 策略需要强制执行 Linux 特有的限制(如 seccomp Profile
945952
There is not currently an API standard that controls whether a Pod is considered sandboxed or
946953
not. Sandbox Pods may be identified by the use of a sandboxed runtime (such as gVisor or Kata
947954
Containers), but there is no standard definition of what a sandboxed runtime is.
955+
-->
956+
### 沙箱(Sandboxed) Pod 怎么处理?
957+
958+
现在还没有 API 标准来控制 Pod 是否被视作沙箱化 Pod。
959+
沙箱 Pod 可以通过其是否使用沙箱化运行时(如 gVisor 或 Kata Container)来辨别,
960+
不过目前还没有关于什么是沙箱化运行时的标准定义。
948961

962+
<!--
949963
The protections necessary for sandboxed workloads can differ from others. For example, the need to
950964
restrict privileged permissions is lessened when the workload is isolated from the underlying
951965
kernel. This allows for workloads requiring heightened permissions to still be isolated.
952966
953967
Additionally, the protection of sandboxed workloads is highly dependent on the method of
954968
sandboxing. As such, no single recommended policy is recommended for all sandboxed workloads.
955969
-->
956-
### 沙箱(Sandboxed) Pod 怎么处理?
957-
958-
现在还没有 API 标准来控制 Pod 是否被视作沙箱化 Pod。
959-
沙箱 Pod 可以通过其是否使用沙箱化运行时(如 gVisor 或 Kata Container)来辨别,不过
960-
目前还没有关于什么是沙箱化运行时的标准定义。
961-
962970
沙箱化负载所需要的保护可能彼此各不相同。例如,当负载与下层内核直接隔离开来时,
963971
限制特权化操作的许可就不那么重要。这使得那些需要更多许可权限的负载仍能被有效隔离。
964972

965973
此外,沙箱化负载的保护高度依赖于沙箱化的实现方法。
966974
因此,现在还没有针对所有沙箱化负载的建议策略。
975+

0 commit comments

Comments
 (0)