Dynamic volume provisioning¶
Dynamic volume provisioning is a storage management mechanism in Kubernetes that automatically creates storage volumes on-demand.^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md] Unlike static provisioning, where administrators manually create PersistentVolumes (PVs) in advance, dynamic provisioning generates the storage resources only when a user requests them.^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]
Mechanism¶
The process is driven by the interaction between PersistentVolumeClaims (PVCs) and StorageClasses.^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]
- User Request: A user defines a PVC and specifies a
storageClassNamein the manifest.^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md] - Provisioning: Upon detecting the claim, the cluster attempts to dynamically provision a storage volume based on the settings defined in the referenced
StorageClass.^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md] - Binding: Once created, the PV is automatically bound to the PVC.^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]
If a PVC does not specify a class, it attempts to use the cluster's default StorageClass.^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md] To explicitly disable dynamic provisioning and force a match only with pre-existing static volumes, a user can set the storageClassName to an empty string ("").^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]
Prerequisites¶
For dynamic provisioning to function correctly, the cluster administrator must have created and configured the necessary StorageClass resources beforehand.^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md] The availability of dynamic provisioning depends on the underlying infrastructure and the provisioner used (e.g., Cloud NFS, Cloud Disk).^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]
Benefits¶
Dynamic provisioning simplifies the workflow for storage consumers. It removes the need for users to have detailed knowledge of the underlying storage infrastructure or for administrators to pre-provision every potential block of storage.^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]
Related Concepts¶
- [[Persistent Volume]]
- [[Persistent Volume Claim]]