Table of Contents
- Static Provisioning Recap
- Dynamic Provisioning with StorageClass
- StorageClass Definition
- Using a Dynamic PVC and Pod
- Comparing Provisioning Methods
- Customizing StorageClass Parameters
- Defining Service Tiers
- Links and References
Static Provisioning Recap
With static provisioning, you manually create the underlying cloud disk before you define a PV:Static provisioning works, but each new disk requires manual cloud CLI steps. Maintenance and scaling can become cumbersome.
Dynamic Provisioning with StorageClass
With a StorageClass, Kubernetes can automatically create and bind a PV when you apply a PVC. This dynamic provisioning eliminates manual disk creation.StorageClass Definition
Define a StorageClass that uses the GCE PD provisioner:Using a Dynamic PVC and Pod
- Create a PVC that references your StorageClass:
- Deploy a Pod that mounts the PVC:
- Provision a new GCE PD of the requested size.
- Create a corresponding PV.
- Bind your PVC to that PV.
- Attach the volume to your Pod.
Comparing Provisioning Methods
| Feature | Static Provisioning | Dynamic Provisioning (StorageClass) |
|---|---|---|
| Disk Creation | Manual via cloud CLI | Automated by Kubernetes |
| PV Definition | Pre-created PersistentVolume | Generated automatically |
| PVC Binding | Manual or automatic if labels match | Automatic |
| Scalability | Limited (manual work for each disk) | High (one PVC, one step) |
| Flexibility | Low | High (parameters, tiers, provisioners) |
Customizing StorageClass Parameters
Most provisioners let you fine-tune disks. For GCE PD, you can specify:Be cautious with
regional-pd: it offers high availability at higher cost. Always choose based on your SLA requirements.Defining Service Tiers
You can create multiple StorageClasses to represent different performance tiers:| Tier | Disk Type | Replication | Use Case |
|---|---|---|---|
| silver | pd-standard | none | Development, testing |
| gold | pd-ssd | none | Production, low-latency |
| platinum | pd-ssd | regional-pd | Mission-critical, high-availability |
storageClassName to select your tier. Kubernetes handles provisioning and binding behind the scenes.
Links and References
- Kubernetes StorageClass Documentation
- Persistent Volumes
- GCE PD Provisioner
- gcloud compute disks create
Mastering StorageClasses empowers you to build scalable, self-service storage in your Kubernetes clusters—no more manual volume management!