Skip to content

Commit bb3e36d

Browse files
authored
Merge pull request #29368 from howieyuen/tutorial
[zh]sync tutorials files for 1.22
2 parents 2429254 + 9075aa2 commit bb3e36d

File tree

9 files changed

+156
-34
lines changed

9 files changed

+156
-34
lines changed

content/zh/docs/tutorials/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ Kubernetes 文档的这一部分包含教程。每个教程展示了如何完成
9999
<!--
100100
## Clusters
101101
102-
* [AppArmor](/docs/tutorials/clusters/apparmor/)
102+
* [seccomp](/docs/tutorials/clusters/seccomp/)
103103
-->
104104
## 集群
105105

106-
* [AppArmor](/zh/docs/tutorials/clusters/apparmor/)
106+
* [seccomp](/zh/docs/tutorials/clusters/seccomp/)
107107

108108
<!--
109109
## Services

content/zh/docs/tutorials/clusters/apparmor.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,15 @@ node with the required profile. -->
447447
<!-- ### Restricting profiles with the PodSecurityPolicy -->
448448
### 使用 PodSecurityPolicy 限制配置文件
449449

450+
{{< note >}}
451+
<!--
452+
PodSecurityPolicy is deprecated in Kubernetes v1.21, and will be removed in v1.25.
453+
See [PodSecurityPolicy documentation](/docs/concepts/policy/pod-security-policy/) for more information.
454+
-->
455+
PodSecurityPolicy 在 Kubernetes v1.21 版本中已被废弃,将在 v1.25 版本移除。
456+
查看 [PodSecurityPolicy 文档](/zh/docs/concepts/policy/pod-security-policy/)获取更多信息。
457+
{{< /note >}}
458+
450459
<!-- If the PodSecurityPolicy extension is enabled, cluster-wide AppArmor restrictions can be applied. To
451460
enable the PodSecurityPolicy, the following flag must be set on the `apiserver`: -->
452461
如果启用了 PodSecurityPolicy 扩展,则可以应用群集范围的 AppArmor 限制。要启用 PodSecurityPolicy,必须在“apiserver”上设置以下标志:

content/zh/docs/tutorials/clusters/seccomp.md

Lines changed: 113 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: 使用 Seccomp 限制容器的系统调用
33
content_type: tutorial
44
weight: 20
5+
min-kubernetes-server-version: v1.22
56
---
67

78
<!-- overview -->
@@ -10,7 +11,7 @@ weight: 20
1011

1112
<!--
1213
Seccomp stands for secure computing mode and has been a feature of the Linux
13-
kernel since version 2.6.12. It can be used to sandbox the privileges of a
14+
kernel since version 2.6.12. It can be used to sandbox the privileges of a
1415
process, restricting the calls it is able to make from userspace into the
1516
kernel. Kubernetes lets you automatically apply seccomp profiles loaded onto a
1617
Node to your Pods and containers.
@@ -49,20 +50,118 @@ Kubernetes 允许你将加载到节点上的 seccomp 配置文件自动应用于
4950

5051
## {{% heading "prerequisites" %}}
5152

