Work with Storage Classes

This document describes working with Kubernetes storage classes in PMK. An understanding of Kubernetes concepts of Storage Classes, Volumes and Persistent Volumes is recommended.

A Storage class in Kubernetes provides a way for administrators to describe the ‘classes’ of storage they offer. A storage class is used by a Kubernetes cluster to dynamically provision persistent volumes for a Kubernetes application when the application requires persistent storage.

Default Storage Class

A Kubernetes cluster can be associated with multiple storage classes. You can designate a specific storage class as the default storage class for the cluster. If no storage class is specified in a PersistentVolumeClaim for an application, the default storage class is used for the app deployment.

Storage Class Resources

Each Kubernetes storage class has four key fields - name, provisioner, parameters and reclaimPolicy. The first field - name is significant because it’s what the users will use when requesting a storage class. The last 3 fields are used when a PersistentVolume belonging to the class is being dynamically provisioned.

Storage Provisioners For Different Backends

Each storage class object has an associated provisioner. The provisioner determines what persistent volume plugin will be used for provisioning persistent volumes corresponding to that class. The provisioners are specific to the endpoint on which the cluster is being deployed.

Here is the official list of all a href=”https://kubernetes.io/docs/concepts/storage/storage-classes/#provisioner “ target=”_blank” rel=”noopener”>Internal Provisioners</a> Kubernetes supports. Internal provisioners are shipped alongside Kubernetes. In addition, there are a number of external provisioners that are not shipped by default with Kubernetes but that external vendors or community members have written per the Kubernetes storage class specification. PMK does not currently ship with any external provisioners.

Currently, Platform9 supports storage classes for BareOS clusters, clusters created on Amazon AWS and Azure.

Storage Class Parameters And Type

Each storage class object has associated parameters. The parameters are specific to the provisioner used to create the class. One important parameter that most provisioners support is type - which is a way to distinguish between different storage types supported by the underlying provider of the storage. For example, if your cluster is deployed on Amazon AWS and you wish to use an AWS EBS volume for persistent storage for your applications, here is a list of EBS Supported Storage Types.

Add Storage Class

Follow the steps given below to add a new storage class in PMK:

  • Navigate to ‘Storage Classes’ menu and click ‘Create New Storage Class’.
  • Enter the name for the storage class.
  • Select the cluster with which you want to associate this storage class, and the storage type for the storage class.
  • If you want to use this storage class as the default storage class for the cluster, select the ‘Use as Default Storage Class’ checkbox
  • A YAML file is created based on the parameters you specified. You can edit the YAML and add additional parameters if needed, based on the storage class type.
  • Click ‘Create Storage Class’.

The newly added storage class can now be used for deploying persistent storage for your applications on this cluster.

Edit a Storage Class

You can modify a storage class for a cluster by deleting the existing storage class and creating a new storage class per the revised storage class specification. Editing the specification of an existing storage class is not supported.

Delete Storage Class

Follow the steps given below to delete one or more storage classes.

  • Navigate to ‘Storage Classes’ menu and from the grid select the storage classes to delete.
  • Click Delete. A warning is displayed. Click ‘Delete Storage Classes’ to permanently delete the selected storage classes.