Configure a storage class and PVC
Configure a Kubernetes StorageClass object and create the storage class to instruct Trident how to provision volumes. Create a PersistentVolume (PV) and a PersistentVolumeClaim (PVC) that uses the configured Kubernetes StorageClass to request access to the PV. You can then mount the PV to a pod.
Create a storage class
Configure a Kubernetes StorageClass object
The Kubernetes StorageClass object identifies Trident as the provisioner that is used for that class instructs Trident how to provision a volume. For example:
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: ontap-gold provisioner: csi.trident.netapp.io parameters: backendType: "ontap-nas" media: "ssd" provisioningType: "thin" snapshots: "true"
Refer to Kubernetes and Trident objects for details on how storage classes interact with the PersistentVolumeClaim
and parameters for controlling how Trident provisions volumes.
Create a storage class
-
This is a Kubernetes object, so use
kubectl
to create it in Kubernetes.kubectl create -f storage-class-ontapnas.yaml
-
You should now see a basic-csi storage class in both Kubernetes and Trident, and Trident should have discovered the pools on the backend.
kubectl get sc basic-csi NAME PROVISIONER AGE basic-csi csi.trident.netapp.io 15h
Create the PV and PVC
A PersistentVolume (PV) is a physical storage resource provisioned by the cluster administrator on a Kubernetes cluster. The 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 PV and PVC, you can mount the volume in a pod.
Sample manifests
PersistentVolume sample manifest
This sample manifest shows a basic PV of 10Gi that is associated with StorageClass basic-csi
.
apiVersion: v1 kind: PersistentVolume metadata: name: pv-storage labels: type: local spec: storageClassName: basic-csi capacity: storage: 10Gi accessModes: - ReadWriteMany hostPath: path: "/my/host/path"
PersistentVolumeClaim sample manifests
These 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: basic-csi
This example shows a basic PVC for NVMe/TCP with RWO access that is associated with a StorageClass named protection-gold
.
--- kind: PersistentVolumeClaim apiVersion: v1 metadata: name: pvc-san-nvme spec: accessModes: - ReadWriteOnce resources: requests: storage: 300Mi storageClassName: protection-gold
Create the PV and PVC
-
Create the PV.
kubectl create -f pv.yaml
-
Verify the PV status.
kubectl get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pv-storage 4Gi RWO Retain Available 7s
-
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.
Trident attributes
These parameters determine which Trident-managed storage pools should be utilized to provision volumes of a given type.
Attribute | Type | Values | Offer | Request | Supported by |
---|---|---|---|---|---|
media1 |
string |
hdd, hybrid, ssd |
Pool contains media of this type; hybrid means both |
Media type specified |
ontap-nas, ontap-nas-economy, ontap-nas-flexgroup, ontap-san, solidfire-san |
provisioningType |
string |
thin, thick |
Pool supports this provisioning method |
Provisioning method specified |
thick: all ontap; thin: all ontap & solidfire-san |
backendType |
string |
ontap-nas, ontap-nas-economy, ontap-nas-flexgroup, ontap-san, solidfire-san, gcp-cvs, azure-netapp-files, ontap-san-economy |
Pool belongs to this type of backend |
Backend specified |
All drivers |
snapshots |
bool |
true, false |
Pool supports volumes with snapshots |
Volume with snapshots enabled |
ontap-nas, ontap-san, solidfire-san, gcp-cvs |
clones |
bool |
true, false |
Pool supports cloning volumes |
Volume with clones enabled |
ontap-nas, ontap-san, solidfire-san, gcp-cvs |
encryption |
bool |
true, false |
Pool supports encrypted volumes |
Volume with encryption enabled |
ontap-nas, ontap-nas-economy, ontap-nas-flexgroups, ontap-san |
IOPS |
int |
positive integer |
Pool is capable of guaranteeing IOPS in this range |
Volume guaranteed these IOPS |
solidfire-san |
1: Not supported by ONTAP Select systems