Skip to main content
NetApp Solutions

Example Kubernetes StorageClasses for NetApp AIPod Deployments

Contributors kevin-hoke mboglesby

Before you can use Trident to dynamically provision storage resources within your Kubernetes cluster, you must create one or more Kubernetes StorageClasses. The examples that follow represent different types of StorageClasses that you might want to create if you are deploying components of this solution on a NetApp AIPod. For more information about StorageClasses, and for example StorageClasses for other platforms/environments, see the Trident documentation.

  1. NetApp recommends creating a StorageClass for the FlexGroup-enabled Trident Backend that you created in the section Example Trident Backends for NetApp AIPod Deployments, step 1. The example commands that follow show the creation of multiple StorageClasses that corresponds to the two example Backend that was created in the section Example Trident Backends for NetApp AIPod Deployments, step 1 - one that utilizes NFS over RDMA and one that does not.

    So that a persistent volume isn’t deleted when the corresponding PersistentVolumeClaim (PVC) is deleted, the following example uses a reclaimPolicy value of Retain. For more information about the reclaimPolicy field, see the official Kubernetes documentation.

    Note: The following example StorageClasses use a maximum transfer size of 262144. To use this maximum transfer size, you must configure the maximum transfer size on your ONTAP system accordingly. Refer to the ONTAP documentation for details.

    Note: To use NFS over RDMA, you must configure NFS over RDMA on your ONTAP system. Refer to the ONTAP documentation for details.

    Note: In the following example, a specific Backend is not specified in the storagePool field in StorageClass definition file.

    $ cat << EOF > ./storage-class-aipod-flexgroups-retain.yaml
    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: aipod-flexgroups-retain
    provisioner: csi.trident.netapp.io
    mountOptions: ["vers=4.1", "nconnect=16", "rsize=262144", "wsize=262144"]
    parameters:
      backendType: "ontap-nas-flexgroup"
      storagePools: "aipod-flexgroups-iface1:.*"
    reclaimPolicy: Retain
    EOF
    $ kubectl create -f ./storage-class-aipod-flexgroups-retain.yaml
    storageclass.storage.k8s.io/aipod-flexgroups-retain created
    $ cat << EOF > ./storage-class-aipod-flexgroups-retain-rdma.yaml
    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: aipod-flexgroups-retain-rdma
    provisioner: csi.trident.netapp.io
    mountOptions: ["vers=4.1", "proto=rdma", "max_connect=16", "rsize=262144", "wsize=262144"]
    parameters:
      backendType: "ontap-nas-flexgroup"
      storagePools: "aipod-flexgroups-iface1:.*"
    reclaimPolicy: Retain
    EOF
    $ kubectl create -f ./storage-class-aipod-flexgroups-retain-rdma.yaml
    storageclass.storage.k8s.io/aipod-flexgroups-retain-rdma created
    $ kubectl get storageclass
    NAME                             PROVISIONER             AGE
    aipod-flexgroups-retain          csi.trident.netapp.io   0m
    aipod-flexgroups-retain-rdma     csi.trident.netapp.io   0m
  2. NetApp also recommends creating a StorageClass that corresponds to the FlexVol-enabled Trident Backend that you created in the section Example Trident Backends for AIPod Deployments, step 2. The example commands that follow show the creation of a single StorageClass for FlexVol volumes.

    Note: In the following example, a particular Backend is not specified in the storagePool field in StorageClass definition file. When you use Kubernetes to administer volumes using this StorageClass, Trident attempts to use any available backend that uses the ontap-nas driver.

    $ cat << EOF > ./storage-class-aipod-flexvols-retain.yaml
    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: aipod-flexvols-retain
    provisioner: netapp.io/trident
    parameters:
      backendType: "ontap-nas"
    reclaimPolicy: Retain
    EOF
    $ kubectl create -f ./storage-class-aipod-flexvols-retain.yaml
    storageclass.storage.k8s.io/aipod-flexvols-retain created
    $ kubectl get storageclass
    NAME                             PROVISIONER             AGE
    aipod-flexgroups-retain          csi.trident.netapp.io   0m
    aipod-flexgroups-retain-rdma     csi.trident.netapp.io   0m
    aipod-flexvols-retain            csi.trident.netapp.io   0m