Courseiva
System HardeningmediumMultiple ChoiceObjective-mapped

CKS System Hardening Practice Question

An administrator wants to enforce a custom AppArmor profile named 'k8s-apparmor-example' on a pod. The profile has been loaded on the node. Which annotation should be added to the pod's metadata to apply this profile?

⚠ Common exam trap

CNCF often tests the exact annotation syntax, specifically that the key must include `container.` and the container name, and the value must include `localhost/` for a custom profile, leading candidates to confuse the pod-level annotation with the container-level one.

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

container.apparmor.security.beta.kubernetes.io/nginx: localhost/k8s-apparmor-example

The annotation format for applying an AppArmor profile to a container in a pod is `container.apparmor.security.beta.kubernetes.io/<container_name>`. The value `localhost/k8s-apparmor-example` specifies that the profile named `k8s-apparmor-example` is loaded locally on the node. This annotation enforces the profile on the container named 'nginx'.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • container.apparmor.security.beta.kubernetes.io/nginx: localhost/k8s-apparmor-example

    Why this is correct

    This is correct. The annotation key uses the required 'container.' prefix followed by the exact container name 'nginx', and the value provides the 'localhost/' prefix to reference a preloaded AppArmor profile on the node. The kubelet reads this annotation and enforces the profile 'k8s-apparmor-example' on the nginx container, failing to start the container if the profile is not loaded on the node.

  • container.apparmor.security.beta.kubernetes.io/pod: localhost/k8s-apparmor-example

    Why it's wrong here

    This is incorrect because the suffix 'pod' is treated literally as the container name, but the pod spec has a container named 'nginx', not 'pod'. Consequently, the annotation is ignored by the kubelet, no AppArmor profile is applied, and the container runs without the intended restrictions. The value portion is fine, but the mismatched container name prevents enforcement.

  • apparmor.security.beta.kubernetes.io/pod: k8s-apparmor-example

    Why it's wrong here

    This is wrong on two counts: the key omits the required 'container.' prefix and instead uses 'apparmor.security.beta.kubernetes.io/pod', which does not match the annotation schema for per-container profiles. Additionally, the value 'k8s-apparmor-example' lacks the mandatory 'localhost/' prefix, so it is not a valid profile reference; valid values must be either 'runtime/default' or 'localhost/<profile>'. The combination of an invalid key and an unsupported value makes the annotation ineffective.

  • container.apparmor.security.beta.kubernetes.io/nginx: k8s-apparmor-example

    Why it's wrong here

    The annotation format for applying an AppArmor profile to a container in a pod is `container.apparmor.security.beta.kubernetes.io/<container_name>`. The value `localhost/k8s-apparmor-example` specifies that the profile named `k8s-apparmor-example` is loaded locally on the node. This annotation enforces the profile on the container named 'nginx'.

About these practice questions

Courseiva writes every CKS question from scratch — 114 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 →

How Courseiva writes practice questions · Editorial policy

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.