Dynamic Volume Provisioning

A PVC asks for storage that no existing volume can give, and soon a new disk and a PV for it appear. Who builds them, and how does the claim end up bound to that new volume and not to some other one?

Play the animation 5 steps, animated, plays on a computer or a tablet

Dynamic Volume Provisioning diagram: Dynamic provisioning

Dynamic Volume Provisioning, step by step

  1. With static provisioning an administrator has to create the volume by hand before anyone can claim it. Here nobody did, so the binding controller finds no candidate to bind to. Under the default Immediate binding mode it turns to the class the claim names, and copies the provisioner that class names onto the claim as an annotation.

    Play from step 1
  2. The StorageClass names a provisioner and the parameters to build with. The external-provisioner sidecar watches for unbound claims whose volume.kubernetes.io/storage-provisioner annotation carries its own name, picks this one up, and reads both the size the claim asks for and the parameters its class carries.

    Play from step 2
  3. The provisioner calls CreateVolume on the driver, which asks the storage backend for a real disk of the requested size. The backend carves one out and hands back the identifier it can be addressed by later. This is the only step here that touches real hardware: getting the disk onto a Node comes later, once a Pod uses the claim.

    Play from step 3
  4. A disk on its own is invisible to Kubernetes. The provisioner writes a PersistentVolume object carrying the identifier it just got back, and that object is the cluster representation of the disk. Only now does the volume exist as something a claim can be paired with.

    Play from step 4
  5. The new volume was built for this one claim, so the provisioner already stamped it with a claimRef pointing back at the claim. The binding controller still runs its usual match, and that pre-bound volume wins outright. The controller marks the volume Bound first, then writes volumeName on the claim and turns the claim Bound.

    Play from step 5

Sources