Dynamic Provisioning is the method used to create persistent volumes for a Kubernetes application on-demand as it frees the Kubernetes administrator from having to pre-provision potentially many persistent volumes up front that the PVC can then claim when needed (i.e. static provisioning). Dynamic Provisioning entails creating a persistent volume claim that is matched to an application and a StorageClass. In fact, the StorageClass is the key construct which enables dynamic provisioning to be available as it includes the volume characteristics consumed by the developer and is defined and setup by the vCenter administrator.
The beauty of dynamic provisioning is two-fold: no storage is actually provisioned until the Kubernetes deployment is instantiated with a persistent volume claim - meaning that a data vVol or VMFS VMDK and its associated space are not consumed on the FlashArray until the Kubernetes application is in the process of being created. As environments grow, dynamic provisioning quickly becomes the only reasonable option to use as the alternative with static provisioning means that storage administrators have to manually create each persistent volume before it can be used, which does not scale as easily.
Let's break down a simple persistent volume claim YAML file into the important components for dynamic provisioning. There are certainly more options than what is shown here; many of which we will expand upon in later sections of this KB and overall guide:
apiVersion: v1
kind: PersistentVolumeClaim (1)
metadata:
name: pvc-vvols-mysql (2)
spec:
storageClassName: kubernetes-vvols (3)
accessModes:
- ReadWriteOnce (4)
resources:
requests:
storage: 30Gi (5)