Skip to content

Kubernetes StorageClass

A StorageClass provides a way for administrators to describe the "classes" of storage they offer.^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md] It defines different tiers or types of storage (such as fast SSDs or standard hard drives) and allows for the Dynamic Provisioning of Persistent Volumes (PV).

Dynamic Provisioning

When a [[PersistentVolumeClaim|Persistent Volume Claim (PVC)]] is created, it can request a specific storage class.^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md] If a StorageClass is specified and configured, Kubernetes can automatically provision a new storage volume (PV) on the backend infrastructure, binding it to the requesting PVC without manual intervention.^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md]

If a PVC does not explicitly specify a StorageClass, it will use the cluster's default StorageClass to create the volume.^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md]

Disabling Dynamic Provisioning

Users can disable Dynamic Provisioning for a specific claim by setting the storageClassName parameter to an empty string ("").^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md] This indicates that the PVC should not use a dynamically created volume and must instead bind to an existing, statically provisioned PV.

Common Implementations

In single-node environments like Docker Desktop, the default StorageClass is typically hostpath, which stores data on the node's local filesystem.^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md] In production multi-node clusters, StorageClasses often provision backend services like NFS (Network File System) or cloud storage solutions (e.g., Google Compute Engine Disk).^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md]

Sources

  • 400-devops-06-kubernetes-k8s-ithelp-day20-readme.md