# Storage Classes

A StorageClass supplies users a method to detail the type of “classes” offered. Each StorageClass has a provider that determines what type of volume plugin utilized for provisioning a persistent volume. To get to this tab, click on the Storage > Storage Classes tab.

<figure><img src="https://2666020571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgUTD7qSvjzXRaFc9aQt5%2Fuploads%2Fgit-blob-609210863683b4a16240e2500a4f8d12f32874b8%2Fn0u6xxod4tna5rxq6ka26a4he2s0055bqunzd2ghqmx65rg0ybcbjagnomzyg91n.png?alt=media" alt=""><figcaption></figcaption></figure>

Before installing an application that requires storage, we should create a StorageClass. This can be created via the Platform9 Storage Class dashboard.

{% hint style="warning" %}
**Note: Storage Drivers are required as pre-requisite for the StorageSlass**

Kubernetes requires storage drivers to be installed on the clusters before creating the storage class. For example: Clusters created on AWS require ebs drivers to be installed; refer <https://kubernetes.io/docs/concepts/storage/storage-classes/#aws-ebs>.
{% endhint %}

## Add Storage Class

### Step 1.

Navigate to `Storage` > `Storage Classes` menu and click `Add Storage Class`.

### Step 2.

Select the cluster, then name the storage class

{% hint style="info" %}
**Info**

Platform9 can automatically detect available Kubernetes Storage Provisioners from any installed CSI Drivers. If no CSI driver is installed, a Storage Provisioner can be provided manually.
{% endhint %}

<figure><img src="https://2666020571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgUTD7qSvjzXRaFc9aQt5%2Fuploads%2Fgit-blob-76b224b46d8012c1e63373ec7be0fdc1cdf00854%2F1644522268.png?alt=media" alt=""><figcaption></figcaption></figure>

### Step 3.

Choose an installed CSI driver or choose a new CSI driver, then click

.

{% hint style="info" %}
**Info**

If you want to use this storage class as the *default storage class* for the cluster, select the `Use as Default Storage Class` checkbox.
{% endhint %}

### Step 4.

A new review window opens where we can review the configuration to ensure it matches the example StorageClass YAML file for a CSI Hostpath Driver noted below.

{% tabs %}
{% tab title="YAML" %}

```yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: hostpath-csi-sc
  annotations:
    storageclass.kubernetes.io/is-default-class: 'false'
  labels:
    kubernetes.io/cluster-service: 'true'
provisioner: kubernetes.io/hostpath.csi.k8s.io
```

{% endtab %}
{% endtabs %}

<figure><img src="https://2666020571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgUTD7qSvjzXRaFc9aQt5%2Fuploads%2Fgit-blob-67642fb073789829d10b56b325459a5c28426eb9%2F1644598077.png?alt=media" alt=""><figcaption></figcaption></figure>

The YAML file is created based on the parameters specified in the initial *Configure Storage Class* screen. Users can now edit the YAML file and append any additional parameters needed, based on the storage class type. If everything is finished, click the *Complete* button.

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

## Edit a Storage Class

The Storage > Storage Class (link) YAML displays the YAML file that is created based on user specified parameters which can be edited to include any additional parameters if required, based on the storage class type. You can modify a storage class for a cluster by going to the YAML file, making any needed changes, and then clicking save.

## Delete Storage Class

To delete a storage class, follow the steps provided below.

### Step 1.

Navigate to `Storage Classes`menu and select the storage classes to delete from the grid.

### Step 2.

Next, click Delete. A warning is displayed and if so desired, click the `Delete Storage Classes` button to permanently delete the selected storage classes.

{% hint style="warning" %}
**Warning**

When you delete a storage class, any deployment that requests a new volume with the deleted storage class will fail. If you delete the default storage class, any deployment that requests a volume without explicitly specifying a storage class will fail.
{% endhint %}
