Courseiva
Storage →easyMultiple Choice

CKA Storage Practice Question

An administrator needs to create a PersistentVolume with 10Gi capacity, ReadWriteOnce access mode, and a reclaim policy of Retain. Which YAML snippet correctly defines this PV?

⚠ Common exam trap

The CKA exam often tests the distinction between the singular 'accessMode' (incorrect) and the plural 'accessModes' (correct) in PersistentVolume and PersistentVolumeClaim specs, causing candidates to pick option B if they overlook this YAML syntax 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

✓

apiVersion: v1 kind: PersistentVolume metadata: name: pv-example spec: capacity: storage: 10Gi accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain hostPath: path: /data/pv

It defines a PersistentVolume with the required 10Gi capacity, ReadWriteOnce access mode (using the correct plural 'accessModes' field), and the Retain reclaim policy. The hostPath volume type is also specified correctly.

Answer analysis

Option-by-option breakdown

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

  • ✗

    apiVersion: v1 kind: PersistentVolume metadata: name: pv-example spec: capacity: storage: 10Gi accessModes: - ReadWriteMany persistentVolumeReclaimPolicy: Retain hostPath: path: /data/pv

    Why it's wrong here

    Although this manifest declares the required 10Gi capacity and uses a valid persistentVolumeReclaimPolicy of Retain, it selects ReadWriteMany as the access mode. The original requirement does not request a multi-node read-write access mode, and ReadWriteMany is broader than necessary; a hostPath PVC is typically used with ReadWriteOnce because the path is local to a single node. This unnecessary access mode widens the volume's availability beyond what is required, making the option incorrect.

  • ✗

    apiVersion: v1 kind: PersistentVolume metadata: name: pv-example spec: capacity: storage: 10Gi accessMode: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain hostPath: path: /data/pv

    Why it's wrong here

    This option is invalid because the spec uses the singular field name 'accessMode' instead of the plural 'accessModes' required by the Kubernetes PersistentVolume API. In Kubernetes, the accessModes field is a list of strings such as ReadWriteOnce, ReadOnlyMany, or ReadWriteMany, and a typo like this causes a schema validation error when the manifest is applied. Even though the intended access mode and reclaim policy are correct, the incorrect field name prevents the PersistentVolume from being created.

  • ✓

    apiVersion: v1 kind: PersistentVolume metadata: name: pv-example spec: capacity: storage: 10Gi accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain hostPath: path: /data/pv

    Why this is correct

    This is the correct PersistentVolume manifest because it satisfies all the stated requirements: it declares capacity of 10Gi, uses the plural accessModes field with ReadWriteOnce as a valid single-node access mode, and sets persistentVolumeReclaimPolicy to Retain. The hostPath points to /data/pv, and the PV is available to match a PersistentVolumeClaim that requests up to 10Gi with a compatible access mode. The manifest is structurally and semantically valid under the v1 API.

  • ✗

    apiVersion: v1 kind: PersistentVolume metadata: name: pv-example spec: capacity: storage: 10Gi accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Delete hostPath: path: /data/pv

    Why it's wrong here

    This manifest is structurally valid but uses the wrong reclaim policy: persistentVolumeReclaimPolicy is set to Delete instead of Retain. When a PersistentVolumeClaim bound to this PV is released, Kubernetes would delete the PV object and attempt to remove the underlying storage; for a hostPath volume this means deleting the /data/pv directory and all its contents. Because the correct answer requires the PV and its data to be preserved after PVC release via Retain, the Delete policy makes this option wrong.

About these practice questions

This CKA question is part of Courseiva's 726-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 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.