Courseiva
Kubernetes Fundamentals →mediumMultiple Choice

KCNA Kubernetes Fundamentals Practice Question

A developer creates a Pod with a container that writes data to /var/log/app.log inside the container. The Pod is deleted and recreated, and the log file is gone. Which Kubernetes volume type would preserve the log file across Pod restarts on the same node?

⚠ Common exam trap

A common mix-up: candidates confuse emptyDir with persistent storage; emptyDir is deleted when the Pod is removed, even though it is writable.

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

✓

hostPath

hostPath mounts a node-local directory into the Pod, so data written there survives Pod deletion and is available when a new Pod is scheduled to the same node. emptyDir is ephemeral and tied to the Pod, while configMap and secret are read-only configuration mechanisms, not persistent storage for application logs.

Answer analysis

Option-by-option breakdown

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

  • ✗

    configMap

    Why it's wrong here

    A configMap volume is used to inject configuration data as files into a Pod. It is read-only by default and is not designed for application data that must persist. Writing logs to a configMap volume is not supported, and the data would not survive Pod deletion, so it fails the requirement.

  • ✓

    hostPath

    Why this is correct

    A hostPath volume mounts a directory from the host node's filesystem into the Pod. If the container writes to that mounted directory, the data remains on the node even after the Pod is deleted. When the Pod is recreated on the same node, the hostPath volume is reattached and the log file persists.

  • ✗

    secret

    Why it's wrong here

    A secret volume is intended for sensitive data such as passwords or tokens, mounted as files. Like configMap, it is not a general-purpose writable storage and does not persist application logs. Using a secret for log storage is inappropriate and would not preserve the file across Pod recreation.

  • ✗

    emptyDir

    Why it's wrong here

    An emptyDir volume is created when a Pod is assigned to a node and exists only for the lifetime of that Pod. If the Pod is deleted, the emptyDir data is permanently removed. It does not persist across Pod restarts or recreation, so it cannot preserve the log file in this scenario.

About these practice questions

Courseiva writes every KCNA question from scratch — 930 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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CNCF exam blueprint

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.