# Kubernetes StorageClass and PVC

## Configuring Kubernetes Storage

You can configure the Storage Class and Persistent Volume Claims (PVCs) from the DuploCloud Portal.

In the DuploCloud Portal, navigate to **Kubernetes** -> **Storage**. The **Kubernetes Storage** page displays.

You define your Kubernetes Persistent Volume Claims and Storage Classes from this page.

## Creating a Storage Class

1. DuploCloud Portal, navigate to **Kubernetes** -> **Storage**.
2. Click **Add**. The **Add Kubernetes Storage Class** page displays.
3. Define the Storage Class **Name**, **Provisioner**, **Reclaim Policy**, and **Volume Binding Mode.** Select other options, such as whether to **Allow Volume Expansion**.
4. Create a Storage Class, as in the example below.
5. For EKS, you can create EFS following [these steps](https://docs.duplocloud.com/docs/automation-platform/overview/aws-services/elastic-file-system-efs).

<figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2F1GHu2zkkNAPMAJhjuEOe%2Fimage.png?alt=media&#x26;token=573e738a-399e-479c-aefb-fa8b04314650" alt=""><figcaption><p><strong>Add Kubernetes Storage Class</strong> page for EKS in AWS</p></figcaption></figure>

<figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2F8UsMRswNKp5rfoqgOOFd%2Fimage.png?alt=media&#x26;token=f5e1ef15-4740-4930-9f59-d95e2b7056c9" alt=""><figcaption><p><strong>Add Kubernetes Storage Class</strong> page for AKS in Azure</p></figcaption></figure>

{% hint style="info" %}
For information on using Native Azure StorageClasses, [see this section](https://docs.duplocloud.com/docs/automation-platform/kubernetes-overview/kubernetes-storageclass-and-pvc/storage-options).
{% endhint %}

## Creating Kubernetes Persistent Volume Claim

DuploCloud Portal, navigate to **Kubernetes** -> **Storage**.

The **Persistent Volume Claims** option is selected by default.

<figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2Fe0ngkfxM6bwZ4l0J1pSt%2FScreenshot%20(235).png?alt=media&#x26;token=f93de030-d27d-43d7-9ffa-b319498c140f" alt=""><figcaption><p>The <strong>Persistent Volume Claims</strong> option on the <strong>Kubernetes Storage</strong> page</p></figcaption></figure>

Click **Add**. The **Add Kubernetes Persistent Volume Claim** page displays.

<div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FxsAf41rwz49crdtKzY91%2Fscreenshot-nimbusweb.me-2024.02.16-15_13_10.png?alt=media&#x26;token=7fe9621d-6408-4f24-a9d3-49cbba11b830" alt=""><figcaption><p>The <strong>Add Kubernetes Persistent Volume Claim</strong> page</p></figcaption></figure></div>

3. Define the PVC **Name**, **Storage Class Name**, **Volume Name**, **Volume Mode**, and other details such as volume **Access Modes**.
4. Optionally, to group resources in the Kubernetes Apps dashboard, add an app name in the **Labels** field, in the following format:

   ```
   Key: app.duplocloud.net/app-name
   Value: <app name>
   ```
5. Click **Add**.

{% hint style="warning" %}
If you are using K8s and PVCs to autoscale your storage groups and you encounter out-of-space conditions, simply adding new storage volumes may not resolve the issue. Instead, you must increase the size of the existing PVCs to accommodate your storage needs.

For guidance on how to perform volume expansion in Kubernetes, refer to the following resources:

* [Managing Volume Expansions in StatefulSets on GKE](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/volume-expansion#managing_volume_expansions_in_statefulsets)
* [Increasing Disk Size in a StatefulSet](https://serverfault.com/questions/955293/how-to-increase-disk-size-in-a-stateful-set)
* [Expanding Persistent Volume Claims in Kubernetes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#expanding-persistent-volumes-claims)
* [Expanding Kubernetes Persistent Volumes on EKS](https://www.jeffgeerling.com/blog/2019/expanding-k8s-pvs-eks-on-aws)
  {% endhint %}
