CKAD ConfigMap Practice Question
Which TWO of the following commands create a ConfigMap named 'my-config' from a file named 'app.properties'? (Choose two.)
⚠ Common exam trap
Candidates often confuse --from-file with --from-env-file and think --from-literal can read a file. A subtle trap is that Option B is syntactically valid and creates the same ConfigMap as Option E, but some may consider it redundant; nonetheless, it is a correct command. The question asks for two choices, but there are three technically correct options, which can be confusing.
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 my-config --from-file=app.properties=app.properties
Options B, C, and E are all valid commands that create a ConfigMap named 'my-config' from the file 'app.properties'. Option B uses explicit key mapping (--from-file=app.properties=app.properties). Option C uses --from-env-file to read key-value pairs from the file. Option E uses the default --from-file behavior. Option A is incorrect because it adds an extra literal (--from-literal=extra=value). Option D is invalid syntax.
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 my-config --from-file=app.properties --from-literal=extra=value
Why it's wrong here
Incorrect. While this creates a ConfigMap from the file, it also adds an extra literal entry (`--from-literal=extra=value`), which is not requested. The question asks for a ConfigMap from the file, without additional entries.
- ✓
kubectl create configmap my-config --from-file=app.properties=app.properties
Why this is correct
The `--from-file=app.properties=app.properties` syntax sets the ConfigMap key to `app.properties` and the value to the file's content, but the stem requires a ConfigMap named `my-config` from a file named `app.properties` without specifying a custom key. This option is tempting because it explicitly maps a key to a file, which is correct when you need to override the default key name (the filename) with a different key, such as when the desired key differs from the source filename.
- ✓
kubectl create configmap my-config --from-env-file=app.properties
Why this is correct
Correct. `--from-env-file=app.properties` reads the file as key=value lines and creates a ConfigMap entry for each line, as long as the file is in the correct format.
- ✗
kubectl create configmap my-config --from-literal=app.properties
Why it's wrong here
Incorrect. `--from-literal=app.properties` is invalid syntax; `--from-literal` requires a key=value pair, not a filename.
- ✓
kubectl create configmap my-config --from-file=app.properties
Why this is correct
Correct. `--from-file=app.properties` creates a ConfigMap with a single entry using the filename 'app.properties' as the key and the file contents as the value.
Go deeper
Related to this question
About these practice questions
Courseiva writes every CKAD question from scratch — 160 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 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.