Bird
0
0

Which command correctly creates a ConfigMap named config-data from the file app.env?

easy📝 Syntax Q3 of 15
Kubernetes - ConfigMaps
Which command correctly creates a ConfigMap named config-data from the file app.env?
Akubectl apply configmap config-data --from-file=app.env
Bkubectl create configmap config-data -f app.env
Ckubectl create configmap config-data --from-file=app.env
Dkubectl configmap create config-data --file=app.env
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct command syntax

    The correct command to create a ConfigMap from a file uses kubectl create configmap followed by the name and --from-file option.
  2. Step 2: Analyze options

    kubectl create configmap config-data --from-file=app.env uses the correct syntax. kubectl create configmap config-data -f app.env uses -f which is incorrect here. kubectl apply configmap config-data --from-file=app.env uses apply which is for applying manifests, not creating ConfigMaps directly. kubectl configmap create config-data --file=app.env uses an invalid command.
  3. Final Answer:

    kubectl create configmap config-data --from-file=app.env -> Option C
  4. Quick Check:

    Check for kubectl create configmap NAME --from-file=FILE syntax [OK]
Quick Trick: Use 'kubectl create configmap NAME --from-file=FILE' [OK]
Common Mistakes:
  • Using 'kubectl apply' instead of 'create'
  • Using '-f' instead of '--from-file'
  • Incorrect command order or flags

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes