Courseiva
Minimize Microservice VulnerabilitiesmediumMultiple ChoiceObjective-mapped

CKS Minimize Microservice Vulnerabilities Practice Question

A developer wants to ensure that all containers in a pod run with a read-only root filesystem except for a specific volume mounted for writing logs. Which container-level security context field should be set to true?

⚠ Common exam trap

It's easy for candidates to confuse `readOnlyRootFilesystem` with `runAsNonRoot` or `allowPrivilegeEscalation`, mistakenly thinking those options also restrict filesystem writes, when in fact they address entirely different security concerns (user identity and privilege escalation).

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

readOnlyRootFilesystem

Setting `readOnlyRootFilesystem: true` in the container-level security context forces the container's root filesystem to be read-only, preventing any writes to the root filesystem. This is exactly what the developer needs to enforce immutability for the root filesystem while allowing writes only to a specific volume (e.g., for logs) mounted with write access. The field is a boolean in the `securityContext` of a container specification in Kubernetes.

Answer analysis

Option-by-option breakdown

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

  • allowPrivilegeEscalation

    Why it's wrong here

    This controls whether processes can gain more privileges than their parent, not filesystem access.

  • readOnlyRootFilesystem

    Why this is correct

    This makes the root filesystem read-only, which is the correct setting.

  • privileged

    Why it's wrong here

    This gives the container extended privileges, which is the opposite of what is wanted.

  • runAsNonRoot

    Why it's wrong here

    This ensures the container does not run as root, but does not make the filesystem read-only.

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.