One of the new 20.07 features that I’m interested in is ontap-san imports. For a while now, users of ONTAP clusters have been looking for a way to bring preexisting SAN volumes into their Kubernetes clusters through Trident. Importing existing data stores as Persistent Volumes (paired with a Persistent Volume Claim) was only achievable for the ONTAP NAS drivers, the Element driver and most of our cloud-based storage drivers up until now. This blog walks you through importing an ONTAP SAN volume and what that looks like.

In my environment, I have Trident 20.07 installed with the Operator. You can learn more about installing Trident with the Operator here.


tridentctl uninstall -n trident
tridentctl install -n trident

 The volume I am going to import is a FlexVol that contains a single LUN.

Importing a LUN present in a FlexVol

Importing a LUN present in a FlexVol

 

Step 1: Create a backend

The first step is to create a backend that maps to the ONTAP cluster in question.   

# cat backend-ontap-san.json
{
    "version": 1,
    "backendName": "ontap-san-backend",
    "storageDriverName": "ontap-san",
    "managementLIF": "10.193.181.75",
    "svm": "svm1",
    "username": "my-custom-username",
    "password": "*********",
    "debug": true,
    "debugTraceFlags": {"method": true, "api": true}
}
# tridentctl create b -f backend-ontap-san.json -n trident 
+-------------------+----------------+--------------------------------------+--------+---------+
|       NAME        | STORAGE DRIVER |                 UUID                 | STATE  | VOLUMES | 
+-------------------+----------------+--------------------------------------+--------+---------+ 
| ontap-san-backend | ontap-san      | 009c32ed-13eb-401c-a81e-962d6c2b6010 | online |       0 | 
+-------------------+----------------+--------------------------------------+--------+---------+ 

Step 2: Define your PVC

To import the LUN you will need a PVC definition that the LUN must be associated with. Here’s the PVC definition that I’m using:

# cat pvc-basic-import.yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-logging
  namespace: logging-app
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: ontap-san

 

  • You will need to provide the namespace the PVC must be created in. 
  • The accessMode for the PVC. For LUNs with a filesystem these PVCs will be RWO. Raw block PVCs can be imported as RWX.
  • A StorageClass which maps to the backend from step 1. 

 

There are two ways you can import:

  1. A managed import will have Trident manage the volume and handle all future operations on the volume such as snapshots/expansion.
  2. An unmanaged import (with --no-manage) would mean that Trident ignores operations on the volume and allows the storage admin to manage the volume themselves.

 

Here’s the command to import the LUN:

# tridentctl import volume ontap-san-backend appdata -f pvc-basic-import.yaml -n trident 
+------------------------------------------+--------+---------------+----------+--------------------------------------+--------+---------+
|                   NAME                   |  SIZE  | STORAGE CLASS | PROTOCOL |             BACKEND UUID             | STATE  | MANAGED |
+------------------------------------------+--------+---------------+----------+--------------------------------------+--------+---------+ 
| pvc-c8c205e9-3391-47ec-89e2-ba99feea1f6b | 50 MiB | ontap-san     | block    | 009c32ed-13eb-401c-a81e-962d6c2b6010 | online | true    |
+------------------------------------------+--------+---------------+----------+--------------------------------------+--------+---------+ 

 

The arguments for the tridentctl import call include: 

  • the name of the backend (from step 1, it’s ontap-san-backend
  • the name of the FlexVol on the cluster (appdata)
  • the file with the PVC definition (from step 2, its basic-pvc-import.yaml) 

 

Now that the volume is imported, Trident updates the name of the FlexVol (now of the storagePrefix_pvc_<uuid> format).

 

The LUN also reflects this. The LUN is now renamed to lun0

Trident renames the LUN

Trident renames the LUN to lun0

 

Considerations

  1. If you have a FlexVol with multiple LUNs and need to import a particular LUN, you should create a clone of your FlexVol with only the desired LUN in it.
  2. When sharing the LUN across environments, you should clone your FlexVol + LUN before importing it. On importing, Trident will update the FlexVol and LUN names. By doing it this way the connections to the LUNs are isolated and existing connections won’t be impacted.
  3. If you try importing a FlexVol with multiple LUNs, Trident will gracefully error out saying it’s found more than one LUN.

 

Questions and Comments?

Follow us on our Slack channel!

Bala RameshBabu
Bala is a Technical Marketing Engineer who focuses on Trident, NetApp's dynamic storage provisioner for Kubernetes and Docker. With a background in OpenStack, he focuses on open-source solutions and DevOps workflows. When not at work, you can find him in a soccer field or reading biographies

Pin It on Pinterest