Full lesson
Explore the full explanation, examples, and visuals at your own pace.
Part 1
A Pod asks for storage through a claim, and a volume supplies it. A Pod is the smallest unit Kubernetes runs, here our Postgres Pod, orders-db. It never points at a disk directly. It asks through db-data, a PersistentVolumeClaim, and that claim is bound to pv-7f3a, the actual volume.
Three objects, three jobs
Three objects, three jobs. The PersistentVolume, pv-7f3a, is the actual disk. The PersistentVolumeClaim, db-data, is the request: ten gibibytes, ReadWriteOnce, meaning one node can write at a time. The StorageClass, fast-ssd, is the recipe for building a new disk.
- PV: an actual piece of storage
- PVC: a request for size and access
- StorageClass: recipe for making new disks
The claim ticket and the locker
Think of it like a coat check. The orders-db Pod holds only a paper ticket, the db-data claim for 10Gi. The actual storage is a numbered locker, pv-7f3a, kept in a warehouse away from the worker's desk. If no locker matches, the fast-ssd builder makes one.
Step 1: Pending becomes Bound
The orders-db Pod asks through the db-data claim, which requests 10Gi from the fast-ssd class, the StorageClass, a recipe for making storage. At first db-data is Pending, because no matching volume exists. So fast-ssd creates a disk, and it appears as pv-7f3a. Kubernetes binds the claim to it, one-to-one, and db-data becomes Bound.
Where the volume comes from
A PV can appear in two ways. With static provisioning, an admin pre-creates pv-7f3a, and db-data gets matched to it. With dynamic provisioning, db-data requests the fast-ssd class, which creates the PV. Either way, size, access mode and class must match. Most cloud clusters default to dynamic.
The disk lives outside the node
A node is just a worker machine in the cluster. Here, the orders-db Pod runs on Node A, but its data isn't stored inside Node A. The volume, pv-7f3a, is a cloud disk that sits outside every node and is attached to the Pod over the network.
Step 2: Pod recreated on Node B
The orders-db Pod is deleted and recreated, this time on Node B. It still names the claim db-data, so Kubernetes finds the same volume, pv-7f3a. The disk detaches from Node A and reattaches to Node B. The Pod is new, but the disk is the same, so the same orders rows are there.
What actually deletes the data
Look at what each event does to the data. Delete the Pod, and the data is kept, whatever the reclaim policy. Move the Pod to another node, same result. Delete the PVC, and under Delete, the usual default for dynamically provisioned disks, the disk is gone. Only with Retain is it kept.
A Pod can only move where its disk can attach.
There's a limit, though. Cloud disks are usually tied to one zone, and local or hostPath volumes pin the Pod to one node, so moves stay within those limits.
The Pod holds a claim ticket; the disk lives outside the node.
The Pod holds a claim ticket; the disk lives outside the node. So when you care about the data, protect the PVC, not the Pod. And before you rely on it, check the reclaim policy, because under Delete, removing the claim removes the disk too.
