部署這個資訊清單時,如果 Pod 中的容器嘗試發出違反執行階段預設 seccomp 設定檔的系統呼叫,Pod 或工作負載可能會發生非預期行為。舉例來說,如果 Pod 在啟動期間發出受限的系統呼叫,就會無法啟動。如果應用程式在 Pod 執行期間嘗試發出受限的系統呼叫,您可能會在容器中發現錯誤。失敗的系統呼叫嚴重程度取決於應用程式處理錯誤的方式。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-01 (世界標準時間)。"],[],[],null,["# About seccomp in GKE\n\n[Autopilot](/kubernetes-engine/docs/concepts/autopilot-overview) [Standard](/kubernetes-engine/docs/concepts/choose-cluster-mode)\n\n*** ** * ** ***\n\nThis page provides information about the Linux *secure computing* mode (seccomp)\nin Google Kubernetes Engine (GKE). Use this information to understand which actions\nyour containerized applications can perform on the host virtual machine (VM)\nthat backs your nodes.\n\nThis page is for Security specialists who use seccomp as part of their\norganization's security strategy and want to understand how GKE\ninteracts with seccomp profiles.\nTo learn more about\ncommon roles and example tasks that we reference in Google Cloud content, see\n[Common GKE user roles and tasks](/kubernetes-engine/enterprise/docs/concepts/roles-tasks).\n\nWhat is seccomp?\n----------------\n\nSecure computing mode, or seccomp, is a security capability in Linux that lets\nyou restrict the system calls (syscalls) that a process can make to the Linux\nkernel.\n\nBy default, GKE nodes use the [Container-Optimized OS\noperating system](/container-optimized-os/docs/concepts/features-and-benefits)\nwith the [containerd *container runtime*](https://containerd.io/).\ncontainerd protects the Linux kernel by limiting the allowed Linux\n*capabilities* to a default list, and you can further limit allowed\nsyscalls with a seccomp *profile*. containerd has a default seccomp profile\navailable. Whether GKE applies the default seccomp profile for\nyou depends on the cluster mode that you use, as follows:\n\n- [Autopilot](/kubernetes-engine/docs/concepts/autopilot-overview) (recommended): GKE applies the containerd default seccomp profile to all workloads automatically.\n- [Standard](/kubernetes-engine/docs/concepts/types-of-clusters#modes): GKE **does not** apply the containerd default seccomp profile to all workloads automatically. We recommend that you apply either the default seccomp profile or a [custom seccomp profile](#custom-profile) to your workloads.\n\nThe default containerd seccomp profile provides baseline hardening while\nmaintaining compatibility with most workloads. The full seccomp profile\ndefinition for containerd is available on\n[GitHub](https://github.com/containerd/containerd/blob/main/contrib/seccomp/seccomp_default.go).\n\nLinux capabilities and syscalls\n-------------------------------\n\nNon-root processes running on Linux systems might require specific privileges to\nperform actions as the root user. Linux uses *capabilities* to divide the\navailable privileges into groups, so that a non-root process can perform a\nspecific action without being granted all privileges. For a process to\nsuccessfully make a specific syscall, the process must have the corresponding\nprivileges granted by a capability.\n\nFor a list of all Linux capabilities, refer to\n[capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html)\n.\n\nDenied syscalls in the default GKE seccomp profile\n--------------------------------------------------\n\nThe containerd default seccomp profile blocks all syscalls and then selectively\nallows specific syscalls, some of which depend on the CPU architecture of the\nnode's VM and the kernel version. The\n[`syscalls` variable in the `DefaultProfile` function](https://github.com/containerd/containerd/blob/main/contrib/seccomp/seccomp_default.go#L58)\nlists the allowed syscalls for all architectures.\n\nThe default seccomp profile blocks syscalls that can be used to bypass container\nisolation boundaries and allow privileged access to the node or to other\ncontainers. The following table describes some of the significant syscalls that\nthe default seccomp profile denies:\n\n| **Note:** This table only describes a subset of the syscalls that the default seccomp profile blocks. For a full list, refer to the [profile definition on GitHub](https://github.com/containerd/containerd/blob/main/contrib/seccomp/seccomp_default.go).\n\nHow to use seccomp in GKE\n-------------------------\n\nIn Autopilot clusters, GKE automatically applies the\ncontainerd default seccomp profile to all your workloads. No further action is\nrequired. Attempts to make restricted syscalls fail. Autopilot\ndisallows custom seccomp profiles because GKE manages the nodes.\n\nIn Standard clusters, you must manually apply a seccomp profile.\nGKE doesn't apply a profile for you.\n\n### Enable seccomp in Standard clusters\n\nApply a seccomp profile manually by setting the Pod or container\n[Security Context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)\nusing the `spec.securityContext.seccompProfile` field in the Pod specification,\nsuch as in the following example. We strongly recommend that you use a seccomp\nprofile for your workloads unless your use case requires using any restricted\nsyscalls. The two supported `seccompProfile` types are as follows:\n\n- `RuntimeDefault`: the default profile specified by the containerd runtime.\n- `Localhost`: a [custom profile definition](#custom-profile).\n\nThe following example manifest sets the seccomp profile to the runtime default\nprofile: \n\n apiVersion: apps/v1\n kind: Deployment\n metadata:\n name: my-deployment\n labels:\n app: default-pod\n spec:\n replicas: 3\n selector:\n matchLabels:\n app: default-pod\n template:\n metadata:\n labels:\n app: default-pod\n spec:\n securityContext:\n seccompProfile:\n type: RuntimeDefault\n containers:\n - name: seccomp-test\n image: nginx\n\n| **Important:** You can't apply a seccomp profile to containers that run in [Privileged mode](https://kubernetes.io/docs/concepts/workloads/pods/#privileged-mode-for-containers).\n\nWhen you deploy this manifest, if a container in the Pod tries to make a syscall\nthat violates the runtime default seccomp profile, the Pod or the workload might\nexperience unexpected behavior. For example, a Pod that makes a restricted\nsyscall during startup would fail to start. If an application tries to make a\nrestricted syscall while the Pod is running, you might notice errors in the\ncontainer. The severity of a failed syscall depends on how the application\nhandles errors.\n\n### Use a custom seccomp profile in Standard clusters\n\nIf the runtime default seccomp profile is too restrictive for your application\n(or not restrictive enough), you can apply a custom seccomp profile to Pods in\nStandard clusters. This process requires access to the filesystem on\nthe node. For a tutorial on how to load and use custom seccomp profiles, refer\nto\n[Restrict a Container's Syscalls with seccomp](https://kubernetes.io/docs/tutorials/security/seccomp/).\n\nWhat's next\n-----------\n\n- [Use PodSecurityAdmission to enforce pre-defined Pod-level policies](/kubernetes-engine/docs/how-to/podsecurityadmission)\n- [Use Organization Policy Service to set project or organization-level policies](/kubernetes-engine/docs/how-to/custom-org-policies)"]]