CKS System Hardening Practice Question
You have built a custom seccomp profile at /var/lib/kubelet/seccomp/audit.json. Which YAML snippet correctly applies this profile to a container?
⚠ Common exam trap
Many candidates confuse the deprecated `seccomp` field (used in older Kubernetes versions) with the current `seccompProfile` API, or they assume a bare filename like `audit.json` works without the required relative path prefix.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
securityContext: seccompProfile: type: Localhost localhostProfile: "audit.json"
The seccomp profile is stored at `/var/lib/kubelet/seccomp/audit.json`. The `localhostProfile` field expects a relative path from the base directory `/var/lib/kubelet/seccomp/`. Therefore, `audit.json` correctly resolves to the full path. The `seccompProfile` API with `type: Localhost` is the current method for applying custom profiles.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
securityContext: seccompProfile: type: RuntimeDefault
Why it's wrong here
This uses `type: RuntimeDefault`, which tells the container runtime to apply its built-in default seccomp profile, typically the Docker/containerd default. That default profile is general-purpose and does not load your custom `audit.json`, so it would not perform the requested syscall auditing. Additionally, it omits the `localhostProfile` field entirely, so no custom profile file is referenced at all.
- ✗
securityContext: seccompProfile: type: Localhost localhostProfile: "profiles/audit.json"
Why it's wrong here
This sets `localhostProfile` to `profiles/audit.json`, which the kubelet resolves relative to its seccomp profile root directory, `/var/lib/kubelet/seccomp`. Therefore, it looks for `/var/lib/kubelet/seccomp/profiles/audit.json`—a path that does not exist because the file is actually at `/var/lib/kubelet/seccomp/audit.json`. The `profiles/` prefix inserts an extra subdirectory, breaking the path resolution.
- ✗
securityContext: seccomp: type: Localhost profile: "audit.json"
Why it's wrong here
This uses the `seccomp` field directly under `securityContext`, which is invalid in the current Kubernetes API. The correct field is `seccompProfile`, introduced in v1.19 to replace the legacy annotation-based seccomp configuration. Even if accepted, the `type: Localhost` syntax is not valid for the old `seccomp` field; that field expects a string like `localhost/audit.json` or `runtime/default`, not an object with `type` and `profile` keys.
- ✓
securityContext: seccompProfile: type: Localhost localhostProfile: "audit.json"
Why this is correct
This correctly uses the `seccompProfile` field with `type: Localhost` and `localhostProfile: "audit.json"`. The `localhostProfile` path is interpreted relative to the kubelet's seccomp root directory, `/var/lib/kubelet/seccomp`, so it resolves exactly to `/var/lib/kubelet/seccomp/audit.json`, matching the location where you placed the profile. This option is the only one that uses the modern API and the correct path.
Visual reference
Go deeper
Related to this question
About these practice questions
Courseiva writes every CKS question from scratch — 845 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKS practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKS exam.