Skip to content

Commit 522fdf9

Browse files
authored
Merge pull request #39119 from windsonsea/seccy
[zh] Sync /tutorials/security/seccomp.md
2 parents 7980310 + b437a83 commit 522fdf9

File tree

1 file changed

+66
-65
lines changed

1 file changed

+66
-65
lines changed

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

Lines changed: 66 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: 使用 seccomp 限制容器的系统调用
33
content_type: tutorial
4-
weight: 20
4+
weight: 40
55
min-kubernetes-server-version: v1.22
66
---
77
<!--
@@ -11,7 +11,7 @@ reviewers:
1111
- saschagrunert
1212
title: Restrict a Container's Syscalls with seccomp
1313
content_type: tutorial
14-
weight: 20
14+
weight: 40
1515
min-kubernetes-server-version: v1.22
1616
-->
1717

@@ -424,6 +424,70 @@ docker exec -it kind-worker bash -c \
424424
}
425425
```
426426

427+
<!--
428+
## Create Pod that uses the container runtime default seccomp profile
429+
430+
Most container runtimes provide a sane set of default syscalls that are allowed
431+
or not. You can adopt these defaults for your workload by setting the seccomp
432+
type in the security context of a pod or container to `RuntimeDefault`.
433+
-->
434+
## 创建使用容器运行时默认 seccomp 配置文件的 Pod {#create-pod-that-uses-the-container-runtime-default-seccomp-profile}
435+
436+
大多数容器运行时都提供了一组合理的、默认被允许或默认被禁止的系统调用。
437+
你可以通过将 Pod 或容器的安全上下文中的 seccomp 类型设置为 `RuntimeDefault`
438+
来为你的工作负载采用这些默认值。
439+
440+
{{< note >}}
441+
<!--
442+
If you have the `SeccompDefault` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
443+
enabled, then Pods use the `RuntimeDefault` seccomp profile whenever
444+
no other seccomp profile is specified. Otherwise, the default is `Unconfined`.
445+
-->
446+
如果你已经启用了 `SeccompDefault` [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
447+
只要没有指定其他 seccomp 配置文件,那么 Pod 就会使用 `RuntimeDefault` seccomp 配置文件。
448+
否则,默认值为 `Unconfined`
449+
{{< /note >}}
450+
451+
<!--
452+
Here's a manifest for a Pod that requests the `RuntimeDefault` seccomp profile
453+
for all its containers:
454+
-->
455+
这是一个 Pod 的清单,它要求其所有容器使用 `RuntimeDefault` seccomp 配置文件:
456+
457+
{{< codenew file="pods/security/seccomp/ga/default-pod.yaml" >}}
458+
459+
<!--
460+
Create that Pod:
461+
-->
462+
创建此 Pod:
463+
464+
```shell
465+
kubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/default-pod.yaml
466+
```
467+
468+
```shell
469+
kubectl get pod default-pod
470+
```
471+
472+
<!--
473+
The Pod should be showing as having started successfully:
474+
-->
475+
此 Pod 应该显示为已成功启动:
476+
477+
```
478+
NAME READY STATUS RESTARTS AGE
479+
default-pod 1/1 Running 0 20s
480+
```
481+
482+
<!--
483+
Finally, now that you saw that work OK, clean up:
484+
-->
485+
最后,你看到一切正常之后,请清理:
486+
487+
```shell
488+
kubectl delete pod default-pod --wait --now
489+
```
490+
427491
<!--
428492
## Create a Pod with a seccomp profile for syscall auditing
429493
@@ -772,69 +836,6 @@ kubectl delete service fine-pod --wait
772836
kubectl delete pod fine-pod --wait --now
773837
```
774838

775-
<!--
776-
## Create Pod that uses the container runtime default seccomp profile
777-
778-
Most container runtimes provide a sane set of default syscalls that are allowed
779-
or not. You can adopt these defaults for your workload by setting the seccomp
780-
type in the security context of a pod or container to `RuntimeDefault`.
781-
-->
782-
## 创建使用容器运行时默认 seccomp 配置文件的 Pod {#create-pod-that-uses-the-container-runtime-default-seccomp-profile}
783-
784-
大多数容器运行时都提供了一组合理的默认系统调用,以及是否允许执行这些系统调用。
785-
你可以通过将 Pod 或容器的安全上下文中的 seccomp 类型设置为 `RuntimeDefault`
786-
来为你的工作负载采用这些默认值。
787-
788-
{{< note >}}
789-
<!--
790-
If you have the `SeccompDefault` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) enabled, then Pods use the `RuntimeDefault` seccomp profile whenever
791-
no other seccomp profile is specified. Otherwise, the default is `Unconfined`.
792-
-->
793-
如果你已经启用了 `SeccompDefault` [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
794-
只要没有指定其他 seccomp 配置文件,那么 Pod 就会使用 `SeccompDefault` 的 seccomp 配置文件。
795-
否则,默认值为 `Unconfined`
796-
{{< /note >}}
797-
798-
<!--
799-
Here's a manifest for a Pod that requests the `RuntimeDefault` seccomp profile
800-
for all its containers:
801-
-->
802-
这是一个 Pod 的清单,它要求其所有容器使用 `RuntimeDefault` seccomp 配置文件:
803-
804-
{{< codenew file="pods/security/seccomp/ga/default-pod.yaml" >}}
805-
806-
<!--
807-
Create that Pod:
808-
-->
809-
创建此 Pod:
810-
811-
```shell
812-
kubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/default-pod.yaml
813-
```
814-
815-
```shell
816-
kubectl get pod default-pod
817-
```
818-
819-
<!--
820-
The Pod should be showing as having started successfully:
821-
-->
822-
此 Pod 应该显示为成功启动:
823-
824-
```
825-
NAME READY STATUS RESTARTS AGE
826-
default-pod 1/1 Running 0 20s
827-
```
828-
829-
<!--
830-
Finally, now that you saw that work OK, clean up:
831-
-->
832-
最后,你看到一切正常之后,请清理:
833-
834-
```shell
835-
kubectl delete pod default-pod --wait --now
836-
```
837-
838839
## {{% heading "whatsnext" %}}
839840

840841
<!--

0 commit comments

Comments
 (0)