How to apply a seccomp profile to AI agent pods

To apply a seccomp profile to an AI agent pod, set securityContext.seccompProfile.type to RuntimeDefault for the container runtime’s default profile, or to Localhost with a localhostProfile path for a custom file on the node. Pod Security restricted accepts only those two values, so a pod that leaves the field unset or sets Unconfined fails it.
Checked against the Kubernetes v1.37 seccomp tutorial, the security context docs and the Pod Security Standards, all fetched 2026-11-20. The manifests use the tutorial’s test image. Swap in your agent image before you apply them.
Choose the profile type
The type field accepts three values: RuntimeDefault, Localhost and Unconfined. The security context docs say localhostProfile must only be set when the type is Localhost. Restricted accepts two of the three, as the table shows.
| Type | Set in | Needs localhostProfile |
Pod Security restricted | What the docs say |
|---|---|---|---|---|
RuntimeDefault |
Pod or container securityContext |
No | Allowed | The node’s container runtime default profile |
Localhost |
Pod or container securityContext |
Yes, a path relative to the kubelet’s seccomp location | Allowed | A pre-configured profile file on the node |
Unconfined |
Pod or container securityContext |
No | Rejected | Baseline forbids setting it explicitly |
The pod-level field applies to every container in the pod. Each container can also set its own. Restricted accepts a container field left undefined when the pod-level field is set, and the pod-level field left undefined when every container sets its own.
Apply RuntimeDefault to an agent pod
- Add
seccompProfilewithtype: RuntimeDefaultunder the pod’ssecurityContext. - Keep
allowPrivilegeEscalation: falseon the agent container. The security context docs say this field defaults to true when it is not set. - Apply the manifest and check that the pod reaches
Running.
apiVersion: v1
kind: Pod
metadata:
name: agent-runtime-default
labels:
app: agent-runtime-default
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
containers:
- name: agent
image: hashicorp/http-echo:1.0
args:
- "-text=agent started"
securityContext:
allowPrivilegeEscalation: false
kubectl apply -f agent-runtime-default.yaml
kubectl get pod agent-runtime-default
The tutorial’s expected output shows 1/1 under READY and Running under STATUS. Your output should match once the image starts.
Use Localhost for a custom profile
Localhost lets an agent run under a profile you wrote. Three steps cover it:
- Place the profile file in the kubelet’s seccomp directory on every node the agent can schedule to. The tutorial’s kind cluster mounts a local
profilesdirectory at/var/lib/kubelet/seccomp/profiles. - Set
type: Localhostand setlocalhostProfileto the path relative to that directory, such asprofiles/audit.json. - Apply the pod and check that it runs.
The security context docs say localhostProfile is the path on the node, relative to the kubelet’s seccomp location, which is set with the --root-dir flag. The profile lives on the node, not in the image.
apiVersion: v1
kind: Pod
metadata:
name: agent-localhost-profile
labels:
app: agent-localhost-profile
spec:
securityContext:
seccompProfile:
type: Localhost
localhostProfile: profiles/audit.json
containers:
- name: agent
image: hashicorp/http-echo:1.0
args:
- "-text=agent started"
securityContext:
allowPrivilegeEscalation: false
The docs I checked do not say what a Localhost pod does when its profile file is missing on the node it lands on. Test that case on your cluster before you depend on it.
Make RuntimeDefault the default for agent pods
Writing the field into each manifest is the explicit route. The kubelet’s seccompDefault setting covers pods that set no profile. When it is enabled, pods use RuntimeDefault whenever no other seccomp profile is specified. When it is not, the default is Unconfined.
The kubelet must be started with --seccomp-default on each node that should use it, or the setting must be enabled in the kubelet configuration file. The tutorial labels the feature stable since Kubernetes v1.27.
Keep the field in the manifest even when the node setting is on. A node setting does not appear in the pod spec, so a reviewer reading the agent manifest cannot see which profile it runs under.
Gotchas that break agent pods
- Privileged containers always run as
Unconfined, and the tutorial says a seccomp profile cannot be applied to them. An agent container that needsprivileged: truecannot use a profile. allowPrivilegeEscalation: falsecannot be combined with a privileged container or with theCAP_SYS_ADMINcapability. An agent that needs that capability cannot set the field to false.- The tutorial calls the seccomp annotations deprecated. Set
securityContext.seccompProfileinstead, and move any annotation into that field. localhostProfileresolves on the node. Baking a profile into the container image does not make it available to the kubelet.
Confirm the restricted seccomp rule
Pod Security restricted says the seccomp profile must be explicitly set to one of the allowed values. Both Unconfined and the absence of a profile are prohibited. The restricted fields are spec.securityContext.seccompProfile.type, plus the same field on each container, init container and ephemeral container. The allowed values are RuntimeDefault and Localhost.
Baseline is looser. It only forbids setting the profile explicitly to Unconfined, so an agent pod that passes baseline can still leave the field unset. Use restricted for agent pods, and use the pod security levels guide to plan the warn and audit steps before you enforce it.
Where this fits in your agent platform
The seccomp field lives in each pod template, so it can drift when a template is copied or edited. An admission check catches a missing or wrong value when the pod is created. The pod security levels guide explains how to set the levels and which checks they cover.
For the sandbox controls around this setting, read how to sandbox AI agents on Kubernetes. For the wider governance context, see the AI agent governance hub. The AIControls platform page describes the product.
Frequently asked questions
Should an AI agent pod use RuntimeDefault or Localhost?
Use RuntimeDefault unless you have a profile written for the agent's workload. It is the container runtime's default profile, so it needs no file on the node. Choose Localhost when you need a custom profile. The file must then exist on every node the pod can land on, at a path under the kubelet's seccomp location. Pod Security restricted accepts either value.
What happens if I leave seccompProfile unset?
Pod Security restricted rejects a pod with no seccomp profile set. Without the kubelet's seccompDefault setting, the Kubernetes tutorial says the default is Unconfined. With seccompDefault enabled, pods use RuntimeDefault when no other profile is specified. Set the field in the pod spec anyway, so the manifest states the intent instead of depending on a node setting.
Can a privileged agent container use a seccomp profile?
No. The seccomp tutorial says a profile cannot be applied to a container running with privileged: true, because privileged containers always run as Unconfined. The security context docs also say allowPrivilegeEscalation: false cannot be combined with a privileged container or with CAP_SYS_ADMIN. Treat a privileged agent container as a design decision to review, not a setting to add.
Does a seccomp profile replace NetworkPolicy or RBAC for agent pods?
No. The seccomp field is one control in the pod spec. Setting it does not cover RBAC, service account tokens or NetworkPolicy, and each of those needs its own control. The sandbox guide covers the network and API paths for agent pods, and the pod security levels guide covers the rest of the restricted checks.