Courseiva
Workloads and SchedulingeasyMultiple ChoiceObjective-mapped

CKA Workloads and Scheduling Practice Question

Which command creates a ConfigMap named 'app-config' from a file 'config.properties'?

⚠ Common exam trap

Watch out — candidates often confuse `--from-file` (which imports a file's content as a ConfigMap entry) with `--from-env-file` (which imports environment variables from a file), or using the non-existent `--file` flag, leading candidates to select options that either use the wrong flag or misinterpret the file's purpose.

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

`kubectl create configmap app-config --from-file=config.properties` creates a ConfigMap named 'app-config' using the contents of the specified file. The `--from-file` flag reads the file and stores its entire content as a key-value pair, where the key defaults to the filename (config.properties) and the value is the file's content.

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 cm app-config --file=config.properties

    Why it's wrong here

    --file is not a valid flag.

  • kubectl create configmap app-config --from-literal=config.properties

    Why it's wrong here

    --from-literal is for key=value pairs, not files.

  • kubectl create configmap app-config --from-env-file=config.properties

    Why it's wrong here

    --from-env-file imports environment variables from a file, but the file must be in VAR=VAL format. The correct flag for a plain file is --from-file.

  • kubectl create configmap app-config --from-file=config.properties

    Why this is correct

    Correct.

About these practice questions

Courseiva writes every CKA question from scratch — 302 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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKA 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 CKA exam.