Courseiva

CKS Minimize Microservice Vulnerabilities Practice Question

Which TWO of the following are valid approaches to manage secrets in a Kubernetes cluster?

⚠ Common exam trap

A common pitfall is selecting option A (passing secrets as environment variables) because it seems convenient, but environment variables can be exposed through /proc, logs, and debugging commands. The correct secure approaches are mounting secrets as volumes (C) and using external secrets managers (E).

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

✓

Mount secrets as volumes in pods

Kubernetes allows secrets to be mounted as volumes in pods, which is a secure approach as the secret data is stored in tmpfs (RAM-backed filesystem) and not written to disk on the node. This method avoids exposing secrets in environment variables that can be leaked through process dumps or logs, and it supports automatic updates when secrets are modified.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Pass secrets as environment variables

    Why it's wrong here

    Passing secrets as environment variables leaks them through /proc/<pid>/environ, which is readable by any process with the same UID or root, and they may also be exposed via debugging tools, health checks, or error logging. Environment variables are also immutable during the pod's lifetime; rotating the secret requires recreating the pod, and there is no fine-grained access control on individual variables.

  • ✗

    Embed secrets directly in the pod YAML definition

    Why it's wrong here

    Embedding secrets directly in the pod YAML definition places sensitive data in plaintext within the pod spec, which is often stored in version control, CI/CD logs, or backup files. Anyone with read access to the pod object or the API server can see the secret, and unless encryption at rest is enabled, it is stored unencrypted in etcd. This practice also tightly couples the secret to a specific workload, making rotation and auditing difficult.

  • ✓

    Mount secrets as volumes in pods

    Why this is correct

    Mounting secrets as volumes in pods is the Kubernetes-native best practice because the secret is rendered as individual files on a tmpfs volume, which is memory-backed and not written to disk. File permissions default to 0444, and can be tightened to 0400; additionally, when the secret is updated, kubelet eventually updates the mounted files, allowing for rotation without restarting the pod. This approach avoids exposure via /proc/environ and limits access to containers that explicitly mount the volume.

  • ✗

    Store secrets as plain text in ConfigMap

    Why it's wrong here

    Storing secrets as plain text in a ConfigMap is inappropriate because ConfigMaps are designed for non-confidential configuration data and are stored in plaintext in etcd unless cluster-level encryption at rest is enabled. ConfigMaps also lack secret-specific features such as encryption, per-key access control, and integration with external secret rotation. This practice increases the risk that sensitive data will appear in logs or backups, and it can lead to overly permissive RBAC policies that grant broad access to all ConfigMaps.

  • ✓

    Use an external secrets manager like HashiCorp Vault with CSI driver

    Why this is correct

    Using an external secrets manager like HashiCorp Vault with the CSI driver allows secrets to be mounted as volumes on demand without ever storing them in etcd, pod specs, or ConfigMaps. The CSI driver fetches the secret from Vault at mount time and can refresh it periodically, enabling dynamic secrets and fine-grained audit logging while minimizing the blast radius of a leaked secret. This approach is especially valuable in multi-tenant or production environments where long-lived static secrets are a security risk.

About these practice questions

One of 845 original CKS practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.