KubernetesLXIII · Linux Security Controls in KubernetesLinux security controls
Seccomp RuntimeDefault — the runtime's safe baseline
What you'll learn
- Explain what seccomp is and how the kernel filters syscalls
- Configure RuntimeDefault seccomp profile on a Pod
- Distinguish RuntimeDefault from Unconfined and Localhost
- Recognise the production failure modes (Unconfined, missing seccompProfile)
Prerequisites
Verified against Kubernetes 1.34.x · kubeadm 1.34.x · kubectl 1.34.x · etcd 3.6.x · CoreDNS 1.11.x · containerd 1.7.x / 2.x · 2026-08-16
Seccomp (Secure Computing Mode) is a kernel feature
that filters the syscalls a process can make. The
container runtime ships with a default seccomp profile
that allows common syscalls but blocks dangerous ones
(e.g., kexec_load, reboot, mount). This lesson
covers the RuntimeDefault profile, how it constrains
the syscall surface, and the production pattern.
How seccomp works
The Linux kernel exposes ~400 syscalls. A seccomp
profile is a whitelist (or blacklist) of syscalls; a
process that makes a syscall outside the list is
killed with SIGKILL (or SIGSYS with newer
kernels).
flowchart LR
A[Process] --> B[Syscall]
B --> C{Seccomp filter}
C -->|allowed| D[Kernel]
C -->|blocked| E[SIGKILL]
A process with no seccomp profile can make any syscall. A process with a strict profile can only make the syscalls in the whitelist.
The profile types
Kubernetes supports three seccomp profile types:
| Type | Effect |
|---|---|
Unconfined | No seccomp filtering (the default in legacy clusters) |
RuntimeDefault | The runtime’s default safe profile |
Localhost | A custom profile loaded from the node |
The RuntimeDefault profile is shipped by the
container runtime (containerd, CRI-O) and is a safe
baseline: it allows common syscalls but blocks the
known-dangerous ones. The Localhost profile is a
custom profile that the operator defines and loads
onto the node.
Configuring RuntimeDefault
The Pod’s securityContext.seccompProfile.type field
selects the profile:
apiVersion: v1
kind: Pod
metadata:
name: api
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
containers:
- name: api
image: myapp:v1.0
The runtime applies the default profile at container startup. A process that makes a syscall outside the profile is killed.
The seccompProfile can be set at the Pod level
(applies to all containers) or at the container
level. The Pod-level setting is the convention.
The containerd default profile
The containerd default profile blocks ~40 syscalls that are dangerous or unused:
kexec_load,kexec_load_file— load a new kernelreboot— reboot the systemmount,umount2— mount/umount filesystemsswapon,swapoff— manage swapinit_module,finit_module,delete_module— load/unload kernel modulesptrace— process tracing (also blocked by capabilities)personality— change process execution domain
A workload that needs mount (e.g., a container that
mounts a volume at runtime) will fail under
RuntimeDefault. The fix is a custom Localhost
profile that adds the needed syscalls.
PSS restricted and seccomp
The restricted profile requires:
securityContext:
seccompProfile:
type: RuntimeDefault # or Localhost
Unconfined is rejected. A workload with no
seccompProfile field is treated as Unconfined in
older versions; in 1.34, the API server requires the
field for restricted.
A workload that needs a custom profile
A workload that needs mount (or another syscall
blocked by RuntimeDefault):
apiVersion: v1
kind: Pod
metadata:
name: legacy-app
spec:
securityContext:
seccompProfile:
type: Localhost
localhostProfile: legacy-app.json
containers:
- name: app
image: legacy:v1.0
The legacy-app.json profile is loaded onto the node
at /var/lib/kubelet/seccomp/legacy-app.json. The
profile is a custom whitelist that allows mount and
the other syscalls the workload needs.
Production patterns
RuntimeDefaulton every container. The default for production.Localhostfor workloads with custom needs. The profile is reviewed and version-controlled.- Audit seccomp in CI/CD.
kube-linterflagsUnconfined(or missingseccompProfile). - Test the workload under seccomp. A workload
that uses
mountwill fail underRuntimeDefault; the test catches this before deployment.
Production failure modes
- No
seccompProfile. The container runsUnconfined. The fix is to setseccompProfile.type: RuntimeDefault. - A workload fails under
RuntimeDefault. The workload calls a blocked syscall (e.g.,mount). The fix is a customLocalhostprofile. - Custom profile is too broad. The profile allows
kexec_loadorreboot. The fix is to remove the syscall from the profile. - Profile is loaded only on some nodes. A Pod scheduled on a node without the profile is rejected. The fix is to load the profile on every node (via a DaemonSet or a node bootstrap script).
Cross-course references
- The Linux course covers the seccomp kernel feature and the BPF filter mechanism.
- The Observability course covers the audit log entries for seccomp violations.
Quiz
Knowledge check · 4 questions
Q1. What does the seccomp `RuntimeDefault` profile do?
Q2. A container with no `securityContext.seccompProfile` field is treated as `RuntimeDefault` by Kubernetes 1.34.
Q3. Your workload sets `seccompProfile.type: RuntimeDefault` but the Pod fails to start with `mount syscall is blocked`. The workload mounts an emptyDir at runtime. Walk the response.
The workload is a Java application that calls `mount("/dev/null", "/tmp/lock", null, MS_BIND)` to bind-mount `/dev/null` over `/tmp/lock` for a file locking workaround. The RuntimeDefault profile blocks `mount`. The Pod is killed at startup.
Q4. Name three seccomp profile types in Kubernetes and what each one does.
Passing score: 75%. Answers are checked in this browser.
Production discipline
Seccomp is a defence-in-depth control that limits the
syscall surface. A defensible seccomp programme
sets RuntimeDefault on every container, uses
Localhost for workloads with custom needs, and
audits Unconfined as a Critical finding. The PSS
restricted profile requires RuntimeDefault or
Localhost; Unconfined is rejected. A cluster
whose containers are all RuntimeDefault has a
syscall-surface security programme that is
auditable; a cluster whose containers are
Unconfined has a programme that is not.