53+
{{< version-check >}}
54+
5255
<!--
5356
In order to complete all steps in this tutorial, you must install
5457
[kind](https://kind.sigs.k8s.io/docs/user/quick-start/) and
5558
[kubectl](/docs/tasks/tools/). This tutorial will show examples
56-
with both alpha (pre-v1.19) and generally available seccomp functionality, so
59+
both alpha (new in v1.22) and generally available seccomp functionality. You should
5760
make sure that your cluster is [configured
5861
correctly](https://kind.sigs.k8s.io/docs/user/quick-start/#setting-kubernetes-version)
5962
for the version you are using.
6063
-->
6164
为了完成本教程中的所有步骤,你必须安装 [kind](https://kind.sigs.k8s.io/docs/user/quick-start/)
62-
[kubectl](/zh/docs/tasks/tools/)。本教程将显示同时具有 alpha(v1.19 之前的版本)
63-
和通常可用的 seccomp 功能的示例,因此请确保为所使用的版本[正确配置](https://kind.sigs.k8s.io/docs/user/quick-start/#setting-kubernetes-version)了集群。
65+
[kubectl](/zh/docs/tasks/tools/)。本教程将显示同时具有 alpha(v1.22 新版本)
66+
和通常可用的 seccomp 功能的示例。
67+
你应该确保为所使用的版本[正确配置](https://kind.sigs.k8s.io/docs/user/quick-start/#setting-kubernetes-version)了集群。
6468

6569
<!-- steps -->
70+
71+
<!--
72+
## Enable the use of `RuntimeDefault` as the default seccomp profile for all workloads
73+
74+
{{< feature-state state="alpha" for_k8s_version="v1.22" >}}
75+
76+
`SeccompDefault` is an optional kubelet
77+
[feature gate](/docs/reference/command-line-tools-reference/feature-gates) as
78+
well as corresponding `--seccomp-default`
79+
[command line flag](/docs/reference/command-line-tools-reference/kubelet).
80+
Both have to be enabled simultaneously to use the feature.
81+
-->
82+
## 启用 `RuntimeDefault` 作为所有工作负载的默认 seccomp 配置文件
83+
84+
{{< feature-state state="alpha" for_k8s_version="v1.22" >}}
85+
86+
`SeccompDefault` 是一个可选的 kubelet
87+
[特性门控](/zh/docs/reference/command-line-tools-reference/feature-gates)
88+
相应地,`--seccomp-default` 是此特性门控的
89+
[命令行标志](/zh/docs/reference/command-line-tools-reference/kubelet)
90+
必须同时启用两者才能使用该功能。
91+
92+
<!--
93+
If enabled, the kubelet will use the `RuntimeDefault` seccomp profile by default, which is
94+
defined by the container runtime, instead of using the `Unconfined` (seccomp disabled) mode.
95+
The default profiles aim to provide a strong set
96+
of security defaults while preserving the functionality of the workload. It is
97+
possible that the default profiles differ between container runtimes and their
98+
release versions, for example when comparing those from CRI-O and containerd.
99+
-->
100+
如果启用,kubelet 将默认使用 `RuntimeDefault` seccomp 配置,
101+
而不是使用 `Unconfined`(禁用 seccomp)模式,该配置由容器运行时定义。
102+
默认配置旨在提供一组强大的安全默认值设置,同时避免影响工作负载的功能。
103+
不同的容器运行时之间及其不同的发布版本之间的默认配置可能不同,
104+
例如在比较 CRI-O 和 containerd 的配置文件时(就会发现这点)。
105+
106+
<!--
107+
Some workloads may require a lower amount of syscall restrictions than others.
108+
This means that they can fail during runtime even with the `RuntimeDefault`
109+
profile. To mitigate such a failure, you can:
110+
111+
- Run the workload explicitly as `Unconfined`.
112+
- Disable the `SeccompDefault` feature for the nodes. Also making sure that
113+
workloads get scheduled on nodes where the feature is disabled.
114+
- Create a custom seccomp profile for the workload.
115+
-->
116+
某些工作负载可能相比其他工作负载需要更少的系统调用限制。
117+
这意味着即使使用 `RuntimeDefault` 配置文件,它们也可能在运行时失败。
118+
要处理此类失效,你可以:
119+
120+
- 将工作负载显式运行为 `Unconfined`
121+
- 禁用节点的 `SeccompDefault` 功能。
122+
还要确保工作负载被安排在禁用该功能的节点上。
123+
- 为工作负载创建自定义 seccomp 配置文件。
124+
125+
<!--
126+
If you were introducing this feature into production-like cluster, the Kubernetes project
127+
recommends that you enable this feature gate on a subset of your nodes and then
128+
test workload execution before rolling the change out cluster-wide.
129+
130+
More detailed information about a possible upgrade and downgrade strategy can be
131+
found in the [related Kubernetes Enhancement Proposal (KEP)](https://github.com/kubernetes/enhancements/tree/a70cc18/keps/sig-node/2413-seccomp-by-default#upgrade--downgrade-strategy).
132+
-->
133+
如果你将此功能引入到类似生产的集群中,
134+
Kubernetes 项目建议你在节点的子集上启用此特性门控,
135+
然后在集群范围内推出更改之前测试工作负载的执行情况。
136+
137+
有关可能的升级和降级策略的更多详细信息,
138+
请参见[相关 Kubernetes 增强提案 (KEP)](https://github.com/kubernetes/enhancements/tree/a70cc18/keps/sig-node/2413-seccomp-by-default#upgrade--downgrade-strategy)
139+
140+
<!--
141+
Since the feature is in alpha state it is disabled per default. To enable it,
142+
pass the flags `--feature-gates=SeccompDefault=true --seccomp-default` to the
143+
`kubelet` CLI or enable it via the [kubelet configuration
144+
file](/docs/tasks/administer-cluster/kubelet-config-file/). To enable the
145+
feature gate in [kind](https://kind.sigs.k8s.io), ensure that `kind` provides
146+
the minimum required Kubernetes version and enables the `SeccompDefault` feature
147+
[in the kind configuration](https://kind.sigs.k8s.io/docs/user/quick-start/#enable-feature-gates-in-your-cluster):
148+
-->
149+
由于该功能处于 alpha 状态,因此默认情况下是被禁用的。要启用它,
150+
请将标志 `--feature-gates=SeccompDefault=true --seccomp-default`
151+
传递给 `kubelet` CLI 或通过
152+
[kubelet 配置文件](/zh/docs/tasks/administer-cluster/kubelet-config-file/)启用它。
153+
要在 [kind](https://kind.sigs.k8s.io) 中启用特性门控,
154+
请确保 `kind` 提供所需的最低 Kubernetes 版本并
155+
[在 kind 配置中](https://kind.sigs.k8s.io/docs/user/quick-start/#enable-feature-gates-in-your-cluster)
156+
启用 `SeccompDefault` 功能:
157+
158+
```yaml
159+
kind: Cluster
160+
apiVersion: kind.x-k8s.io/v1alpha4
161+
featureGates:
162+
SeccompDefault: true
163+
```
164+
66165
<!--
67166
## Create Seccomp Profiles
68167
@@ -151,14 +250,14 @@ audit.json fine-grained.json violation.json
151250
```
152251
153252
<!--
154-
## Create a Pod with a Seccomp profile for syscall auditing
253+
## Create a Pod with a seccomp profile for syscall auditing
155254
156255
To start off, apply the `audit.json` profile, which will log all syscalls of the
157256
process, to a new Pod.
158257
159258
Download the correct manifest for your Kubernetes version:
160259
-->
161-
## 使用 Seccomp 配置文件创建 Pod 以进行系统调用审核
260+
## 使用 seccomp 配置文件创建 Pod 以进行系统调用审核
162261
163262
首先,将 `audit.json` 配置文件应用到新的 Pod 中,该配置文件将记录该进程的所有系统调用。
164263
@@ -297,14 +396,14 @@ kubectl delete svc/audit-pod
297396
```
298397
299398
<!--
300-
## Create Pod with Seccomp Profile that Causes Violation
399+
## Create Pod with seccomp Profile that Causes Violation
301400
302401
For demonstration, apply a profile to the Pod that does not allow for any
303402
syscalls.
304403
305404
Download the correct manifest for your Kubernetes version:
306405
-->
307-
## 使用导致违规的 Seccomp 配置文件创建 Pod
406+
## 使用导致违规的 seccomp 配置文件创建 Pod
308407
309408
为了进行演示,请将不允许任何系统调用的配置文件应用于 Pod。
310409
@@ -364,7 +463,7 @@ kubectl delete svc/violation-pod
364463
```
365464
366465
<!--
367-
## Create Pod with Seccomp Profile that Only Allows Necessary Syscalls
466+
## Create Pod with seccomp Profile that Only Allows Necessary Syscalls
368467
369468
If you take a look at the `fine-pod.json`, you will notice some of the syscalls
370469
seen in the first example where the profile set `"defaultAction":
@@ -375,7 +474,7 @@ sent to `syslog`.
375474
376475
Download the correct manifest for your Kubernetes version:
377476
-->
378-
## 使用设置仅允许需要的系统调用的配置文件来创建 Pod
477+
## 使用设置仅允许需要的系统调用的 seccomp 配置文件来创建 Pod
379478
380479
如果你看一下 `fine-pod.json` 文件,你会注意到在第一个示例中配置文件设置为 `"defaultAction": "SCMP_ACT_LOG"` 的一些系统调用。
381480
现在,配置文件设置为 `"defaultAction": "SCMP_ACT_ERRNO"`,但是在 `"action": "SCMP_ACT_ALLOW"` 块中明确允许一组系统调用。
@@ -482,7 +581,7 @@ kubectl delete svc/fine-pod
482581
```
483582
484583
<!--
485-
## Create Pod that uses the Container Runtime Default Seccomp Profile
584+
## Create Pod that uses the Container Runtime Default seccomp Profile
486585
487586
Most container runtimes provide a sane set of default syscalls that are allowed
488587
or not. The defaults can easily be applied in Kubernetes by using the
@@ -491,7 +590,7 @@ of a pod or container to `RuntimeDefault`.
491590
492591
Download the correct manifest for your Kubernetes version:
493592
-->
494-
## 使用容器运行时默认的 Seccomp 配置文件创建 Pod
593+
## 使用容器运行时默认的 seccomp 配置文件创建 Pod
495594
496595
大多数容器运行时都提供一组允许或不允许的默认系统调用。通过使用 `runtime/default` 注释
497596
或将 Pod 或容器的安全上下文中的 seccomp 类型设置为 `RuntimeDefault`,可以轻松地在 Kubernetes 中应用默认值。
@@ -518,10 +617,10 @@ The default seccomp profile should provide adequate access for most workloads.
518617
<!--
519618
Additional resources:
520619
521-
* [A Seccomp Overview](https://lwn.net/Articles/656307/)
620+
* [A seccomp Overview](https://lwn.net/Articles/656307/)
522621
* [Seccomp Security Profiles for Docker](https://docs.docker.com/engine/security/seccomp/)
523622
-->
524623
额外的资源:
525624
526-
* [Seccomp 概要](https://lwn.net/Articles/656307/)
625+
* [seccomp 概要](https://lwn.net/Articles/656307/)
527626
* [Seccomp 在 Docker 中的安全配置](https://docs.docker.com/engine/security/seccomp/)

content/zh/docs/tutorials/configuration/configure-redis-using-configmap.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Apply the ConfigMap created above, along with a Redis pod manifest:
7979

8080
```shell
8181
kubectl apply -f example-redis-config.yaml
82-
kubectl apply -f https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/pods/config/redis-pod.yaml
82+
kubectl apply -f https://k8s.io/examples/pods/config/redis-pod.yaml
8383
```
8484

8585
<!--
@@ -298,7 +298,7 @@ values from associated ConfigMaps. Let's delete and recreate the Pod:
298298

299299
```shell
300300
kubectl delete pod redis
301-
kubectl apply -f https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/pods/config/redis-pod.yaml
301+
kubectl apply -f https://k8s.io/examples/pods/config/redis-pod.yaml
302302
```
303303

304304
<!--

content/zh/docs/tutorials/hello-minikube.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,32 @@ This tutorial provides a container image that uses NGINX to echo back all the re
110110
4. 仅限 Katacoda 环境:输入“30000”,然后单击 **显示端口**
111111

112112
<!--
113-
The `dashboard` command enables the dashboard add-on and opens the proxy in the default web browser. You can create Kubernetes resources on the dashboard such as Deployment and Service.
113+
The `dashboard` command enables the dashboard add-on and opens the proxy in the default web browser.
114+
You can create Kubernetes resources on the dashboard such as Deployment and Service.
114115
115116
If you are running in an environment as root, see [Open Dashboard with URL](#open-dashboard-with-url).
116117
117-
To stop the proxy, run `Ctrl+C` to exit the process. The dashboard remains running.
118+
By default, the dashboard is only accessible from within the internal Kubernetes virtual network.
119+
The `dashboard` command creates a temporary proxy to make the dashboard accessible from outside the Kubernetes virtual network.
120+
121+
To stop the proxy, run `Ctrl+C` to exit the process.
122+
After the command exits, the dashboard remains running in Kubernetes cluster.
123+
You can run the `dashboard` command again to create another proxy to access the dashboard.
118124
-->
119125
{{< note >}}
120-
`dashboard` 命令启用仪表板插件,并在默认的 Web 浏览器中打开代理。你可以在仪表板上创建 Kubernetes 资源,例如 Deployment 和 Service。
126+
`dashboard` 命令启用仪表板插件,并在默认的 Web 浏览器中打开代理。
127+
你可以在仪表板上创建 Kubernetes 资源,例如 Deployment 和 Service。
121128

122129
如果你以 root 用户身份在环境中运行,
123130
请参见[使用 URL 打开仪表板](#open-dashboard-with-url)
124131

132+
默认情况下,仪表板只能从内部 Kubernetes 虚拟网络中访问。
133+
`dashboard` 命令创建一个临时代理,使仪表板可以从 Kubernetes 虚拟网络外部访问。
134+
125135
要停止代理,请运行 `Ctrl+C` 退出该进程。仪表板仍在运行中。
136+
命令退出后,仪表板仍然在 Kubernetes 集群中运行。
137+
你可以再次运行 `dashboard` 命令创建另一个代理来访问仪表板。
138+
126139
{{< /note >}}
127140

128141
<!--
@@ -387,7 +400,7 @@ Minikube 有一组内置的 {{< glossary_tooltip text="插件" term_id="addons"
387400
输出结果类似于这样:
388401

389402
```
390-
metrics-server was successfully enabled
403+
The 'metrics-server' addon is enabled
391404
```
392405

393406
<!--

content/zh/docs/tutorials/stateful-application/basic-stateful-set.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,16 +1239,16 @@ kubectl get pods -w -l app=nginx
12391239

12401240
<!--
12411241
Use [`kubectl delete`](/docs/reference/generated/kubectl/kubectl-commands/#delete) to delete the
1242-
StatefulSet. Make sure to supply the `--cascade=false` parameter to the
1242+
StatefulSet. Make sure to supply the `--cascade=orphan` parameter to the
12431243
command. This parameter tells Kubernetes to only delete the StatefulSet, and to
12441244
not delete any of its Pods.
12451245
-->
12461246

12471247
使用 [`kubectl delete`](/zh/docs/reference/generated/kubectl/kubectl-commands/#delete) 删除 StatefulSet。
1248-
请确保提供了 `--cascade=false` 参数给命令。这个参数告诉 Kubernetes 只删除 StatefulSet 而不要删除它的任何 Pod。
1248+
请确保提供了 `--cascade=orphan` 参数给命令。这个参数告诉 Kubernetes 只删除 StatefulSet 而不要删除它的任何 Pod。
12491249

12501250
```shell
1251-
kubectl delete statefulset web --cascade=false
1251+
kubectl delete statefulset web --cascade=orphan
12521252
```
12531253
```
12541254
statefulset.apps "web" deleted
@@ -1416,9 +1416,10 @@ kubectl get pods -w -l app=nginx
14161416

14171417
<!--
14181418
In another terminal, delete the StatefulSet again. This time, omit the
1419+
`--cascade=orphan` parameter.
14191420
-->
14201421

1421-
在另一个窗口中再次删除这个 StatefulSet。这次省略 `--cascade=false` 参数。
1422+
在另一个窗口中再次删除这个 StatefulSet。这次省略 `--cascade=orphan` 参数。
14221423

14231424
```shell
14241425
kubectl delete statefulset web

content/zh/docs/tutorials/stateful-application/cassandra.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ To complete this tutorial, you should already have a basic familiarity with
8787
### Additional Minikube setup instructions
8888
8989
{{< caution >}}
90-
[Minikube](https://minikube.sigs.k8s.io/docs/) defaults to 1024MiB of memory and 1 CPU.
90+
[Minikube](https://minikube.sigs.k8s.io/docs/) defaults to 2048MB of memory and 2 CPU.
9191
Running Minikube with the default resource configuration results in insufficient resource
9292
errors during this tutorial. To avoid these errors, start Minikube with the following settings:
9393
-->
9494
### 额外的 Minikube 设置说明
9595

9696
{{< caution >}}
97-
[Minikube](https://minikube.sigs.k8s.io/docs/)默认为 1024MiB 内存和 1 个 CPU。
97+
[Minikube](https://minikube.sigs.k8s.io/docs/)默认为 2048MB 内存和 2 个 CPU。
9898
在本教程中,使用默认资源配置运行 Minikube 会导致资源不足的错误。为避免这些错误,请使用以下设置启动 Minikube:
9999

100100
```shell

0 commit comments

Comments
 (0)