Skip to main content

Storage Class

When defining a Storage Class, you specify details about how volumes should be provisioned, such as the storage provisioner to use, default reclaim policies, volume binding modes, among others.

We can associate the StorageClass as a type of template for PersistentVolumes (PVs) in Kubernetes. The StorageClass provides a way to define default configurations for dynamic provisioning of persistent volumes. But this is not a completely valid statement, as storage class does other things besides that.

When a volume is created and a storage class is pointed to, the volume will inherit the storage class configurations.

It's possible to create a volume without a Storage Class, but we'll need to define several parameters in the volume and create things manually.

In this example below, it's necessary that the cloud volume be previously created before the PV. This is called static provisioning volumes.

alt text

But it would be interesting if this volume could be created automatically. This is where another Storage Class functionality comes in. Which is to be the storage provisioner for the PV.

The Storage Class uses Volume Driver Plugins to make this connection.

alt text

Each different provisioner type needs different parameters, so it's not possible to put everything here in the study as there are many different ones as mentioned earlier. When setting up a specific Storage Class, you need to look up how to do it.

We can use the Storage Class to create different disk types using the same provisioners, which is why it's called class!

alt text