Kubernetes interview question · Most asked
How do persistent volumes work? Explain PV, PVC, StorageClass and CSI.
Summary
A PersistentVolumeClaim is a pod's request for storage (size, access mode); a PersistentVolume is the actual piece of storage; a StorageClass describes how to provision volumes dynamically, through a CSI (Container Storage Interface) driver for the backing system (EBS, Persistent Disk, Ceph, NFS).
Longer Answer
Details that matter: access modes (ReadWriteOnce attaches to one node; ReadWriteMany needs shared file storage such as EFS or NFS); volumeBindingMode: WaitForFirstConsumer provisions the volume in the zone where the pod is scheduled, avoiding zone mismatches; reclaimPolicy decides whether the disk is deleted with the claim; volume expansion and snapshots depend on the driver.
Block volumes are zonal, so a StatefulSet pod tied to a volume in one zone cannot move to another zone. Back up data independently of Kubernetes objects.
Key Points
- PVC = request; PV = storage; StorageClass = provisioning.
- CSI drivers implement backends.
- Access modes; WaitForFirstConsumer.
- Zonal volumes pin pods to zones.
More most-asked Kubernetes questions
- ConfigMaps and Secrets: how do they differ, and how should secrets really be handled?
- How does the scheduler place pods? Explain resource requests, node affinity, taints and tolerations.
- Describe the Kubernetes architecture: what runs on the control plane and what runs on the nodes?
- How do rolling updates work in a Deployment, and how do you roll back?
- Explain the Service types: ClusterIP, NodePort, LoadBalancer, ExternalName and headless.
- What happens, step by step, when you run kubectl apply for a Deployment?
- Deployment, StatefulSet, DaemonSet, Job and CronJob: when do you use each?
- What is the difference between resource requests and limits, and what are the QoS classes?