Skip to content

Commit fac477b

Browse files
authored
Merge pull request #35946 from ydFu/update-seccomp
[zh] updated /tutorials/security/seccomp.md
2 parents bb8912e + b4514b5 commit fac477b

File tree

1 file changed

+60
-23
lines changed

1 file changed

+60
-23
lines changed

content/zh-cn/docs/tutorials/security/seccomp.md

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ into the cluster.
109109
现在先将它们下载到名为 `profiles/` 的目录中,以便将它们加载到集群中。
110110

111111
{{< tabs name="tab_with_code" >}}
112-
{{{< tab name="audit.json" >}}
112+
{{< tab name="audit.json" >}}
113113
{{< codenew file="pods/security/seccomp/profiles/audit.json" >}}
114114
{{< /tab >}}
115115
{{< tab name="violation.json" >}}
@@ -120,7 +120,9 @@ into the cluster.
120120
{{< /tab >}}}
121121
{{< /tabs >}}
122122

123-
<!-- Run these commands: -->
123+
<!--
124+
Run these commands:
125+
-->
124126
执行这些命令:
125127

126128
```shell
@@ -131,7 +133,9 @@ curl -L -o profiles/fine-grained.json https://k8s.io/examples/pods/security/secc
131133
ls profiles
132134
```
133135

134-
<!-- You should see three profiles listed at the end of the final step: -->
136+
<!--
137+
You should see three profiles listed at the end of the final step:
138+
-->
135139
你应该看到在最后一步的末尾列出有三个配置文件:
136140
```
137141
audit.json fine-grained.json violation.json
@@ -186,7 +190,7 @@ before you continue.
186190
{{< glossary_tooltip text="容器运行时" term_id="container-runtime" >}}
187191
默认首选的配置文件,而不是回退到 `Unconfined`
188192
如果你想尝试,请在继续之前参阅
189-
[启用使用 `RuntimeDefault` 作为所有工作负载的默认 seccomp 配置文件](#enable-runtimedefault-as-default)
193+
[启用使用 `RuntimeDefault` 作为所有工作负载的默认 seccomp 配置文件](#enable-runtimedefault-as-default)
190194

191195
<!--
192196
Once you have a kind configuration in place, create the kind cluster with
@@ -214,6 +218,7 @@ You should see output indicating that a container is running with name
214218
-->
215219
你应该看到输出中名为 `kind-control-plane` 的容器正在运行。
216220
输出类似于:
221+
217222
```
218223
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
219224
6a96207fed4b kindest/node:v1.18.2 "/usr/local/bin/entr…" 27 seconds ago Up 24 seconds 127.0.0.1:42223->6443/tcp kind-control-plane
@@ -366,7 +371,9 @@ nodes:
366371
seccomp-default: "true"
367372
```
368373
369-
<!-- If the cluster is ready, then running a pod: -->
374+
<!--
375+
If the cluster is ready, then running a pod:
376+
-->
370377
如果集群已就绪,则运行一个 Pod:
371378
372379
```shell
@@ -428,7 +435,9 @@ the native API fields in favor of the annotations.
428435
请在可能的情况下使用原生 API 字段而不是注解。
429436
{{< /note >}}
430437

431-
<!-- Create the Pod in the cluster: -->
438+
<!--
439+
Create the Pod in the cluster:
440+
-->
432441
在集群中创建 Pod:
433442

434443
```shell
@@ -463,15 +472,20 @@ that allows access to the endpoint from inside the kind control plane container.
463472
kubectl expose pod audit-pod --type NodePort --port 5678
464473
```
465474

466-
<!-- Check what port the Service has been assigned on the node. -->
475+
<!--
476+
Check what port the Service has been assigned on the node.
477+
-->
467478
检查 Service 在节点上分配的端口。
468479

469480
```shell
470481
kubectl get service audit-pod
471482
```
472483

473-
<!-- The output is similar to: -->
484+
<!--
485+
The output is similar to:
486+
-->
474487
输出类似于:
488+
475489
```
476490
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
477491
audit-pod NodePort 10.111.36.142 <none> 5678:32373/TCP 72s
@@ -548,22 +562,24 @@ kubectl delete pod audit-pod --wait --now
548562
```
549563

550564
<!--
551-
## Create Pod with seccomp profile that causes violation
565+
## Create Pod with a seccomp profile that causes violation
552566
553567
For demonstration, apply a profile to the Pod that does not allow for any
554568
syscalls.
555569
556570
The manifest for this demonstration is:
557571
-->
558-
## 使用导致违规的 seccomp 配置文件创建 Pod {#create-pod-with-seccomp-profile-that-causes-violation}
572+
## 使用导致违规的 seccomp 配置文件创建 Pod {#create-pod-with-a-seccomp-profile-that-causes-violation}
559573

