diff --git a/content/zh/docs/tasks/configure-pod-container/security-context.md b/content/zh/docs/tasks/configure-pod-container/security-context.md index bdc244a97f..07ab6961e4 100644 --- a/content/zh/docs/tasks/configure-pod-container/security-context.md +++ b/content/zh/docs/tasks/configure-pod-container/security-context.md @@ -578,6 +578,59 @@ Linux 权能常数定义的形式为 `CAP_XXX`。但是你在 Container 清单 列表中添加 `SYS_TIME`。 {{< /note >}} + +## 为容器设置 Seccomp 样板 + +若要为容器设置 Seccomp 样板(Profile),可在你的 Pod 或 Container 清单的 +`securityContext` 节中包含 `seccompProfile` 字段。该字段是一个 +[SeccompProfile](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#seccompprofile-v1-core) +对象,包含 `type` 和 `localhostProfile` 属性。 +`type` 的合法选项包括 `RuntimeDefault`、`Unconfined` 和 `Localhost`。 +`localhostProfile` 只能在 `type: Localhost` 配置下才需要设置。 +该字段标明节点上预先配置的样板的路径,路径是相对于 kubelet 所配置的 +Seccomp 样板路径(使用 `--root-dir` 配置)而言的。 + +下面是一个例子,设置容器使用节点上容器运行时的默认样板作为 Seccomp 样板: + +```yaml +... +securityContext: + seccompProfile: + type: RuntimeDefault +``` + + +下面是另一个例子,将 Seccomp 的样板设置为位于 +`/seccomp/my-profiles/profile-allow.json` +的一个预先配置的文件。 + +```yaml +... +securityContext: + seccompProfile: + type: Localhost + localhostProfile: my-profiles/profile-allow.json +``` +