K8s by Example: Storage Classes
| StorageClasses define storage “tiers” with different performance, cost, and backup policies. They enable dynamic provisioning, so PVs are created automatically when PVCs request that class. No pre-provisioning needed. |
| storageclass.yaml | |
| StorageClass defines how to provision volumes. | |
| storageclass-provisioners.yaml | |
| Provisioners create the actual storage. Examples: AWS EBS CSI (types: gp2, gp3, io1, io2), Azure Disk CSI (Standard_LRS, Premium_LRS, StandardSSD_LRS), GCE PD CSI (pd-standard, pd-ssd, pd-balanced), NFS CSI. CSI (Container Storage Interface) is the modern standard. | |
| storageclass-binding.yaml | |
| Volume binding modes control when PVs are created. | |
| storageclass-params.yaml | |
| Parameters are passed to the provisioner. First example: AWS EBS with encryption and custom IOPS. Second example: Azure with specific tier. Third example: GCE with multi-zone replication. Check your CSI driver documentation for available options. | |
| storageclass-reclaim.yaml | |
| Reclaim policy on StorageClass sets default for dynamically created PVs. | |
| storageclass-default.yaml | |
| Default StorageClass is used when PVC doesn’t specify | |
| storageclass-topology.yaml | |
| Allowed topologies restrict where volumes can be provisioned. Volumes only created in specified zones; Pods using this class scheduled to these zones. Works with WaitForFirstConsumer to ensure Pod and volume are co-located. | |
| terminal | |
| Debug storage issues by checking StorageClass configuration and provisioner logs. Mount options are passed to the mount command when attaching the volume. | |