Configure a PVC
This sections includes instructions on how to create a PersistentVolumeClaim (PVC) that uses the configured Kubernetes StorageClass to request a PV.
If successful, you can then mount the PV to a pod.
Create the PVC
A PersistentVolumeClaim (PVC) is a request for access to the PersistentVolume on the cluster. The PVC can be configured to request storage of a certain size or access mode. Using the associated StorageClass, the cluster administrator can control more than PersistentVolume size and access mode—such as performance or service level.
After you create the Trident backend and StorageClass you can create a PVC. After the PVC is created, you can mount the volume in a pod.
Sample manifests
The following examples show basic PVC configuration options.
This example shows a basic PVC with RWX access that is associated with a StorageClass named basic-csi.
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-storage
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
storageClassName: ontap-gold
This example shows a basic PVC for iSCSI with RWO access that is associated with a StorageClass named protection-gold.
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-san
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: protection-gold
Create PVC
-
Create the PVC.
kubectl create -f pvc.yaml -
Verify the PVC status.
kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE pvc-storage Bound pv-name 2Gi RWO 5m
Refer to Kubernetes and Trident objects for details on how storage classes interact with the PersistentVolumeClaim and parameters for controlling how Trident provisions volumes.