Courseiva
Kubernetes FundamentalsmediumMultiple ChoiceObjective-mapped

KCNA Kubernetes Fundamentals Practice Question

You need to create a ConfigMap from a file named 'app.properties'. Which kubectl command should you use?

⚠ Common exam trap

The most common mistake is confusing --from-file with --from-env-file. --from-file creates a ConfigMap entry with the filename as the key and file content as value. --from-env-file parses the file line by line as key=value pairs.

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

`kubectl create configmap` with the `--from-file` flag creates a ConfigMap from a file, using the filename as the key and its content as the value. This is the standard way to import a properties file into a ConfigMap in Kubernetes.

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 my-config --from-literal=app.properties

    Why it's wrong here

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

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

    Why it's wrong here

    The flag is --from-file, not --file.

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

    Why it's wrong here

    --from-env-file creates a ConfigMap from an environment file, but the question does not specify that format.

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

    Why this is correct

    This creates a ConfigMap with the file contents.

About these practice questions

Courseiva writes every KCNA question from scratch — 833 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 KCNA 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 KCNA exam.