CKAD Practice Question: Application Environment, Configuration and Security
Exhibit
Refer to the exhibit.
```
apiVersion: v1
kind: Pod
metadata:
name: secured-pod
spec:
containers:
- name: app
image: nginx
securityContext:
runAsUser: 1000
runAsGroup: 2000
capabilities:
add: ["NET_ADMIN"]
drop: ["ALL"]
securityContext:
runAsNonRoot: true
```Refer to the exhibit. A Pod is defined with security contexts at both the container and Pod level. Which of the following statements accurately describes the effective security configuration?
⚠ Common exam trap
CNCF often tests the misconception that Pod-level runAsNonRoot overrides container-level runAsUser, when in fact they are complementary checks, and the container's runAsUser must be non-root for the Pod to start.
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
✓
The container runs as user 1000, group 2000, with NET_ADMIN capability added, and the Pod-level runAsNonRoot: true is also enforced.
Kubernetes merges Pod-level and container-level security contexts, with the container-level settings taking precedence for fields that overlap, but Pod-level settings that are not overridden (like runAsNonRoot) remain enforced. In this case, the container runs as user 1000, group 2000, with NET_ADMIN capability added, and the Pod-level runAsNonRoot: true is also enforced, ensuring the container does not run as root.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The Pod will fail to start because runAsNonRoot conflicts with the container's runAsUser.
Why it's wrong here
runAsNonRoot: true does not conflict with a container user of 1000; it only requires that the effective UID is non-zero. Since runAsUser: 1000 is explicitly set, the kubelet's validation passes and the Pod starts normally. There is no contradiction because non-root simply means not UID 0, and 1000 satisfies that condition.
- ✗
The container runs as user 1000, but the Pod-level runAsNonRoot overrides the container's runAsUser to enforce non-root.
Why it's wrong here
The Pod-level runAsNonRoot is not an override that changes the container's UID; it is a separate constraint that must be satisfied in addition to the container's own securityContext values. The container still runs as user 1000, and the kubelet validates that this is non-root. Distinct security fields from different levels are merged, not overwritten, so the statement's cause-and-effect is incorrect.
- ✓
The container runs as user 1000, group 2000, with NET_ADMIN capability added, and the Pod-level runAsNonRoot: true is also enforced.
Why this is correct
The container's effective identity is user 1000 and group 2000 as defined by its securityContext, and the NET_ADMIN capability is added unambiguously. The Pod-level runAsNonRoot: true is a separate, compatible gate that the kubelet checks; because the container runs as UID 1000, the gate passes. Both levels of securityContext are enforced, with container-level fields supplying the specifics and pod-level fields adding global constraints.
- ✗
The container runs as root because the Pod-level runAsNonRoot is ignored when container-level capabilities are set.
Why it's wrong here
Pod-level runAsNonRoot is never ignored; it is enforced by the kubelet at container startup, and if the container were to run as root, the Pod would be rejected. Adding capabilities such as NET_ADMIN only grants Linux-specific permissions and does not change the effective UID of the container process. Therefore the premise that capabilities override the non-root mandate is false and would result in a failure, not a root-running container.
Go deeper
Related to this question
About these practice questions
This CKAD question is part of Courseiva's 826-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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 CKAD 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 CKAD exam.