Skip to content

Commit 9cf56e0

Browse files
committed
[zh-cn] sync home/* user-namespaces
Signed-off-by: xin.li <xin.li@daocloud.io>
1 parent c0f7a06 commit 9cf56e0

File tree

3 files changed

+68
-58
lines changed

3 files changed

+68
-58
lines changed

content/zh-cn/docs/home/_index.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,16 @@ hide_feedback: true
1212
menu:
1313
main:
1414
title: "文档"
15-
weight: 20
16-
post: >
17-
<p>通过概念、教程和参考文档了解如何使用 Kubernetes。你甚至可以<a href="/editdocs/" data-auto-burger-exclude data-proofer-ignore>帮助贡献文档</a>!</p>
15+
weight: 10
1816
# description: >
1917
# Kubernetes is an open source container orchestration engine for automating deployment, scaling, and management of containerized applications. The open source project is hosted by the Cloud Native Computing Foundation.
2018
description: >
21-
Kubernetes 是一个开源的容器编排引擎,用来对容器化应用进行自动部署、 扩缩和管理。此开源项目由云原生计算基金会(CNCF)托管。
19+
Kubernetes 是一个开源的容器编排引擎,用来对容器化应用进行自动部署、扩缩和管理。此开源项目由云原生计算基金会(CNCF)托管。
2220
2321
# overview:
2422
# Kubernetes is an open source container orchestration engine for automating deployment, scaling, and management of containerized applications. The open source project is hosted by the Cloud Native Computing Foundation (<a href="https://www.cncf.io/about">CNCF</a>).
2523
overview:
26-
Kubernetes 是一个开源的容器编排引擎,用来对容器化应用进行自动化部署、 扩缩和管理。该项目托管在 <a href="https://www.cncf.io/about">CNCF</a>。
24+
Kubernetes 是一个开源的容器编排引擎,用来对容器化应用进行自动化部署、扩缩和管理。该项目托管在 <a href="https://www.cncf.io/about">CNCF</a>。
2725

2826
cards:
2927
# - name: concepts
@@ -104,7 +102,11 @@ cards:
104102
# - name: about
105103
# title: About the documentation
106104
# description: This website contains documentation for the current and previous 4 versions of Kubernetes.
105+
# button: "See available versions"
106+
# button_path: "/docs/home/supported-doc-versions"
107107
- name: about
108108
title: 关于文档
109109
description: 本网站包含了当前及前 4 个版本的 Kubernetes 文档。
110+
button: "查看可用版本"
111+
button_path: "/zh-cn/docs/home/supported-doc-versions"
110112
---

content/zh-cn/docs/home/supported-doc-versions.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,13 @@
22
title: Kubernetes 文档支持的版本
33
content_type: custom
44
layout: supported-versions
5-
card:
6-
name: about
7-
weight: 10
8-
title: Kubernetes 文档支持的版本
5+
weight: 10
96
---
107
<!--
118
title: Available Documentation Versions
129
content_type: custom
1310
layout: supported-versions
14-
card:
15-
name: about
16-
weight: 10
17-
title: Available Documentation Versions
11+
weight: 10
1812
-->
1913
<!-- overview -->
2014

@@ -31,4 +25,5 @@ which versions of Kubernetes are officially supported, and for how long.
3125
本网站包含当前版本和之前四个版本的 Kubernetes 文档。
3226

3327
Kubernetes 版本的文档可用性与当前是否支持该版本是分开的。
34-
阅读[支持期限](/zh-cn/releases/patch-releases/#support-period),了解官方支持 Kubernetes 的哪些版本,以及支持多长时间。
28+
阅读[支持期限](/zh-cn/releases/patch-releases/#support-period),了解官方支持
29+
Kubernetes 的哪些版本,以及支持多长时间。
Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: 为 Pod 配置用户名字空间
2+
title: 为 Pod 配置 user 名字空间
33
reviewers:
44
content_type: task
55
weight: 210
@@ -15,14 +15,14 @@ min-kubernetes-server-version: v1.25
1515
-->
1616

1717
<!-- overview -->
18-
{{< feature-state for_k8s_version="v1.25" state="alpha" >}}
18+
{{< feature-state for_k8s_version="v1.25" state="beta" >}}
1919

2020
<!--
2121
This page shows how to configure a user namespace for stateless pods. This
2222
allows to isolate the user running inside the container from the one in the
2323
host.
2424
-->
25-
本页展示如何为无状态 Pod 配置用户名字空间。可以将容器内的用户与主机上的用户隔离开来。
25+
本页展示如何为无状态 Pod 配置 user 名字空间。可以将容器内的用户与主机上的用户隔离开来。
2626

2727
<!--
2828
A process running as root in a container can run as a different (non-root) user
@@ -31,7 +31,7 @@ inside the user namespace, but is unprivileged for operations outside the
3131
namespace.
3232
-->
3333
在容器中以 root 用户运行的进程可以以不同的(非 root)用户在宿主机上运行;换句话说,
34-
进程在用户名字空间内部拥有执行操作的全部特权,但在用户名字空间外部并没有执行操作的特权
34+
进程在 user 名字空间内部拥有执行操作的全部特权,但在 user 名字空间外部并没有执行操作的特权
3535

3636
<!--
3737
You can use this feature to reduce the damage a compromised container can do to
@@ -41,18 +41,18 @@ exploitable when user namespaces is active. It is expected user namespace will
4141
mitigate some future vulnerabilities too.
4242
-->
4343
你可以使用这个特性来减少有害的容器对同一宿主机上其他容器的影响。
44-
[有些安全脆弱性问题][KEP-vulns]被评为 **HIGH** or **CRITICAL**但当用户名字空间被启用时
45-
它们是无法被利用的。相信用户名字空间也能减轻一些未来的漏洞的影响
44+
[有些安全脆弱性问题][KEP-vulns]被评为 **HIGH** **CRITICAL**但当 user 名字空间被启用时
45+
它们是无法被利用的。相信 user 名字空间也能减轻一些未来的漏洞影响
4646

4747
<!--
4848
Without using a user namespace a container running as root, in the case of a
4949
container breakout, has root privileges on the node. And if some capability were
5050
granted to the container, the capabilities are valid on the host too. None of
5151
this is true when user namespaces are used.
5252
-->
53-
在不使用用户名字空间的情况下,对于以 root 用户运行的容器而言,发生容器逃逸时,
53+
在不使用 user 名字空间的情况下,对于以 root 用户运行的容器而言,发生容器逃逸时,
5454
容器将拥有在宿主机上的 root 特权。如果容器被赋予了某些权限,则这些权限在宿主机上同样有效。
55-
当使用用户名字空间时这些都不可能发生
55+
当使用 user 名字空间时这些都不可能发生
5656

5757
[KEP-vulns]: https://github.com/kubernetes/enhancements/tree/217d790720c5aef09b8bd4d6ca96284a0affe6c2/keps/sig-node/127-user-namespaces#motivation
5858

@@ -70,18 +70,18 @@ this is true when user namespaces are used.
7070
* You need to enable the `UserNamespacesSupport`
7171
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
7272
-->
73-
* 节点上的操作系统必须为 Linux
73+
* 节点的操作系统必须为 Linux
7474
* 你需要在宿主机上执行命令
7575
* 你需要能够通过 exec 操作进入 Pod
76-
* 你需要启用 `UserNamespacesSupport` [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
76+
* 你需要启用 `UserNamespacesSupport` [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
7777

7878
{{< note >}}
7979
<!--
8080
The feature gate to enable user namespaces was previously named
8181
`UserNamespacesStatelessPodsSupport`, when only stateless pods were supported.
8282
Only Kubernetes v1.25 through to v1.27 recognise `UserNamespacesStatelessPodsSupport`.
8383
-->
84-
在用户名字空间原来仅支持无状态的 Pod 时,启用用户名字空间的特性门控先前被命名为 `UserNamespacesStatelessPodsSupport`
84+
在 user 名字空间原来仅支持无状态的 Pod 时,启用 user 名字空间的特性门控先前被命名为 `UserNamespacesStatelessPodsSupport`
8585
只有 Kubernetes v1.25 到 v1.27 才能识别 `UserNamespacesStatelessPodsSupport`
8686
{{</ note >}}
8787

@@ -92,39 +92,29 @@ for using user namespaces with Pods.
9292
-->
9393
你所使用的集群**必须**包括至少一个符合
9494
[要求](/zh-cn/docs/concepts/workloads/pods/user-namespaces/#before-you-begin)
95-
的节点,以便为 Pod 配置用户名字空间
95+
的节点,以便为 Pod 配置 user 名字空间
9696

9797
<!--
9898
If you have a mixture of nodes and only some of the nodes provide user namespace support for
9999
Pods, you also need to ensure that the user namespace Pods are
100100
[scheduled](/docs/concepts/scheduling-eviction/assign-pod-node/) to suitable nodes.
101101
-->
102-
如果你有混合节点,并且只有部分节点支持为 Pod 配置用户名字空间
103-
你还需要确保配置了用户名字空间的 Pod
102+
如果你有混合节点,并且只有部分节点支持为 Pod 配置 user 名字空间
103+
你还需要确保配置了 user 名字空间的 Pod
104104
[调度](/zh-cn/docs/concepts/scheduling-eviction/assign-pod-node/)到合适的节点。
105105

106-
* CRI-O: v1.25 支持用户名字空间。
107-
108-
<!--
109-
Please note that **if your container runtime doesn't support user namespaces, the
110-
`hostUsers` field in the pod spec will be silently ignored and the pod will be
111-
created without user namespaces.**
112-
-->
113-
请注意 **如果你的容器运行时环境不支持用户名字空间,那么 Pod 规约中的 `hostUsers` 字段将被静默忽略,
114-
并且系统会在没有用户名字空间的环境中创建 Pod。**
115-
116106
<!-- steps -->
117107

118108
<!--
119109
## Run a Pod that uses a user namespace {#create-pod}
120110
-->
121-
## 运行一个使用用户名字空间的 Pod {#create-pod}
111+
## 运行一个使用 user 名字空间的 Pod {#create-pod}
122112

123113
<!--
124114
A user namespace for a pod is enabled setting the `hostUsers` field of `.spec`
125115
to `false`. For example:
126116
-->
127-
为一个 Pod 启用用户名字空间需要设置 `.spec``hostUsers` 字段为 `false`. 例如:
117+
为一个 Pod 启用 user 名字空间需要设置 `.spec``hostUsers` 字段为 `false`。例如:
128118

129119
{{% code_sample file="pods/user-namespaces-stateless.yaml" %}}
130120

@@ -147,15 +137,39 @@ to `false`. For example:
147137
```
148138

149139
<!--
150-
And run the command. The output is similar to this:
140+
Run this command:
151141
-->
152-
执行命令的输出类似于
142+
运行这个命令
153143

154-
```none
144+
```shell
155145
readlink /proc/self/ns/user
146+
```
147+
148+
<!--
149+
The output is similar to:
150+
-->
151+
输出类似于:
152+
153+
```shell
156154
user:[4026531837]
155+
```
156+
157+
<!--
158+
Also run:
159+
-->
160+
还运行:
161+
162+
```shell
157163
cat /proc/self/uid_map
158-
0 0 4294967295
164+
```
165+
166+
<!--
167+
The output is similar to:
168+
-->
169+
输出类似于:
170+
171+
```shell
172+
0 833617920 65536
159173
```
160174

161175
<!--
@@ -164,30 +178,29 @@ Then, open a shell in the host and run the same command.
164178
然后,在主机中打开一个 Shell 并运行相同的命令。
165179

166180
<!--
167-
The output must be different. This means the host and the pod are using a
168-
different user namespace. When user namespaces are not enabled, the host and the
169-
pod use the same user namespace.
181+
The `readlink` command shows the user namespace the process is running in. It
182+
should be different when it is run on the host and inside the container.
170183
-->
171-
输出一定是不同的。这意味着主机和 Pod 使用不同的用户名字空间。当未启用用户名字空间时,
172-
宿主机和 Pod 使用相同的用户名字空间。
184+
`readlink` 命令显示进程运行所在的用户命名空间。在主机上和容器内运行时应该有所不同。
185+
186+
<!--
187+
The last number of the `uid_map` file inside the container must be 65536, on the
188+
host it must be a bigger number.
189+
-->
190+
容器内 `uid_map` 文件的最后一个数字必须是 65536,在主机上它必须是更大的数字。
173191

174192
<!--
175193
If you are running the kubelet inside a user namespace, you need to compare the
176194
output from running the command in the pod to the output of running in the host:
177195
-->
178-
如果你在用户名字空间中运行 kubelet,则需要将在 Pod 中运行命令的输出与在主机中运行的输出进行比较:
196+
如果你在 user 名字空间中运行 kubelet,则需要将在 Pod 中运行命令的输出与在主机中运行的输出进行比较:
179197

180-
<!--
181-
```none
198+
```shell
182199
readlink /proc/$pid/ns/user
183-
user:[4026534732]
184200
```
185201

202+
<!--
186203
replacing `$pid` with the kubelet PID.
187204
-->
188-
```none
189-
readlink /proc/$pid/ns/user
190-
user:[4026534732]
191-
```
192205

193-
使用 kubelet 的进程号代替 `$pid`
206+
使用 kubelet 的进程号代替 `$pid`

0 commit comments

Comments
 (0)