hardMultiple Select
CAS-004 Practice Question: A container orchestration platform uses secrets…
A container orchestration platform uses secrets management. Which two methods are recommended for injecting secrets into containers? (Choose two.)
⚠ Common exam trap
A common misconception is that environment variables are safe for injecting secrets into containers, but they are visible in container metadata, logs, and debugging tools, making them insecure compared to file-based mounts or external secret stores.
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
✓
Use Kubernetes Secrets mounted as files.
Option C is correct because Kubernetes Secrets can be mounted into a pod as files via a volume, keeping the secret data out of the image and source code while making it available at a filesystem path the container can read at runtime. Option E is correct because mounting a volume from an external secret store such as HashiCorp Vault (often via a CSI driver or sidecar injector) delivers secrets dynamically at runtime, supports rotation, and avoids baking credentials into the image or repository. Options A and D are not recommended because storing secrets in environment variables in the image or passing them via command-line arguments in the Dockerfile embeds them in image layers and metadata, where they can be extracted by anyone with image access. Option B is not recommended because hardcoding secrets in application source code exposes them to anyone with repository access and makes rotation and auditing extremely difficult.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Store secrets in environment variables in the container image.
Why it's wrong here
Values baked into an image are readable by anyone who can pull it, and rebuilding the image is needed to rotate a secret. Environment variables suit non-sensitive configuration. Secrets management injects secrets at runtime from an external store, keeping them out of the image entirely.
- ✗
Hardcode secrets in the application source code.
Why it's wrong here
Source code is committed to version control and shipped in the image, exposing the secret to every developer and reader of the repository, with rotation requiring a code change and rebuild. Secrets management instead retrieves values at runtime from a dedicated external store.
- ✓
Use Kubernetes Secrets mounted as files.
Why this is correct
Mounting Kubernetes Secrets as files injects sensitive data through the container's filesystem, avoiding environment variables that leak into logs, process listings, and crash dumps. This satisfies the recommendation for secure secret delivery without exposing credentials in container metadata.
- ✗
Pass secrets via command-line arguments in the Dockerfile.
Why it's wrong here
Arguments in a Dockerfile are recorded in image history and visible via process listings, so the secret leaks to anyone with image or host access. Dockerfile arguments suit build-time configuration. Secrets management injects values at runtime from an external store, never persisting them in the image.
- ✓
Use a volume mount from a secret store like HashiCorp Vault.
Why this is correct
Mounting a secret store volume keeps credentials out of image layers and environment variables, so containers read secrets from an in-memory tmpfs at runtime. This satisfies the orchestration platform's secrets-management requirement by centralising storage in HashiCorp Vault and rotating credentials without rebuilding images.
Go deeper
Related to this question
About these practice questions
This CAS-005 question is part of Courseiva's 973-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 CAS-005 practice question is part of Courseiva's free CompTIA 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 CAS-005 exam.