Seccomp & AppArmor Profiles in Pod Specs
Attach seccomp and AppArmor profiles to constrain syscalls and file access.
In plain words
seccomp is a doorman rejecting disallowed system-call requests, while AppArmor is a room-access guard controlling files and privileges. The simple Kubernetes rule is: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
Think of it like…
seccomp is a doorman rejecting disallowed system-call requests, while AppArmor is a room-access guard controlling files and privileges.
Where you’ve seen it
During an access review, the security engineer runs kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status. Expected evidence: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node. If the run instead shows this symptom, stop and restore the last known state: A RuntimeDefault profile is not identical across runtimes, and a Localhost seccomp or AppArmor profile missing on a node can stop the container before startup.
Words you’ll hear
- seccomp
- For this lesson, seccomp is the controlling idea: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
- AppArmor
- AppArmor is the checkpoint; run
kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/statusand inspect the owner chain. A RuntimeDefault profile is not identical across runtimes, and a Localhost seccomp or AppArmor profile missing on a node can stop the container before startup. - Profiles
- Profiles is the outcome to preserve; the cost is explicit: Kernel-level policies defend containers beyond RBAC, but profile debugging, distro support, and node rollout alignment add operational cost.
- Verification evidence
- The evidence command is
kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status. It connects the declaration to this behavior: Attach seccomp and AppArmor profiles to constrain syscalls and file access.
Visual diagram
Theory & deep dive
How seccomp reaches the intended state
Attach seccomp and AppArmor profiles to constrain syscalls and file access. Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
The concrete checkpoint is kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status; compare the seccomp owner, AppArmor state, and Profiles outcome instead of treating YAML acceptance as proof.
Run kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status after the change and correlate the result with Events and the owning object. Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
AppArmor: failure boundary and production cost
A RuntimeDefault profile is not identical across runtimes, and a Localhost seccomp or AppArmor profile missing on a node can stop the container before startup. The prerequisite contract is concrete: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
Kernel-level policies defend containers beyond RBAC, but profile debugging, distro support, and node rollout alignment add operational cost. A safe design limits blast radius, records the last good configuration, and uses kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status as a deterministic rollback checkpoint.
Capture the current state with kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: A RuntimeDefault profile is not identical across runtimes, and a Localhost seccomp or AppArmor profile missing on a node can stop the container before startup.
How it works, step by step
Step 1 of 41. Model the trust boundary
Name the identity, action, resource, and trust boundary before choosing a control: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
- Goal
- Attach seccomp and AppArmor profiles to constrain syscalls and file access.
- Owner
- seccomp
When to use it & trade-offs
What it is
Attach seccomp and AppArmor profiles to constrain syscalls and file access. Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
Why it matters: A RuntimeDefault profile is not identical across runtimes, and a Localhost seccomp or AppArmor profile missing on a node can stop the container before startup. The invariant at risk is specific: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node. The quickest fact check before changing the design is kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status.
When to reach for it
- Use seccomp to enforce this invariant: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
- Use AppArmor evidence from
kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/statusin reviews and incident timelines. Attach seccomp and AppArmor profiles to constrain syscalls and file access. - Choose the hosted security service route only when this cost is justified by governance or scale: Kernel-level policies defend containers beyond RBAC, but profile debugging, distro support, and node rollout alignment add operational cost.
When to avoid or be careful
- Avoid assuming seccomp is complete after YAML submission; the required behavior is concrete: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
- Avoid treating the next symptom as random; check the owner and state with
kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/statusfirst: A RuntimeDefault profile is not identical across runtimes, and a Localhost seccomp or AppArmor profile missing on a node can stop the container before startup. - Avoid adopting a heavier platform wrapper before measuring its cost: Kernel-level policies defend containers beyond RBAC, but profile debugging, distro support, and node rollout alignment add operational cost.
Native, manual, and managed paths for seccomp
kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status.Strengths: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
Watch out: Kernel-level policies defend containers beyond RBAC, but profile debugging, distro support, and node rollout alignment add operational cost. Recovery must also recognize this signal: A RuntimeDefault profile is not identical across runtimes, and a Localhost seccomp or AppArmor profile missing on a node can stop the container before startup.
kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status; the expected invariant is: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.Strengths: kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status gives immediate feedback without first building a platform layer.
Watch out: A manual change can hide drift, and unlike seccomp, it does not make this symptom self-documenting: A RuntimeDefault profile is not identical across runtimes, and a Localhost seccomp or AppArmor profile missing on a node can stop the container before startup.
kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status.Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
Watch out: The added platform ownership buys value at this cost: Kernel-level policies defend containers beyond RBAC, but profile debugging, distro support, and node rollout alignment add operational cost.
Interview signals & numbers to know
When this topic comes up
- Interview anchor: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
- Trace seccomp to Profiles through AppArmor; the invariant is: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
- Recognize the symptom: A RuntimeDefault profile is not identical across runtimes, and a Localhost seccomp or AppArmor profile missing on a node can stop the container before startup.
- Justify the cost: Kernel-level policies defend containers beyond RBAC, but profile debugging, distro support, and node rollout alignment add operational cost.
- Verify with kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status instead of only inspecting YAML.
Benchmarks & rules of thumb
- 2
- kernel policy mechanisms: seccomp and AppArmor
- 1
- profile name must exist on a node when using Localhost or AppArmor
- 0
- RBAC permission change is performed by these profiles
Common mistakes & follow-ups
Common interview mistakes
- Debugging only the child object misses the seccomp owner contract: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node.
- Ignoring this telltale condition leads to unrelated changes: A RuntimeDefault profile is not identical across runtimes, and a Localhost seccomp or AppArmor profile missing on a node can stop the container before startup.
- Repeating
kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/statuswithout an owner for remediation wastes retry cost. Kernel-level policies defend containers beyond RBAC, but profile debugging, distro support, and node rollout alignment add operational cost.
Likely interviewer follow-ups
- How would API output and runtime evidence prove this behavior: seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node?
- Which owner object, logs, and Events would you inspect for this symptom-A RuntimeDefault profile is not identical across runtimes, and a Localhost seccomp or AppArmor profile missing on a node can stop the container before startup-?
- At what threshold would this cost become unacceptable: Kernel-level policies defend containers beyond RBAC, but profile debugging, distro support, and node rollout alignment add operational cost?
kubectl get pod hardened -o jsonpath='{.spec.securityContext.seccompProfile}'; kubectl exec hardened -- grep -E 'Seccomp|NoNewPrivs' /proc/self/status, name the failure, then justify the cost. Invariant: Seccomp filters Linux system calls through RuntimeDefault or a local profile, and AppArmor mediates file and capability behavior under a named profile loaded on each node. Failure: A RuntimeDefault profile is not identical across runtimes, and a Localhost seccomp or AppArmor profile missing on a node can stop the container before startup. Cost: Kernel-level policies defend containers beyond RBAC, but profile debugging, distro support, and node rollout alignment add operational cost.Knowledge check
Put it into practice
Practice related interview Q&A
Apply Seccomp & AppArmor Profiles in Pod Specs with generative AI interview Q&A and hands-on practice.