0
0
Kubernetesdevops~5 mins

PersistentVolume (PV) definition in Kubernetes - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a PersistentVolume (PV) in Kubernetes?
A PersistentVolume (PV) is a piece of storage in the cluster that has been provisioned by an administrator or dynamically. It is a resource in the cluster just like a node and is used to store data persistently beyond the lifecycle of a pod.
Click to reveal answer
intermediate
Which key fields are required in a PersistentVolume YAML definition?
The key fields include: apiVersion, kind (PersistentVolume), metadata (name), spec (capacity, accessModes, persistentVolumeReclaimPolicy, storageClassName, and the actual storage details like hostPath, nfs, etc.).
Click to reveal answer
beginner
What does the 'accessModes' field specify in a PersistentVolume?
The 'accessModes' field defines how the volume can be mounted by pods. Common modes are ReadWriteOnce (mounted by a single node), ReadOnlyMany (mounted read-only by many nodes), and ReadWriteMany (mounted read-write by many nodes).
Click to reveal answer
intermediate
What is the purpose of 'persistentVolumeReclaimPolicy' in a PV?
It tells Kubernetes what to do with the volume after the claim is released. Common policies are Retain (keep data), Recycle (basic scrub), and Delete (remove volume).
Click to reveal answer
beginner
Show a simple example of a PersistentVolume definition using hostPath.
apiVersion: v1 kind: PersistentVolume metadata: name: example-pv spec: capacity: storage: 1Gi accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain hostPath: path: /mnt/data
Click to reveal answer
What does a PersistentVolume in Kubernetes represent?
AA storage resource in the cluster
BA running container
CA network policy
DA pod specification
Which field in a PV definition specifies how the volume can be accessed by pods?
Acapacity
BstorageClassName
Cmetadata
DaccessModes
What does the 'persistentVolumeReclaimPolicy' control?
AThe size of the volume
BThe access mode of the volume
CWhat happens to the volume after release
DThe namespace of the volume
Which of these is NOT a valid access mode for a PersistentVolume?
AWriteOnlyOnce
BReadOnlyMany
CReadWriteMany
DReadWriteOnce
In a hostPath PersistentVolume, what does the 'path' specify?
AThe network address
BThe directory on the node's filesystem
CThe pod name
DThe storage class
Describe the main components and fields of a PersistentVolume definition in Kubernetes.
Think about the YAML structure and what each part means.
You got /8 concepts.
    Explain the difference between the access modes ReadWriteOnce, ReadOnlyMany, and ReadWriteMany in PersistentVolumes.
    Consider how many nodes can use the volume and in what mode.
    You got /3 concepts.