Skip to content

KCSA · Domain 4: Kubernetes Threat Model · 16% of the exam

Task 4.6: Access to Sensitive Data

How Secrets, tokens and node credentials leak, and limiting who and what can read them.

Study it

  • Persistence, malicious code, attackers on the network, sensitive data and privilege escalation

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the CNCF documentation page that proves it.

Question 1 · choose 1

A Pod runs an application container and a third-party telemetry sidecar, both as UID 1000. The application reads a database password from a file in a mounted Secret volume. To debug a hang, an engineer set shareProcessNamespace: true on the Pod and left it on. What does that change mean for the password?

  1. ANothing, because Secret volumes are always mounted read-only into containers
  2. BThe sidecar can read it only if the Secret volume's defaultMode grants group read
  3. CThe sidecar can read it via /proc/<pid>/root, since only file permissions protect it
  4. DNothing, because process sharing exposes processes but not container filesystems
Show the answer and why
  • ANothing, because Secret volumes are always mounted read-only into containers

    Incorrect

    Read-only prevents writes, not reads; the concern is another container reading the file.

  • BThe sidecar can read it only if the Secret volume's defaultMode grants group read

    Incorrect

    Both containers run as UID 1000, so whatever permission lets the application read the file also lets the sidecar read it.

  • CThe sidecar can read it via /proc/<pid>/root, since only file permissions protect it

    Correct

    With a shared process namespace, container filesystems are visible to other containers through /proc/$pid/root, so filesystem secrets are protected only by file permissions, and both containers run as the same user.

  • DNothing, because process sharing exposes processes but not container filesystems

    Incorrect

    The documentation says the opposite: filesystems become visible through the /proc/$pid/root link of the other container's processes.

Sharing the process namespace makes every process, including details in /proc such as command-line arguments, visible to all containers in the Pod, and exposes each container's filesystem through /proc/$pid/root. Secret files then rely only on file permissions, which do not separate two containers running as the same user.

Question 2 · choose 1

A Pod has three containers, and only one of them needs a database password from a Secret. What do the Kubernetes Secret good practices advise?

  1. AMount or expose the Secret only to the container that needs it
  2. BMount it into all containers so that they share one configuration
  3. CStore it in a ConfigMap so that every container can read it safely
  4. DPass it as a command-line argument to the container that needs it
Show the answer and why
  • AMount or expose the Secret only to the container that needs it

    Correct

    The good practices say that when only one container needs a Secret, the volume mount or environment variable should be defined so the other containers do not have access to it.

  • BMount it into all containers so that they share one configuration

    Incorrect

    Giving the Secret to containers that do not need it widens its exposure.

  • CStore it in a ConfigMap so that every container can read it safely

    Incorrect

    ConfigMaps are designed for non-confidential data.

  • DPass it as a command-line argument to the container that needs it

    Incorrect

    Command-line arguments are easy to expose; the advice is to limit which containers receive the Secret.

Secret access can be scoped per container: define the mount or environment variable only in the container that uses the value. The other containers in the Pod then have no copy to leak.

Question 3 · choose 1

An etcd cluster is being decommissioned. What do the Kubernetes Secret good practices suggest doing with the durable storage it used?

  1. AKeep it attached to a node as a spare
  2. BConsider wiping or shredding it once it is no longer in use
  3. CReuse it for application logs without cleaning
  4. DNothing, since etcd data is encrypted by default
Show the answer and why
  • AKeep it attached to a node as a spare

    Incorrect

    Leftover etcd storage still holds the cluster's data, including Secrets.

  • BConsider wiping or shredding it once it is no longer in use

    Correct

    The good practices suggest wiping or shredding the durable storage used by etcd once it is no longer in use.

  • CReuse it for application logs without cleaning

    Incorrect

    Reusing the disk without wiping can expose the old data.

  • DNothing, since etcd data is encrypted by default

    Incorrect

    By default Secret objects are stored unencrypted in etcd.

etcd storage keeps the cluster's data, Secrets included and unencrypted unless encryption at rest is configured. The good practices therefore suggest wiping or shredding it when it is retired.

Practice domain 4 →Practice all domains →