CKAD Application Design and Build Practice Question
You have a Pod with two containers: a main application and a sidecar that handles logging. The sidecar needs access to the same log files as the main application. Which volume type allows both containers to share files?
⚠ Common exam trap
Watch out — candidates often confuse `emptyDir` with `hostPath` or `persistentVolumeClaim` because they think of 'shared storage' in terms of persistent or host-level volumes, but the CKAD exam specifically tests the Pod-level ephemeral sharing pattern using `emptyDir` for sidecar containers.
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
An `emptyDir` volume is created when a Pod is assigned to a node and exists as long as the Pod runs, allowing both containers in the same Pod to mount and share the same directory. This is the simplest and most appropriate volume type for sharing ephemeral data, such as log files, between a main application and a sidecar container within the same 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.
- ✗
persistentVolumeClaim
Why it's wrong here
A PVC provisions storage that persists beyond the pod's lifecycle and requires binding to a PersistentVolume via a StorageClass — infrastructure the log files here don't need, since they only need to exist and be shared for as long as the pod itself runs. emptyDir is created with the pod and shared directly between its containers with no external provisioning step.
- ✗
hostPath
Why it's wrong here
hostPath mounts a directory from the host node's filesystem into the pod, but it does not inherently enable sharing between containers unless you explicitly mount the same host path into multiple containers, and that ties the pod to a specific node. It also requires node-level filesystem access, which is a security risk, and the storage is not isolated or cleaned up automatically when the pod is deleted, whereas emptyDir is created and destroyed with the pod and shared directly between containers without host filesystem exposure.
- ✗
configMap
Why it's wrong here
configMap is designed to provide configuration data to containers via environment variables or mounted files, not as a writable shared volume. It is immutable by default in the sense that containers receive a read-only view, and it is not meant to hold dynamic, continuously updated log files that need to be exchanged between the main application and the sidecar container. emptyDir, in contrast, is a dedicated ephemeral volume that supports concurrent read/write access from multiple containers in the same pod, making it the correct choice for sharing log data.
- ✓
emptyDir
Why this is correct
emptyDir creates an empty directory when a pod is assigned to a node, and it remains available as long as the pod runs, allowing all containers in the pod to mount the same volume and share files seamlessly. It is the standard Kubernetes mechanism for inter-container communication via the filesystem, and it requires no persistent storage provisioning or external dependencies. Because the log files only need to exist for the pod's lifetime and must be shared between the main application and the logging sidecar, emptyDir exactly matches the requirement.
Go deeper
Related to this question
About these practice questions
Courseiva writes every CKAD question from scratch — 160 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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKAD 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 CKAD exam.