Example Trident Operations
This section includes examples of various operations that you may want to perform with Trident.
Import an Existing Volume
If there are existing volumes on your NetApp storage system/platform that you want to mount on containers within your Kubernetes cluster, but that are not tied to PVCs in the cluster, then you must import these volumes. You can use the Trident volume import functionality to import these volumes.
The example commands that follow show the importing of a volume named pb_fg_all
. For more information about PVCs, see the official Kubernetes documentation. For more information about the volume import functionality, see the Trident documentation.
An accessModes
value of ReadOnlyMany
is specified in the example PVC spec files. For more information about the accessMode
field, see the official Kubernetes documentation.
$ cat << EOF > ./pvc-import-pb_fg_all-iface1.yaml kind: PersistentVolumeClaim apiVersion: v1 metadata: name: pb-fg-all-iface1 namespace: default spec: accessModes: - ReadOnlyMany storageClassName: ontap-ai-flexgroups-retain-iface1 EOF $ tridentctl import volume ontap-ai-flexgroups-iface1 pb_fg_all -f ./pvc-import-pb_fg_all-iface1.yaml -n trident +--------------------------------+--------+-----------------------------------+----------+--------------------------------------------+--------+---------+ | NAME | SIZE | STORAGE CLASS | PROTOCOL | BACKEND UUID | STATE | MANAGED | +--------------------------------+--------+-----------------------------------+----------+------------------------------------------+--------+---------+ | default-pb-fg-all-iface1-7d9f1 | 10 TiB | ontap-ai-flexgroups-retain-iface1 | file | b74cbddb-e0b8-40b7-b263-b6da6dec0bdd | online | true | +--------------------------------+--------+-----------------------------------+----------+--------------------------------------------+--------+---------+ $ tridentctl get volume -n trident +----------------------------------+---------+-----------------------------------+----------+--------------------------------------+--------+---------+ | NAME | SIZE | STORAGE CLASS | PROTOCOL | BACKEND UUID | STATE | MANAGED | +----------------------------------+---------+-----------------------------------+----------+--------------------------------------+--------+---------+ | default-pb-fg-all-iface1-7d9f1 | 10 TiB | ontap-ai-flexgroups-retain-iface1 | file | b74cbddb-e0b8-40b7-b263-b6da6dec0bdd | online | true | +----------------------------------+---------+-----------------------------------+----------+--------------------------------------+--------+---------+ $ kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE pb-fg-all-iface1 Bound default-pb-fg-all-iface1-7d9f1 10995116277760 ROX ontap-ai-flexgroups-retain-iface1 25h
Provision a New Volume
You can use Trident to provision a new volume on your NetApp storage system or platform.
Provision a New Volume Using kubectl
The following example commands show the provisioning of a new FlexVol volume using kubectl.
An accessModes
value of ReadWriteMany
is specified in the following example PVC definition file. For more information about the accessMode
field, see the official Kubernetes documentation.
$ cat << EOF > ./pvc-tensorflow-results.yaml kind: PersistentVolumeClaim apiVersion: v1 metadata: name: tensorflow-results spec: accessModes: - ReadWriteMany resources: requests: storage: 1Gi storageClassName: ontap-ai-flexvols-retain EOF $ kubectl create -f ./pvc-tensorflow-results.yaml persistentvolumeclaim/tensorflow-results created $ kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE pb-fg-all-iface1 Bound default-pb-fg-all-iface1-7d9f1 10995116277760 ROX ontap-ai-flexgroups-retain-iface1 26h tensorflow-results Bound default-tensorflow-results-2fd60 1073741824 RWX ontap-ai-flexvols-retain 25h
Provision a New Volume Using the NetApp DataOps Toolkit
You can also use the NetApp DataOps Toolkit for Kubernetes to provision a new volume on your NetApp storage system or platform. The NetApp DataOps Toolkit for Kubernetes utilizes Trident to provision volumes but simplifies the process for the user. Refer to the documentation for details.