Lesson  in  Exam 1 — Cluster Basics, Storage & Scheduling

Question 5: Storage, PV, PVC, Pod volume

Hand-create a PersistentVolume and PersistentVolumeClaim, then mount the claim in a Deployment.

Create a new PersistentVolume named safari-pv. It should have a capacity of 2Gi, accessMode ReadWriteOnce, hostPath /Volumes/Data and no storageClassName defined.

Next create a new PersistentVolumeClaim in namespace project-t230 named safari-pvc. It should request 2Gi storage, accessMode ReadWriteOnce and should not define a storageClassName. The PVC should bind to the PV correctly.

Finally create a new Deployment safari in namespace project-t230 which mounts that volume at /tmp/safari-data. The Pods of that Deployment should be of image httpd:2-alpine.

Hint 1

Leaving storageClassName unset on the PV is fine. But this cluster has a default StorageClass (local-path) — if you simply omit storageClassName on the PVC, the admission controller auto-fills it with that default and dynamically provisions its own volume instead of binding to safari-pv. To truly opt out, set it explicitly: storageClassName: "".