Question 528 of 997
Minimize Microservice VulnerabilitiesmediumMultiple ChoiceObjective-mapped

How fsGroup Affects New File Ownership in Kubernetes

This CKS practice question tests your understanding of minimize microservice vulnerabilities. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A pod is configured with securityContext: runAsUser: 1000 runAsGroup: 3000 fsGroup: 2000

The volume mounted at /data is owned by user 1000 and group 2000. The container process inside the pod writes to /data. Which statement about file ownership is true?

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

Files created in /data will be owned by user 1000 and group 2000.

The `fsGroup: 2000` in the pod's securityContext causes Kubernetes to recursively change the group ownership of the volume to group 2000 and enable a setgid bit on the mount directory. When the container process (running as user 1000) writes new files to /data, those files inherit the group ownership of the directory (2000) due to the setgid bit, while the user ownership remains 1000 (the runAsUser). Thus, new files are owned by user 1000 and group 2000.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

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

  • Files created in /data will be owned by root:root because of the volume mount.

    Why it's wrong here

    The securityContext overrides the default ownership.

  • Files created in /data will be owned by user 1000 and group 2000.

    Why this is correct

    fsGroup sets the group ownership for the volume, and runAsUser sets the user. New files are owned by the user and the fsGroup.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Files created in /data will be owned by user 1000 and group 3000.

    Why it's wrong here

    The group is set by fsGroup, not runAsGroup.

  • Files created in /data will be owned by user 1000 and group 1000.

    Why it's wrong here

    The group is not the user's group; it is set by fsGroup.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The CKS exam often tests the distinction between runAsGroup (the process's primary group) and fsGroup (the group ownership applied to the volume), leading candidates to incorrectly assume that new files inherit the runAsGroup instead of the fsGroup-controlled directory group.

Detailed technical explanation

How to think about this question

Under the hood, when fsGroup is specified, Kubernetes mounts the volume and runs `chgrp` to set the group to the fsGroup value, then sets the setgid bit (chmod g+s) on the directory. This ensures that any new files or subdirectories created inside inherit the directory's group, not the process's primary group. In real-world scenarios, this is critical for shared volumes between containers where different users need to collaborate; without fsGroup, files might be created with the container's primary group (e.g., 3000) and become inaccessible to other containers expecting group 2000.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A practitioner preparing for the CKS exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related CKS practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free CKS practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this CKS question test?

Minimize Microservice Vulnerabilities — This question tests Minimize Microservice Vulnerabilities — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Files created in /data will be owned by user 1000 and group 2000. — The `fsGroup: 2000` in the pod's securityContext causes Kubernetes to recursively change the group ownership of the volume to group 2000 and enable a setgid bit on the mount directory. When the container process (running as user 1000) writes new files to /data, those files inherit the group ownership of the directory (2000) due to the setgid bit, while the user ownership remains 1000 (the runAsUser). Thus, new files are owned by user 1000 and group 2000.

What should I do if I get this CKS question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more ways this is tested on CKS

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. An administrator creates a Pod with the following securityContext: securityContext: runAsUser: 1000 runAsGroup: 3000 fsGroup: 2000 The container image has a binary that requires read/write access to /data, which is an emptyDir volume mounted by the Pod. The container fails to start with 'Permission denied' when writing to /data. What is the most likely cause?

medium
  • A.The container's base image has a restrictive umask that overrides the pod's security context.
  • B.The fsGroup is set but the volume's fsGroupChangePolicy is missing.
  • C.The emptyDir volume is not writable by default; it needs to be explicitly configured.
  • D.The container is running as user 1000, but the volume is owned by root (uid 0) and the fsGroup 2000 does not give write permission.

Why D: The `emptyDir` volume is created with default permissions of 755 (rwxr-xr-x), owned by root. The `fsGroup: 2000` changes the group ownership of the volume to GID 2000, but does **not** change the file permissions. User 1000 runs the container and has supplementary group 2000 from the `fsGroup` setting, so it is a member of group 2000. However, the group permission on the volume is `r-x` (read and execute only), which does **not** grant write access. As a result, writing to `/data` fails with 'Permission denied'. To fix this, the pod should either set appropriate permissions (e.g., via an init container) or adjust the `fsGroupChangePolicy` if the permissions are already correct. Option D correctly identifies this issue.

Keep practising

More CKS practice questions

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.