Courseiva
Kubernetes FundamentalsmediumMultiple ChoiceObjective-mapped

KCNA Kubernetes Fundamentals Practice Question

You have a ConfigMap named 'app-config' with key 'database.url'. Which environment variable reference in a Pod spec injects this value correctly?

⚠ Common exam trap

Candidates often confuse `configMapKeyRef` with `configMapRef` (which is used with `envFrom`, not `valueFrom`) or mistakenly use `secretKeyRef` for ConfigMaps, thinking the syntax is interchangeable.

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

env: - name: DATABASE_URL valueFrom: configMapKeyRef: name: app-config key: database.url

It uses the `configMapKeyRef` field under `valueFrom` to reference a specific key (`database.url`) from the ConfigMap named `app-config`. This is the standard Kubernetes syntax for injecting a single key from a ConfigMap as an environment variable into a Pod.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • env: - name: DATABASE_URL valueFrom: configMapKeyRef: name: app-config key: database.url

    Why this is correct

    This correctly references the key 'database.url' from ConfigMap 'app-config'.

  • env: - name: DATABASE_URL value: "$(APP_CONFIG_DATABASE_URL)"

    Why it's wrong here

    This is not how ConfigMap values are referenced; the syntax is wrong.

  • env: - name: DATABASE_URL valueFrom: secretKeyRef: name: app-config key: database.url

    Why it's wrong here

    SecretKeyRef is for Secrets, not ConfigMaps.

  • env: - name: DATABASE_URL valueFrom: configMapRef: name: app-config key: database.url

    Why it's wrong here

    The correct field is 'configMapKeyRef', not 'configMapRef'.

About these practice questions

This KCNA question is part of Courseiva's 833-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.