560574
出于演示目的,将配置文件应用于不允许任何系统调用的 Pod 上。
561575

562576
此演示的清单是:
563577

564578
{{< codenew file="pods/security/seccomp/ga/violation-pod.yaml" >}}
565579

566-
<!-- Attempt to create the Pod in the cluster: -->
580+
<!--
581+
Attempt to create the Pod in the cluster:
582+
-->
567583
尝试在集群中创建 Pod:
568584

569585
```shell
@@ -606,8 +622,8 @@ Clean up that Pod before moving to the next section:
606622
kubectl delete pod violation-pod --wait --now
607623
```
608624

609-
<!--
610-
## Create Pod with seccomp profile that only allows necessary syscalls
625+
<!--
626+
## Create Pod with a seccomp profile that only allows necessary syscalls
611627
612628
If you take a look at the `fine-grained.json` profile, you will notice some of the syscalls
613629
seen in syslog of the first example where the profile set `"defaultAction":
@@ -618,7 +634,7 @@ sent to `syslog`.
618634
619635
The manifest for this example is:
620636
-->
621-
## 使用只允许必要的系统调用的 seccomp 配置文件创建 Pod {#create-pod-with-seccomp-profile-that-only-allows-necessary-syscalls}
637+
## 使用只允许必要的系统调用的 seccomp 配置文件创建 Pod {#create-pod-with-a-seccomp-profile-that-only-allows-necessary-syscalls}
622638

623639
如果你看一看 `fine-grained.json` 配置文件,
624640
你会注意到第一个示例的 syslog 中看到的一些系统调用,
@@ -631,7 +647,9 @@ The manifest for this example is:
631647

632648
{{< codenew file="pods/security/seccomp/ga/fine-pod.yaml" >}}
633649

634-
<!-- Create the Pod in your cluster: -->
650+
<!--
651+
Create the Pod in your cluster:
652+
-->
635653
在你的集群中创建 Pod:
636654

637655
```shell
@@ -642,8 +660,11 @@ kubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/fine-pod.yaml
642660
kubectl get pod fine-pod
643661
```
644662

645-
<!-- The Pod should be showing as having started successfully: -->
663+
<!--
664+
The Pod should be showing as having started successfully:
665+
-->
646666
此 Pod 应该显示为已成功启动:
667+
647668
```
648669
NAME READY STATUS RESTARTS AGE
649670
fine-pod 1/1 Running 0 30s
@@ -660,28 +681,36 @@ mention calls from `http-echo`:
660681
tail -f /var/log/syslog | grep 'http-echo'
661682
```
662683

663-
<!-- Next, expose the Pod with a NodePort Service: -->
684+
<!--
685+
Next, expose the Pod with a NodePort Service:
686+
-->
664687
接着,使用 NodePort Service 公开 Pod:
665688

666689
```shell
667690
kubectl expose pod fine-pod --type NodePort --port 5678
668691
```
669692

670-
<!-- Check what port the Service has been assigned on the node: -->
693+
<!--
694+
Check what port the Service has been assigned on the node:
695+
-->
671696
检查节点上的 Service 分配了什么端口:
672697

673698
```shell
674699
kubectl get service fine-pod
675700
```
676701

677-
<!-- The output is similar to: -->
702+
<!--
703+
The output is similar to:
704+
-->
678705
输出类似于:
679706
```
680707
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
681708
fine-pod NodePort 10.111.36.142 <none> 5678:32373/TCP 72s
682709
```
683710

684-
<!-- Use `curl` to access that endpoint from inside the kind control plane container: -->
711+
<!--
712+
Use `curl` to access that endpoint from inside the kind control plane container:
713+
-->
685714
使用 `curl` 从 kind 控制平面容器内部访问端点:
686715

687716
```shell
@@ -745,8 +774,11 @@ for all its containers:
745774

746775
{{< codenew file="pods/security/seccomp/ga/default-pod.yaml" >}}
747776

748-
<!-- Create that Pod: -->
777+
<!--
778+
Create that Pod:
779+
-->
749780
创建此 Pod:
781+
750782
```shell
751783
kubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/default-pod.yaml
752784
```
@@ -755,14 +787,19 @@ kubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/default-pod.ya
755787
kubectl get pod default-pod
756788
```
757789

758-
<!-- The Pod should be showing as having started successfully: -->
790+
<!--
791+
The Pod should be showing as having started successfully:
792+
-->
759793
此 Pod 应该显示为成功启动:
794+
760795
```
761796
NAME READY STATUS RESTARTS AGE
762797
default-pod 1/1 Running 0 20s
763798
```
764799

765-
<!-- Finally, now that you saw that work OK, clean up: -->
800+
<!--
801+
Finally, now that you saw that work OK, clean up:
802+
-->
766803
最后,你看到一切正常之后,请清理:
767804

768805
```shell

0 commit comments

Comments
 (0)