Storage Classes and Dynamic Provisioning
Let's look at Storage Classes' YAMLs and how to implement them.
We'll cover the following
Storage classes are resources in the storage.k8s.io/v1
API group. The resource type is StorageClass
, and we define them in regular YAML files. We can use the sc shortname when using kubectl
.
Note: We can run a
kubectl api-resources
command to see a full list of API resources and their shortnames. It also shows each resource’s API group and what its equivalentkind
is.
As the name suggests, StorageClasses lets us define different classes of storage that apps can request. How we define our StorageClasses is up to us and will depend on the types of storage we have available. For example, if we have a storage system with fast and slow storage, as well as optional remote replication, we might define these four classes:
fast-local
fast-replicated
slow-local
slow-replicated
Let’s look at an example.
A StorageClass YAML
The following YAML object defines a StorageClass called fast-local that will provision encrypted SSD volumes capable of 10 IOPs per gigabyte from the Ireland AWS region.
Get hands-on with 1400+ tech skills courses.