Skip to main content
Persistent storage in Kubernetes is provided through PersistentVolumes (PVs) and PersistentVolumeClaims (PVCs). This article shows how to create a PVC backed by a custom StorageClass, bind it to a pod, and resize it when additional storage is needed.

PV and PVC overview

A PV (PersistentVolume) in Managed Kubernetes is a resource used to store data. It is attached to pods but has a separate lifecycle, specified by its reclaim policy. This policy determines if a PV will continue to exist or will be deleted when a pod attached to it gets destroyed. A PV represents available storage in the cluster. Applications don’t use PVs directly — instead, they request storage by creating a PersistentVolumeClaim (PVC). Kubernetes forwards that request to a StorageClass, which provisions a matching PV automatically.

Create a PVC

Before creating a PVC, create a storage class with the required disk type. Gcore provides the following disk types:
  1. Verify that the required disk type is available in the target region. Navigate to Managed Kubernetes, select the region, and click Create Cluster. In the Pools section, open the Volume type dropdown to see the available options.
Volume type dropdown in Kubernetes cluster creation showing High IOPS SSD, Standard, and SSD Low-Latency options
A storage class configured with a disk type unavailable in the target region will fail to provision PVs. Choose one of the available volume types and use its identifier in the StorageClass manifest.
  1. Create a YAML file to create a storage class with the required disk type:
The manifest defines a StorageClass that provisions volumes of the selected disk type. Replace the placeholder values:
  • csi-sc-cinderplugin-hiiops: Storage class name
  • ssd_hiiops: Disk type (standard, ssd_hiiops, or ssd_lowlatency)
  1. Run the kubectl command from the file directory:
The expected output:
Once the StorageClass exists, create a PersistentVolumeClaim that requests storage from it.
  1. Create a YAML file to configure a PVC:
Replace the placeholder values:
  • block-pvc: PVC name
  • csi-sc-cinderplugin-hiiops: Name of the created storage class
  • 1Gi: Storage size
  1. Run the kubectl command from the file directory:
The expected output:
The PVC is now created with a storage class of the required disk type.

Bind a PVC to a pod

  1. Reference the PVC from the pod manifest to mount the volume inside the container.
Replace the placeholder values:
  • mypod: Pod name
  • myfrontend: Container name
  • "/var/www/html": Mount path inside the container
  • mypd: Volume name
  • block-pvc: PVC name
  1. Run the kubectl command from the file directory:
Expected output:
The PVC is now connected to the pod. Its containers can access the storage at the configured mount path.

Resize a PVC

To increase the size of a volume, update the PersistentVolumeClaim that was used to provision it. When a PVC is created, Managed Kubernetes provisions a dynamic PV that matches its specs — resizing the PVC triggers a corresponding resize of the underlying PV.
Only increasing PVC storage size is supported. Reducing the size of a PV is not possible.
  1. Find the PVC by querying all PVCs with this command:
  1. In the PVC YAML, update the storage field under resources.requests to the desired size (1Ti, 250Gi, etc.).
For example, a PVC configured for 250 Gi using the standard storage class:
  1. Run the following command to apply the updated PVC manifest to the cluster:
The update may take a few minutes to complete.
  1. Verify the resize was applied successfully: