CKAD Practice Question: Application Environment, Configuration and Security
Which TWO of the following are valid ways to create a ConfigMap from a file named 'app.properties'? (Select two.)
⚠ Common exam trap
CNCF often tests the confusion between `--from-file` (which creates a single key with the file content) and `--from-env-file` (which creates multiple keys from key=value lines), and candidates mistakenly think `--from-env` is a valid flag.
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=app.properties
`--from-file=app.properties` creates a ConfigMap with a single key-value pair, where the key defaults to the filename (app.properties) and the value is the entire file content. Option E is correct because `--from-env-file=app.properties` imports each line of the file as a separate key-value pair, treating the file as an environment variable definition file (key=value format).
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-file=app.properties
Why this is correct
--from-file uses the filename as the key and the file content as the value.
- ✗
kubectl create configmap app-config --from-literal=app.properties
Why it's wrong here
--from-literal expects key=value format, not a filename.
- ✗
kubectl create configmap app-config --from-env=app.properties
Why it's wrong here
The correct flag is --from-env-file, not --from-env.
- ✗
kubectl create configmap app-config --from-file=app.properties=app.properties
Why it's wrong here
This syntax is incorrect; --from-file takes either a path or key=path.
- ✓
kubectl create configmap app-config --from-env-file=app.properties
Why this is correct
--from-env-file parses the file as environment variables (KEY=VALUE lines).
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.