Storage Classes and Dynamic Provisioning
Everything we've seen so far is correct and fundamental to Kubernetes storage. But it doesn't scale – there's no way somebody managing a large Kubernetes environment can manually create and maintain large numbers of PVs and PVCs. We need something more dynamic. Enter storage classes.
As the name suggests, storage classes allow us to define different classes, or tiers, of storage. How you define your classes is arbitrary but will depend on the types of storage you have access to. For example, you might define a fast class, a slow class, and an encrypted class.
As far as Kubernetes goes, storage classes are defined as resources in the storage.k8s.io/v1
API group. The resource type is StorageClass
, and we define them in regular YAML files that we POST to the API server for deployment. You can use the sc
short name to refer to StorageClass
objects when using kubectl
.
Note
You can see a full list of API resources...