Courseiva
Workloads and Scheduling →easyMultiple Choice

CKA Workloads and Scheduling Practice Question

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

⚠ Common exam trap

A common mix-up: candidates confuse `--from-file` with `--from-env-file` or `--from-literal`, where candidates mistakenly think `--from-env-file` is the correct way to import a properties file, but `--from-env-file` parses the file line by line for KEY=VALUE pairs and does not preserve the raw file content.

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 file 'config.properties'. The `--from-file` flag reads the file as-is and stores its content under a key that defaults to the filename (config.properties). This is the standard method for creating a ConfigMap from a single file.

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 apply configmap app-config config.properties

    Why it's wrong here

    The kubectl apply command is used to manage resources defined in local or remote configuration files (typically YAML or JSON manifests) via the -f or --filename flag. It does not support direct imperative resource creation arguments like configmap app-config followed by a raw properties file.

  • ✗

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

    Why it's wrong here

    The --from-literal flag expects a literal key-value pair in the format key=value (for example, special.type=charm). Passing a filename like config.properties directly to this flag is invalid syntax and will result in an error because it lacks the required key-value delimiter.

  • ✗

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

    Why it's wrong here

    While --from-env-file is a valid flag, it is specifically designed to parse a file containing line-delimited key-value pairs and load them as individual environment variables. It is not appropriate for treating an entire configuration file as a single, multi-line data block under a single key.

  • ✓

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

    Why this is correct

    This is the correct command because the --from-file flag instructs kubectl to read the contents of config.properties and store them in the ConfigMap. The filename itself becomes the key, and the entire file content becomes the corresponding value.

About these practice questions

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