Import an Existing Volume
Contributors
Download PDF of this page
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 the same volume, named pb_fg_all,
twice, once for each Trident Backend that was created in the example in the section Trident Deployment and Configuration, step 1. Importing the same volume twice in this manner enables you to mount the volume (an existing FlexGroup volume) multiple times across different LIFs, as described in the section Trident Deployment and Configuration, step 1. 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. This value means that multiple pods can mount these volumes at the same time and that access is read-only. For more information about the accessMode
field, see the official Kubernetes documentation.
The Backend names that are specified in the following example import commands are highlighted for reference. These names correspond to the Backends that were created in the example in the section Trident Deployment and Configuration, step 1.The StorageClass names that are specified in the following example PVC definition files are highlighted for reference. These names correspond to the StorageClasses that were created in the example in the section Trident Deployment and Configuration, step 1. |
$ 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 | +--------------------------------+--------+-----------------------------------+----------+--------------------------------------------+--------+---------+ $ cat << EOF > ./pvc-import-pb_fg_all-iface2.yaml kind: PersistentVolumeClaim apiVersion: v1 metadata: name: pb-fg-all-iface2 namespace: default spec: accessModes: - ReadOnlyMany storageClassName: ontap-ai-flexgroups-retain-iface2 EOF $ tridentctl import volume ontap-ai-flexgroups-iface2 pb_fg_all -f ./pvc-import-pb_fg_all-iface2.yaml -n trident +--------------------------------+--------+-----------------------------------+----------+--------------------------------------------+--------+---------+ | NAME | SIZE | STORAGE CLASS | PROTOCOL | BACKEND UUID | STATE | MANAGED | +--------------------------------+--------+-----------------------------------+----------+------------------------------------------+--------+---------+ | default-pb-fg-all-iface2-85aee | 10 TiB | ontap-ai-flexgroups-retain-iface2 | file | 61814d48-c770-436b-9cb4-cf7ee661274d | 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 | | default-pb-fg-all-iface2-85aee | 10 TiB | ontap-ai-flexgroups-retain-iface2 | file | 61814d48-c770-436b-9cb4-cf7ee661274d | 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 pb-fg-all-iface2 Bound default-pb-fg-all-iface2-85aee 10995116277760 ROX ontap-ai-flexgroups-retain-iface2 25h