Question 819 of 997
Kubernetes FundamentalsmediumMultiple ChoiceObjective-mapped

ConfigMap vs Secret in Kubernetes: Differences and Use Cases

This KCNA practice question tests your understanding of kubernetes fundamentals. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

Which Kubernetes object should you use to store non-sensitive configuration data that can be consumed by Pods as environment variables or mounted files?

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

ConfigMap

ConfigMap is the correct Kubernetes object for storing non-sensitive configuration data, such as key-value pairs or configuration files. It is designed to decouple configuration artifacts from container images, allowing Pods to consume this data as environment variables, command-line arguments, or mounted files in a volume. Unlike Secrets, ConfigMaps do not provide encryption or base64 encoding by default, making them suitable only for non-sensitive information.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

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

  • Secret

    Why it's wrong here

    Secrets are for sensitive data, such as passwords or tokens.

  • PersistentVolume

    Why it's wrong here

    PersistentVolume is used for storage, not configuration.

  • ConfigMap

    Why this is correct

    ConfigMap is used to store non-confidential configuration data in key-value pairs.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Service

    Why it's wrong here

    Service is a network abstraction, not for configuration data.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates often confuse ConfigMaps with Secrets, assuming both are interchangeable for configuration, but the KCNA exam tests the distinction that Secrets are for sensitive data and ConfigMaps are for non-sensitive data, and that PersistentVolume is for storage, not configuration.

Detailed technical explanation

How to think about this question

Under the hood, ConfigMaps are stored in etcd as key-value pairs and can be consumed by Pods via the downward API or volume mounts. When mounted as a volume, each key becomes a file, and updates to the ConfigMap are eventually reflected in the Pod (though not for subPath mounts or environment variables). A real-world scenario is using a ConfigMap to store application configuration files (e.g., nginx.conf) that are mounted into a Pod, enabling configuration changes without rebuilding the container image.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A practitioner preparing for the KCNA exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related KCNA practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free KCNA practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this KCNA question test?

Kubernetes Fundamentals — This question tests Kubernetes Fundamentals — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: ConfigMap — ConfigMap is the correct Kubernetes object for storing non-sensitive configuration data, such as key-value pairs or configuration files. It is designed to decouple configuration artifacts from container images, allowing Pods to consume this data as environment variables, command-line arguments, or mounted files in a volume. Unlike Secrets, ConfigMaps do not provide encryption or base64 encoding by default, making them suitable only for non-sensitive information.

What should I do if I get this KCNA question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

5 more ways this is tested on KCNA

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. Which Kubernetes object is used to store non-confidential configuration data that can be consumed by pods?

medium
  • A.ServiceAccount
  • B.Secret
  • C.ConfigMap
  • D.PersistentVolume

Why C: ConfigMap is the correct Kubernetes object for storing non-confidential configuration data, such as environment variables, command-line arguments, or configuration files, that can be consumed by pods. Unlike Secrets, ConfigMaps store data in plain text and are designed for configuration that does not require encryption, making them ideal for application settings that are not sensitive.

Variation 2. You have a ConfigMap named 'app-config' and a Secret named 'db-password'. You want to mount them into a pod. Which statement is correct?

hard
  • A.Secrets can be mounted as volumes, but ConfigMaps cannot
  • B.Both ConfigMaps and Secrets can be mounted as volumes
  • C.ConfigMaps can be mounted as volumes, but Secrets cannot
  • D.ConfigMaps and Secrets can only be exposed as environment variables

Why B: Both ConfigMaps and Secrets are Kubernetes API objects designed to decouple configuration data from container images. They can be mounted as volumes into pods, allowing files to be created in the container's filesystem with the data from the ConfigMap or Secret. This is a core feature for managing configuration and sensitive data in Kubernetes.

Variation 3. You need to provide configuration data as environment variables to a pod, but the data is not sensitive. Which object should you use?

medium
  • A.ConfigMap
  • B.Secret
  • C.ServiceAccount
  • D.PersistentVolume

Why A: A ConfigMap is the correct Kubernetes object for providing non-sensitive configuration data as environment variables to a pod. ConfigMaps are designed to decouple configuration artifacts from image content to keep containers portable, and they support injection via environment variables, command-line arguments, or volume mounts. Unlike Secrets, ConfigMaps store data in plaintext (base64-encoded only for transport) and are intended for data that does not require encryption at rest or in transit.

Variation 4. Which TWO resources can be used to store configuration data separately from container images?

medium
  • A.Service
  • B.PersistentVolume
  • C.Secret
  • D.Deployment
  • E.ConfigMap

Why C: ConfigMaps and Secrets are Kubernetes API objects designed specifically to decouple configuration data and sensitive information from container images. ConfigMaps store non-sensitive key-value pairs (e.g., environment variables, command-line arguments, or configuration files), while Secrets store sensitive data (e.g., passwords, tokens, or SSH keys) in base64-encoded or encrypted form. Both can be mounted into pods as volumes or injected as environment variables, allowing image reuse across different environments without rebuilding.

Variation 5. Which Kubernetes object is used to store non-sensitive configuration data that can be consumed by pods?

medium
  • A.Secret
  • B.ServiceAccount
  • C.ConfigMap
  • D.PersistentVolume

Why C: ConfigMap is the correct Kubernetes object for storing non-sensitive configuration data, such as environment variables, command-line arguments, or configuration files, that can be consumed by pods. Unlike Secrets, ConfigMaps store data in plaintext and are designed for configuration that does not require encryption, making them ideal for application settings that are not confidential.

Keep practising

More KCNA practice questions

Last reviewed: Jun 24, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.