CKAD Practice Question: Application Environment, Configuration and Security
Which kubectl command creates a ConfigMap named 'app-config' from a file called 'config.properties'?
⚠ Common exam trap
Watch out — candidates often confuse `--from-file` (which imports a file as a single data entry) with `--from-env-file` (which parses a file as multiple key-value pairs), leading them to choose Option A incorrectly.
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
✓
kubectl create configmap app-config --from-file=config.properties
The `kubectl create configmap` command with the `--from-file` flag directly creates a ConfigMap from the contents of a specified file, using the filename as the key and the file content as the value. This is the standard method for creating a ConfigMap from a single file like 'config.properties'.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
kubectl create configmap app-config --from-env-file=config.properties
Why it's wrong here
--from-env-file parses the file as newline-delimited KEY=VALUE environment variables, producing one ConfigMap entry per line rather than a single key holding the file's contents. It is correct when the source file already follows env-file syntax.
- ✗
kubectl create configmap app-config --from-literal=config.properties
Why it's wrong here
--from-literal treats the argument as a literal key-value pair, so it would create a key named 'config.properties' with an empty value rather than reading the file. The literal flag is correct when supplying individual values directly on the command line.
- ✓
kubectl create configmap app-config --from-file=config.properties
Why this is correct
The --from-file flag reads config.properties and stores its contents as a single key named after the file, producing the ConfigMap app-config. This matches the required name and file source exactly, unlike literal or directory-based alternatives.
- ✗
kubectl apply -f config.properties
Why it's wrong here
kubectl apply -f expects a Kubernetes manifest in YAML or JSON; a .properties file is not a valid resource definition and would be rejected during parsing. apply is correct when the requirement is declarative management of an existing manifest file.
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.