CKAD Practice Question: Application Environment, Configuration and Security
You create a Secret with 'kubectl create secret generic db-secret --from-literal=password=myPass'. Later, you mount it as a volume in a pod. When you exec into the container and cat the file, what will you see?
⚠ Common exam trap
Watch out — candidates often confuse the base64-encoded representation stored in the Secret manifest with the decoded content presented when mounted as a volume, leading them to pick Option B.
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
✓
myPass
When you mount a Secret as a volume, Kubernetes automatically decodes the base64-encoded data and presents the file contents as the original plaintext value. In this case, the Secret stores the literal key-value pair `password=myPass`, and when mounted, the file named `password` contains the decoded value `myPass`.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
password=myPass
Why it's wrong here
The file content is not a key-value assignment. When a Secret is mounted as a volume, each key becomes a separate filename, and that file holds only the plaintext value. The `password=myPass` format is relevant only when using `--from-literal` on the command line; it does not appear in the mounted volume's file contents.
- ✗
bXlQYXNz
Why it's wrong here
This is the base64 representation of `myPass`, which is how Kubernetes stores the value in its API `data` field. However, when a Secret is attached to a volume, the kubelet automatically decodes the base64 data before writing the file into the in-memory filesystem. As a result, the mounted file presents the original raw value, so you would read `myPass`, not `bXlQYXNz`.
- ✓
myPass
Why this is correct
When a Secret volume is mounted, each Secret key becomes a file in the mount path, and its contents are the decoded value exactly as you supplied it. Kubernetes performs this decode from the stored base64 form before writing to the volume, so the raw `myPass` is what an application sees when reading the file. This functionality is a core feature for injecting configuration data into Pods.
- ✗
An error because secrets cannot be mounted as volumes
Why it's wrong here
Secrets are fully supported as volume sources via the `secret` volume type in a Pod spec. Mounting one creates a read-only tmpfs filesystem populated with the Secret's data, and this is a common, documented way to deliver credentials to containers. Therefore, mounting a Secret does not produce an error; it is a standard and expected use case in Kubernetes.
Go deeper
Related to this question
About these practice questions
One of 826 original CKAD 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 →
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.