Containers are ephemeral by default—when a container restarts, all data written to its local filesystem is lost. On the CKAD exam, you must demonstrate how to attach persistent storage to Pods using PVCs and StorageClasses.
TL;DR (Quick Summary)#
- PersistentVolume (PV): Physical storage resource provisioned in the cluster (cluster-scoped).
- PersistentVolumeClaim (PVC): Request for storage by a user/developer (namespace-scoped).
- Access Modes:
ReadWriteOnce(RWO): Mountable as read-write by a single node.ReadOnlyMany(ROX): Mountable as read-only by many nodes.ReadWriteMany(RWX): Mountable as read-write by many nodes (NFS, CephFS).
- Reclaim Policies:
Retain(manual cleanup),Delete(auto-destroys backing storage).
1. Storage Abstraction Layer#
graph TD
SC["StorageClass: fast-ssd
(provisioner: kubernetes.io/no-provisioner)"] -->|Provisions| PV["PersistentVolume: pv-data
(5Gi, hostPath: /data)"]
PVC["PersistentVolumeClaim: pvc-app
(requests: 2Gi, accessModes: [ReadWriteOnce])"] -->|Binds to| PV
Pod["Application Pod"] -->|volumeMounts: /usr/share/nginx/html| PVC
2. CKAD Terminal Hands-on Scenarios#
Scenario A: Create PersistentVolume#
Create a PersistentVolume named pv-analytics with 5Gi capacity, ReadWriteOnce access mode, Retain reclaim policy, using hostPath directory /mnt/data.
pv-analytics.yaml:
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-analytics
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: /mnt/dataApply and verify PV creation:
kubectl apply -f pv-analytics.yaml
kubectl get pv pv-analyticsScenario B: Create PersistentVolumeClaim & Bind to Pod#
Create a PVC named pvc-analytics requesting 2Gi storage with ReadWriteOnce access mode, then mount it into a Pod named data-writer at /var/data.
pvc-analytics.yaml:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-analytics
namespace: default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gidata-writer-pod.yaml:
apiVersion: v1
kind: Pod
metadata:
name: data-writer
spec:
volumes:
- name: storage-vol
persistentVolumeClaim:
claimName: pvc-analytics
containers:
- name: writer
image: busybox:1.36
command: ["sh", "-c", "echo 'Hello persistent storage' > /var/data/out.txt && sleep 3600"]
volumeMounts:
- name: storage-vol
mountPath: /var/dataVerify binding status:
kubectl apply -f pvc-analytics.yaml
kubectl apply -f data-writer-pod.yaml
kubectl get pvc pvc-analytics
# Status must show: Bound3. Storage Troubleshooting Matrix for CKAD#
| Symptom / Error | Root Cause | Solution |
|---|---|---|
PVC is in Pending state | No PV matches accessMode or capacity | Create matching PV or lower PVC storage request |
PVC Pending (StorageClass mismatch) | PVC specifies storageClassName different from PV | Match storageClassName exactly or set to "" |
Pod ContainerCreating | PV hostPath directory missing on node | Ensure directory exists on target node or use dynamic provisioner |
Summary & Next Steps#
In this episode, we covered:
- Creating PersistentVolumes and requesting storage via PVCs.
- Access modes (
ReadWriteOnce,ReadWriteMany) and reclaim policies. - Mounting PVCs into Pod containers.
- Debugging PVC
Pendingstatus issues.
In CKAD Episode 6: Health Probes & Pod Debugging, we will master Liveness/Readiness/Startup probes and troubleshooting crashing containers!

