NetApp ONTAP NFS configuration

Contributors

To enable Trident integration with the NetApp ONTAP storage system via NFS, you must create a backend that enables communication with the storage system. We configure a basic backend in this solution, but if you are looking for more customized options, visit the documentation here.

Create an SVM in ONTAP

  1. Log into ONTAP System Manager, navigate to Storage > Storage VMs, and click Add.

  2. Enter a name for the SVM, enable the NFS protocol, check the Allow NFS Client Access checkbox, and add the subnets that your worker nodes are on in the export policy rules for allowing the volumes to be mounted as PVs in your workload clusters.

    SVM Create with NFS
    Note If you are using NAT’ed deployment of user clusters or workload clusters with NSX-T, you need to add the Egress subnet (in the case of TKGS0 or the Floating IP subnet (in the case of TKGI) to the export policy rules.
  3. Provide the details for data LIFs and the details for SVM administration account, and then click Save.

    SVM Data LIFs and SVM administration
  4. Assign the aggregates to an SVM. Navigate to Storage > Storage VMs, click the ellipsis next to the newly created SVM and then click Edit. Check the Limit Volume Creation to Preferred Local Tiers checkbox and attach the required aggregates to it.

    SVM aggregate allocation
  5. In case of NAT’ed deployments of user or workload clusters on which Trident is to be installed, the storage mount request might arrive from a non-standard port due to SNAT. By default, ONTAP only allows the volume mount requests when originated from root port. Thus, log into ONTAP CLI and modify the setting to allow mount requests from non-standard ports.

    ontap-01> vserver nfs modify -vserver tanzu_svm -mount-rootonly disabled

Create backends and StorageClasses

  1. For NetApp ONTAP systems serving NFS, create a backend config file on the jumphost with the backendName, managementLIF, dataLIF, svm, username, password, and other details.

    {
        "version": 1,
        "storageDriverName": "ontap-nas",
        "backendName": "ontap-nas+10.61.181.221",
        "managementLIF": "172.21.224.201",
        "dataLIF": "10.61.181.221",
        "svm": "trident_svm",
        "username": "admin",
        "password": "password"
    }
    Note It is a best practice to define the custom backendName value as a combination of the storageDriverName and the dataLIF that is serving NFS for easy identification.
  2. Create the Trident backend by running the following command.

    [netapp-user@rhel7]$ ./tridentctl -n trident create backend -f backend-ontap-nas.json
    +-------------------------+----------------+--------------------------------------+--------+---------+
    |          NAME           | STORAGE DRIVER |                 UUID                 | STATE  | VOLUMES |
    +-------------------------+----------------+--------------------------------------+--------+---------+
    | ontap-nas+10.61.181.221 | ontap-nas      | be7a619d-c81d-445c-b80c-5c87a73c5b1e | online |       0 |
    +-------------------------+----------------+--------------------------------------+--------+---------+
  3. With the backend created, you must next create a storage class. The following sample storage class definition highlights the required and basic fields. The parameter backendType should reflect the storage driver from the newly created Trident backend.

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: ontap-nfs
    provisioner: csi.trident.netapp.io
    parameters:
      backendType: "ontap-nas"
  4. Create the storage class by running the kubectl command.

    [netapp-user@rhel7 trident-installer]$ kubectl create -f storage-class-nfs.yaml
    storageclass.storage.k8s.io/ontap-nfs created
  5. With the storage class created, you must then create the first persistent volume claim (PVC). A sample PVC definition is given below. Make sure that the storageClassName field matches the name of the storage class just created. The PVC definition can be further customized as required depending upon the workload to be provisioned.

    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: basic
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
      storageClassName: ontap-nfs
  6. Create the PVC by issuing the kubectl command. Creation can take some time depending on the size of the backing volume being created, so you can watch the process as it completes.

    [netapp-user@rhel7 trident-installer]$ kubectl create -f pvc-basic.yaml
    persistentvolumeclaim/basic created
    
    [netapp-user@rhel7 trident-installer]$ kubectl get pvc
    NAME    STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
    basic   Bound    pvc-b4370d37-0fa4-4c17-bd86-94f96c94b42d   1Gi        RWO            ontap-nfs      7s