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
Incorrect. --from-env-file is for files containing lines of key=value pairs, not a plain config file.
- ✗
kubectl create configmap app-config --from-literal=config.properties
Why it's wrong here
Incorrect. --from-literal is for key-value pairs, not files.
- ✓
kubectl create configmap app-config --from-file=config.properties
Why this is correct
Correct. The --from-file flag creates a ConfigMap from the file content.
- ✗
kubectl apply -f config.properties
Why it's wrong here
Incorrect. kubectl apply is for applying YAML/JSON manifests, not for creating ConfigMaps directly from files.
Go deeper
Related to this question
About these practice questions
One of 160 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.