Courseiva
StoragemediumMultiple ChoiceObjective-mapped

CKA Storage Practice Question

A pod needs to share data between two containers during their lifecycle, but the data does not need to persist after the pod is deleted. Which volume type is most appropriate?

⚠ Common exam trap

Many candidates confuse emptyDir with hostPath, thinking both are ephemeral, but hostPath data persists on the node even after the pod is deleted, which violates the 'no persistence after pod deletion' requirement.

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

emptyDir

The emptyDir volume type is the correct choice because it creates an empty directory when a pod is assigned to a node, and it exists as long as the pod runs. Containers within the same pod can read and write to this shared volume, making it ideal for temporary data exchange (e.g., sidecar log shipping or file-based IPC). When the pod is deleted, the emptyDir and its contents are permanently removed, matching the requirement that data does not need to persist.

Answer analysis

Option-by-option breakdown

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

  • emptyDir

    Why this is correct

    An emptyDir volume is provisioned when a Pod is assigned to a node, initially empty. It provides a temporary, shared directory accessible by all containers within that specific Pod, making it ideal for inter-container communication or temporary data storage. Crucially, its contents are deleted permanently when the Pod terminates, crashes, or is removed from the node, ensuring data isolation and cleanup. This ephemeral nature perfectly suits the requirement for data sharing that only needs to persist for the duration of the pod's existence.

  • PersistentVolumeClaim

    Why it's wrong here

    A PersistentVolumeClaim (PVC) is a request for persistent storage resources, abstracting the underlying storage details. While it provides storage that outlives individual pods, its primary purpose is long-term data persistence across pod restarts or deletions, not temporary, ephemeral data sharing between containers within the same pod. Using a PVC for this scenario would introduce unnecessary complexity and overhead, as the data would persist even after the pod's lifecycle, which is contrary to the requirement for temporary sharing.

  • hostPath

    Why it's wrong here

    A hostPath volume mounts a file or directory directly from the underlying node's filesystem into the pod. While it could technically allow sharing between containers within a pod, its contents persist even after the pod terminates, which is not desired for temporary data. Furthermore, hostPath introduces a strong dependency on the specific node where the pod is scheduled, making the pod non-portable and potentially leading to data inconsistencies if the pod is rescheduled to a different node. This makes it unsuitable for ephemeral, portable inter-container data exchange.

  • configMap

    Why it's wrong here

    A ConfigMap is designed to store non-confidential configuration data as key-value pairs, which can then be injected into pods as environment variables or mounted as files. Its primary use case is to decouple configuration from application code, not to facilitate general-purpose, dynamic file sharing or large datasets between containers. While it can mount small configuration files, it is not intended for arbitrary data exchange or temporary scratch space required for inter-container communication, making it an inappropriate choice for the stated problem.

About these practice questions

One of 302 original CKA practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.