Skip to main content
Kubernetes internalsLesson 11 of 12

When Volumes Attach, and Failures

The basic flow of requesting with a PVC and receiving a PV is in How Storage Gets Attached (PVC·PV). This lesson goes further: when and where a volume is created, and what happens to data when a node fails.

PVC statusPending
Pod statusNone
Data location-
node-1node-2PVCdata · 10GiStorageClassbinding modeSchedulerpicks Pod nodedbnode-1Local disknode-1dbnode-2Local disknode-2Snapshotpoint-in-time copyStorageNFS, SAN, etc.When to create?
RequestAppears in a later step

What you will learn

  • Immediate vs WaitForFirstConsumer
  • Pending while waiting for a Pod is normal
  • Local volume vs network storage on node failure
  • Why RWO means "one node"
  • Expansion only grows; snapshots are not backups

Myths and facts​

MythFact
A Pending PVC means something is brokenWith WaitForFirstConsumer it is normal until a Pod appears
Local volumes are fast, so always betterOn node failure, the Pod cannot move to another node
When a node dies, the volume attaches elsewhere at onceRWO waits for confirmation it was detached from the old node
RWO means only one Pod can use itIt means one node. Several Pods on that node can share it
You can shrink volume size laterIt can only grow
With snapshots you do not need backupsSnapshots live on the same system and can be lost with it

Try it yourself​

kubectl get storageclass # VOLUMEBINDINGMODE and ALLOWVOLUMEEXPANSION
kubectl describe pvc <name> -n <namespace> # Events: normal wait or failure?
kubectl get pvc -n <namespace> # Access modes and capacity
kubectl get pv <pv> -o jsonpath='{.spec.nodeAffinity}' # Local volume tied to one node
kubectl get volumeattachments # Which node an RWO volume is attached to
kubectl get volumesnapshotclass # Can snapshots work here?

Check yourself

  1. A new PVC on a WaitForFirstConsumer StorageClass is Pending, and no Pod uses it yet. What does this mean?
  2. A db with one RWO volume is scaled from 1 to 2 replicas. Only the Pod on node-2 stays in ContainerCreating. Why?
  3. Node-1 fails. Its db Pod used a local volume on node-1's disk. What happens when the Pod is rescheduled to node-2?

Further reading: Persistent volumes · Storage classes · Volume snapshots