KCNA Cloud Native Application Delivery Practice Question
A team is deploying a new microservice that processes sensitive user data. They want to ensure that secrets such as database passwords are not exposed in the container image or environment variables. Which approach should they use?
⚠ Common exam trap
CNCF often tests the misconception that ConfigMaps are suitable for secrets because they can store key-value pairs, but the trap is that ConfigMaps store data in plaintext and are not designed for sensitive information, whereas Secrets provide base64 encoding and optional encryption at rest.
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
✓
Store the secret in a Kubernetes Secret and mount it as a volume in the pod
Kubernetes Secrets are designed specifically to store sensitive data like database passwords. Mounting the Secret as a volume ensures the secret data is available to the pod as files, without being exposed in environment variables (which can be leaked via logs or `kubectl describe`) or embedded in the container image. This approach follows security best practices for handling sensitive information in cloud-native applications.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Embed the secret directly in the Docker image and use it via environment variables
Why it's wrong here
Baking secrets into the image stores them in every layer and registry copy, and environment variables remain readable in the pod spec, directly violating the requirement. It is tempting because it is the quickest way to get credentials into a container during early development.
- ✗
Store the secret in a ConfigMap and reference it in the pod spec
Why it's wrong here
ConfigMaps hold configuration as plain text, so database passwords remain readable in etcd and the pod spec. Secrets are the dedicated object for confidential data. ConfigMaps suit non-sensitive settings such as feature flags or log levels, where exposure carries no security consequence.
- ✓
Store the secret in a Kubernetes Secret and mount it as a volume in the pod
Why this is correct
Kubernetes Secrets store credentials separately from the image and pod specification, and mounting them as volumes injects the data as files at runtime, so passwords never appear in container layers or environment variables. This satisfies the requirement to avoid exposing sensitive data.
- ✗
Use a PersistentVolumeClaim to store the secret and mount it into the pod
Why it's wrong here
A PersistentVolumeClaim provides storage, not secret management; the secret would still be written to a manifest or volume in plaintext, so exposure is not prevented. It is tempting because volume mounts do keep values out of environment variables, which is part of the requirement.
Go deeper
Related to this question
About these practice questions
This KCNA question is part of Courseiva's 930-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This KCNA 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 KCNA exam.