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 a piece of available storage. To use a PV, a user needs to create a PersistentVolumeClaim (PVC,) which is a request for storage. Kubernetes passes this request to a storage class, which creates PVs automatically in response to the PVC.
Before you create a PVC, you need to create a storage class with the required disk type. Gcore provides the following disk types:
Volume type | Features |
standard | Standard
Network SSD disk, which provides stable and high random I/O performance, as well as high data reliability (6 IOPS per 1 GiB; 0.4 MB/s per 1 GiB.) The IOPS performance limit is 4,500. The bandwidth limit is 300 MB/s. |
ssd_hiiops | High IOPS SSD
High-performance SSD block storage designed for latency-sensitive transactional workloads (60 IOPS per 1 GiB; 2.5 MB/s per 1 GiB.) The IOPS performance limit is 9,000. The bandwidth limit is 500 MB/s. |
ssd_lowlatency | SSD Low Latency
SSD block storage, designed for applications that require low-latency storage and real-time data processing. It can achieve IOPS performance of up to 5000, with an average latency of 300 µs. |
To proceed with a PVC, follow the steps:
1. Make sure the required disk type is available in your region. To do so, go to the Kubernetes tab, select the required region and click Create new cluster. Click the Volume type field and check which options are available on the drop-down list.
If you create a storage class with a volume type that is not available in your region, the PV won’t work.
2. Create a YAML file to create a storage class with the required disk type:
Enter your custom values instead:
csi-sc-cinderplugin-hiiops
: Storage class name ssd_hiiops
: Disk type (standard
, ssd_hiiops
, or ssd_lowlatency
)2. Run the kubectl command from the file directory:
kubectl apply -f <name of the created YAML file>.yaml
You will get this output:
storageclass/<the name of the created storage class> created
3. Create a YAML file to configure a PVC:
Enter your custom values instead:
block-pvc
: PVC name csi-sc-cinderplugin-hiiops
: Name of the created storage class 1Gi
: Storage size4. Run the kubectl command from the file directory:
kubectl apply -f <name of the created YAML file>.yaml
You will get this output:
persistentvolumeclaim/<the name of the created PVC> created
This means you have successfully created a PVC with a storage class of the required disk type. To connect the PVC to your pods, refer to the section below.
1. Create a YAML file to bind the created storage class to your pod.
Enter your custom values instead:
mypod
: Pod name myfrontend
: Container name "/var/www/html"
: Destination inside the pod where to mount the storage class mypd
: Storage class name block-pvc
: Created PVC name2. Run the kubectl command from the file directory:
kubectl apply -f <name of the created YAML file>.yaml
3. You will get this output:
pod/<the pod name> created
This means you have successfully connected the PVC to your pod, and its containers can now access the storage.
Was this article helpful?
Discover our offerings, including virtual instances starting from 3.7 euro/mo, bare metal servers, AI Infrastructure, load balancers, Managed Kubernetes, Function as a Service, and Centralized Logging solutions.