Skip to content

Commit cf44885

Browse files
authored
Merge pull request #39056 from Zhuzhenghao/kubelet-in-userns
[zh-cn] Resync kubelet-in-userns.md
2 parents 85b568e + 96779de commit cf44885

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

content/zh-cn/docs/tasks/administer-cluster/kubelet-in-userns.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
title: 以非 root 用户身份运行 Kubernetes 节点组件
33
content_type: task
44
min-kubernetes-server-version: 1.22
5+
weight: 300
56
---
67

78
<!--
89
title: Running Kubernetes Node Components as a Non-root User
910
content_type: task
1011
min-kubernetes-server-version: 1.22
12+
weight: 300
1113
-->
1214

1315
<!-- overview -->
@@ -21,7 +23,7 @@ without root privileges, by using a {{< glossary_tooltip text="user namespace" t
2123
This technique is also known as _rootless mode_.
2224
2325
{{< note >}}
24-
This document describes how to run Kubernetes Node components (and hence pods) a non-root user.
26+
This document describes how to run Kubernetes Node components (and hence pods) as a non-root user.
2527
2628
If you are just looking for how to run a pod as a non-root user, see [SecurityContext](/docs/tasks/configure-pod-container/security-context/).
2729
{{< /note >}}
@@ -318,6 +320,7 @@ the host with an external port forwarder, such as RootlessKit, slirp4netns, or
318320
You can use the port forwarder from K3s.
319321
See [Running K3s in Rootless Mode](https://rancher.com/docs/k3s/latest/en/advanced/#known-issues-with-rootless-mode)
320322
for more details.
323+
The implementation can be found in [the `pkg/rootlessports` package](https://github.com/k3s-io/k3s/blob/v1.22.3+k3s1/pkg/rootlessports/controller.go) of k3s.
321324
322325
### Configuring CRI
323326
@@ -343,6 +346,7 @@ Pod 的网络命名空间可以使用常规的 CNI 插件配置。对于多节
343346

344347
你可以使用 K3s 的端口转发器。更多细节请参阅
345348
[在 Rootless 模式下运行 K3s](https://rancher.com/docs/k3s/latest/en/advanced/#known-issues-with-rootless-mode)
349+
该实现可以在 k3s 的 [`pkg/rootlessports`](https://github.com/k3s-io/k3s/blob/v1.22.3+k3s1/pkg/rootlessports/controller.go)中找到。
346350

347351
### 配置 CRI
348352

@@ -355,8 +359,7 @@ kubelet 依赖于容器运行时。你需要部署一个容器运行时(例如
355359
356360
Running CRI plugin of containerd in a user namespace is supported since containerd 1.4.
357361
358-
Running containerd within a user namespace requires the following configurations
359-
in `/etc/containerd/containerd-config.toml`.
362+
Running containerd within a user namespace requires the following configurations.
360363
361364
```toml
362365
version = 2
@@ -379,6 +382,9 @@ version = 2
379382
SystemdCgroup = false
380383
```
381384
385+
The default path of the configuration file is `/etc/containerd/config.toml`.
386+
The path can be specified with `containerd -c /path/to/containerd/config.toml`.
387+
382388
{{% /tab %}}
383389
384390
{{% tab name="CRI-O" %}}
@@ -387,7 +393,7 @@ Running CRI-O in a user namespace is supported since CRI-O 1.22.
387393
388394
CRI-O requires an environment variable `_CRIO_ROOTLESS=1` to be set.
389395
390-
The following configurations (in `/etc/crio/crio.conf`) are also recommended:
396+
The following configurations are also recommended:
391397
392398
```toml
393399
[crio]
@@ -401,6 +407,8 @@ The following configurations (in `/etc/crio/crio.conf`) are also recommended:
401407
cgroup_manager = "cgroupfs"
402408
```
403409
410+
The default path of the configuration file is `/etc/crio/crio.conf`.
411+
The path can be specified with `crio --config /path/to/crio/crio.conf`.
404412
{{% /tab %}}
405413
{{< /tabs >}}
406414
-->
@@ -410,7 +418,7 @@ The following configurations (in `/etc/crio/crio.conf`) are also recommended:
410418

411419
containerd 1.4 开始支持在用户命名空间运行 containerd 的 CRI 插件。
412420

413-
在用户命名空间运行 containerd 需要在 `/etc/containerd/containerd-config.toml` 文件包含以下配置
421+
在用户命名空间运行 containerd 必须进行如下配置
414422

415423
```toml
416424
version = 2
@@ -432,7 +440,8 @@ version = 2
432440
# (除非你在命名空间内运行了另一个 systemd)
433441
SystemdCgroup = false
434442
```
435-
443+
配置文件的默认路径是 `/etc/containerd/config.toml`
444+
可以用 `containerd -c /path/to/containerd/config.toml` 来指定该路径。
436445
{{% /tab %}}
437446

438447
{{% tab name="CRI-O" %}}
@@ -441,7 +450,7 @@ CRI-O 1.22 开始支持在用户命名空间运行 CRI-O。
441450

442451
CRI-O 必须配置一个环境变量 `_CRIO_ROOTLESS=1`
443452

444-
也推荐使用 `/etc/crio/crio.conf` 文件内的以下配置
453+
也推荐使用以下配置
445454

446455
```toml
447456
[crio]
@@ -454,7 +463,8 @@ CRI-O 必须配置一个环境变量 `_CRIO_ROOTLESS=1`。
454463
# (除非你在命名空间内运行了另一个 systemd)
455464
cgroup_manager = "cgroupfs"
456465
```
457-
466+
配置文件的默认路径是 `/etc/containerd/config.toml`
467+
可以用 `containerd -c /path/to/containerd/config.toml` 来指定该路径。
458468
{{% /tab %}}
459469
{{< /tabs >}}
460470

0 commit comments

Comments
 (0)