NAS volume CSI
    • PDF

    NAS volume CSI

    • PDF

    Article Summary

    The latest service changes have not yet been reflected in this content. We will update the content as soon as possible. Please refer to the Korean version for information on the latest updates.

    Available in VPC

    If files are added to a running container, then all files are deleted when the process is terminated or the container is restarted due to a failed health check of Kubernetes Liveness Probe. You can use the NAS volume for such cases and adjust the settings so that the added files will be kept, even after the process is terminated or the container is restarted.

    You can create a PersistentVolumeClaim (PVC) and add it when you deploy the NAS volume container.

    NAVER Cloud Platform's Ncloud Kubernetes Service provides Container Storage Interface (CSI) as a volume driver. This driver is connected with Kubernetes and supports tasks such as NAS volume creation, deletion, resizing, etc.

    Supported versions and capacity

    It describes supported versions and capacity information.

    Supported versions

    NAVER Cloud Platform supports the following versions of NAS CSI and Kubernetes compatible with it.

    Ncloud NAS CSI Driver\Kubernetes Version1.181.191.201.211.221.23
    v1.0.xSupportedSupportedSupportedSupportedSupportedSupported
    v2.0.xNot supportedNot supportedNot supportedNot supportedSupportedSupported

    This Kubernetes version supports the following storage services:

    Service\Kubernetes Version1.18+
    Create volumeSupported
    Delete volumeSupported
    Expand volume (resize)Supported
    Assign volume to serverSupported
    Remove volume from serverSupported
    Create snapshotNot supported
    Delete snapshotNot supported

    Assignable capacity

    You can assign capacity in the units of 100 GB to Kubernetes NAS volume through CSI. If the volume size is not defined separately, then a NAS volume of 500 GB will be created by default. The minimum and maximum capacity assignable is as follows:

    • Minimum: 500 GB
    • Maximum: 10,000 GB

    NAS CSI driver installation (for existing clusters not installed yet)

    NAS CSI driver is deployed when installing Kubernetes. This clause describes how to install NAS CSI in the existing cluster not installed yet. If the NAS CSI is already installed, you don’t need to do the following action.

    Deploy NAS CSI Deploy

    The following files indicates the latest stable version. If a problem occurs during the installation, run the kubectl apply -f command again to reflect the missing resources.

    • Korea Region
    # kubernetes version >= 1.22
    $ kubectl --kubeconfig=$KUBE_CONFIG apply -f https://kr.object.ncloudstorage.com/nks-download/nas-csi/pub/kr/v2.0.1/nas-csi.yaml
    
    # kubernetes version < 1.22
    $ kubectl --kubeconfig=$KUBE_CONFIG apply -f https://kr.object.ncloudstorage.com/nks-download/nas-csi/pub/kr/v1.0.2/nas-csi.yaml
    
    • Singapore region
    # kubernetes version >= 1.22
    $ kubectl --kubeconfig=$KUBE_CONFIG apply -f https://kr.object.ncloudstorage.com/nks-download/nas-csi/pub/sgn/v2.0.1/nas-csi.yaml
    
    # kubernetes version < 1.22
    $ kubectl --kubeconfig=$KUBE_CONFIG apply -f https://kr.object.ncloudstorage.com/nks-download/nas-csi/pub/sgn/v1.0.2/nas-csi.yaml
    
    • Japan region
    # kubernetes version >= 1.22
    $ kubectl --kubeconfig=$KUBE_CONFIG apply -f https://kr.object.ncloudstorage.com/nks-download/nas-csi/pub/jpn/v2.0.1/nas-csi.yaml
    

    NAS CSI driver details

    StorageClass

    StorageClass is an object that specifies each storage's policy and type. NAVER Cloud Platform provides StorageClass which uses NAS volume.
    To check the StorageClass object of NAS volume, check the object with the name of NKS-NAS-CSI. It will be shown as below.

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: nks-nas-csi
    mountOptions:
    - hard
    - nolock
    - nfsvers=3
    provisioner: nas.csi.ncloud.com
    reclaimPolicy: Delete
    volumeBindingMode: WaitForFirstConsumer
    allowVolumeExpansion: true
    
    • volumeBindingMode: the point of action for volume binding and dynamic provisioning can be set. The default is Immediate.
    ModeDescription
    ImmediateAct at the point when PVC is created
    WaitForFirstConsumerAct at the point when a pod is created
    • reclaimPolicy: you can set the policy so that the PersistentVolume in use is secured again or deleted when PVC is deleted at the end of its use. The default is Delete.
    PolicyDescription
    RetainWhen a PVC is deleted, the PV in use is changed to the status where it can be reused. NAS volume's internal data is maintained.
    DeleteWhen a PVC is deleted, the PV in use is deleted with it and the NAS volume is terminated.
    • allowVolumeExpansion: PersistentVolumeClaim can be extended by setting this value to true.
    Note

    The NAS volume secured again with the Retain policy can be returned through the NAVER Cloud Platform console or API.

    Change default storage class

    To change the default storage class content of a created StorageClass object, Changing the default StorageClass.

    CSI Controller

    CSI controller is an interface that takes charge of various controls and management of a volume such as creation, deletion, assignment, removal from assignment, snapshot, etc.

    To check the NAS CSI controller, use the command shown below to check the deployment object in the kube-system namespace.

    $ kubectl --kubeconfig $KUBE_CONFIG get deployment -n kube-system
    

    CSI Node

    CSI node is a node corresponding to each of Kubernetes worker nodes. It's in charge of actions such as volume format, mounting, unmounting, etc.

    To check NAS CSI node, use the command shown below to check the DaemonSet resource in the kube-system namespace.

    $ kubectl --kubeconfig $KUBE_CONFIG get daemonset -n kube-system
    

    Use CSI driver

    Add NAS volume

    To add NAS volume through NAS CSI driver, request PersistentVolumeClaim (PVC) through the following yaml code. NAS CSI driver checks the PVC and automatically generates the necessary PersistentVolume (PV).

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: nas-csi-pvc
    spec:
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 500Gi
      storageClassName: nks-nas-csi
    
    • AccessMode: NAS CSI supports various access modes.
    ModeDescription
    ReadWriteOnceMounts volume as read-write on a single nod
    ReadOnlyManyMounts volume as read only on multiple nodes
    ReadWriteManyMounts volume as read-write on multiple nodes
    • Resources: size of the storage to be created. The default value is 500 GB, and Gi can be used to enter a value between 500 GB to 10,000 GB in the units of 100 GB.

    Assign a new volume to a pod

    Use the following yaml code to create a new NAS volume and mount it.

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: nas-csi-pvc
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 500Gi
      storageClassName: nks-nas-csi
    ---
    kind: Pod
    apiVersion: v1
    metadata:
      name: my-csi-app
    spec:
      containers:
        - name: my-frontend
          image: busybox
          volumeMounts:
          - mountPath: "/data"
            name: my-volume
          command: [ "sleep", "1000000" ]
      volumes:
        - name: my-volume
          persistentVolumeClaim:
            claimName: nas-csi-pvc
    
    • Pod
      • spec.container: enter the storage name to be mounted to volumeMounts, and enter the mounting path to mountPath.
      • spec.volumes: enter the name of PersistentVolumeClaim to persistentVolumeClaim.claimName to define the storage to be mounted to the container.
    Caution

    If you delete a cluster while an NAS volume is mounted on a pod, the NAS volume will not be deleted automatically. In such cases, it needs to be terminated through NAVER Cloud Platform console or API.

    Mount an already created NAS volume to a pod

    NAS creates a volume with NFS protocol.

    Once a NAS volume is created, check the IP address and path information in the mount information.

    Use the yaml code shown below to create a StorageClass using the already created NAS volume and mount it to a pod.

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: static-nks-nas-csi
    provisioner: nas.csi.ncloud.com
    parameters:
      server: __NAS_IP__
      share: __NAS_PATH__
    reclaimPolicy: Retain
    volumeBindingMode: WaitForFirstConsumer
    mountOptions:
      - hard
      - nolock
      - nfsvers=3
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: static-pvc
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 500Gi
      storageClassName: static-nks-nas-csi
    ---
    kind: Pod
    apiVersion: v1
    metadata:
      name: my-csi-app
    spec:
      containers:
        - name: my-frontend
          image: busybox
          volumeMounts:
          - mountPath: "/data"
            name: my-volume
          command: [ "sleep", "1000000" ]
      volumes:
        - name: my-volume
          persistentVolumeClaim:
            claimName: static-pvc
    
    • kind: StorageClass
      Enter the information to use an existing NAS volume in Kubernetes cluster.
      • provisioner: enter nas.csi.ncloud.com, the Provisioner of the NAS volume of the NAVER Cloud platform.
      • parameters.server: enter the IP of the already created NAS volume mount information.
      • parameters.path: enter the path of the already created NAS volume mount information.
      • reclaimPolicy: you must set it to Retain to prevent the NAS volume from being deleted when a PVC that has been used is deleted.
    • kind: PersistentVolumeClaim
      Create PersistentVolumeClaim to bind with the created PersistentVolume.
      • resources.storage: this is a required field. Enter the size of the NAS volume previously created. However, the PVC size is dependent to the NAS volume size, so the entered value is meaningless.
      • storageClassname: enter static-nks-nas-csi, which is the name of the NAS storage class.
      • volumeName: enter the name of the created PersistentVolume.
    • kind: Pod
      Specify PersistentVolumeClaim which is a volume request to mount the volume to use.
      • volumes.persistentVolumeClaim.claimName: enter a name for the PersistentVolumeClaim to specify.

    Remove PersistentVolumeClaim

    Kubernetes’ PersistentVolumeClaim is not deleted, even when the request resources are deleted such as Deployment, StatefulSet, ReplicaSet, Pod, etc. A separate command is required to delete it.

    Use the following commands separately to check PersistentVolumeClaim and to remove it.

    • View PVC
    $ kubectl --kubeconfig $KUBE_CONFIG get pvc
    
    • Delete PVC
    $ kubectl --kubeconfig $KUBE_CONFIG delete pvc static-pvc
    
    Caution

    In the case of NAS volumes with return protection, PersistentVolumeClaim is deleted, but the actual volume is maintained. You can delete the actual NAS volume on the NAS console.

    Resize volume

    NAVER Cloud Platform's NAS volume provides the resizing feature for the already created volumes.

    The following describes how to resize a NAS volume. The example below uses a NAS volume of 500 GB in size.

    1. Use the yaml code shown below to create a new block storage volume of 500 GB.
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: csi-deployment-pvc
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 500Gi
      storageClassName: nks-nas-csi
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: my-csi-app
    spec:
      selector:
        matchLabels:
          app: my-csi-app
      replicas: 1
      template:
        metadata:
          labels:
            app: my-csi-app
        spec:
          containers:
            - name: my-frontend
              image: busybox
              volumeMounts:
              - mountPath: "/data"
                name: my-volume
              command: [ "sleep", "1000000" ]
          volumes:
            - name: my-volume
              persistentVolumeClaim:
                claimName: csi-deployment-pvc
    
    1. Run the command shown below to adjust PersistentVolumeClaim's volume request size from 500 GB to 600 GB.
    kubectl --kubeconfig $KUBE_CONFIG patch pvc csi-deployment-pvc -p '{"spec":{"resources":{"requests":{"storage":"600Gi"}}}}'
    

    Use StorageClass with the Zone Number Specified

    Caution

    StorageClass with the zone number specified is available for NAS CSI version 2.0.1 or higher.

    The NAS CSI driver creates an NAS volume in the same zone as Kubernetes. However, you can create a NAS volume in a specific zone in the same region by specifying zoneNo in StorageClass. You can create an NAS volume by specifying ZoneNo through the yami code, which is used as an example below.

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: nks-nas-csi-kr-2
    mountOptions:
    - hard
    - nolock
    - nfsvers=3
    provisioner: nas.csi.ncloud.com
    parameters:
      zoneNo: "3"
    reclaimPolicy: Delete
    volumeBindingMode: WaitForFirstConsumer
    allowVolumeExpansion: true
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: nas-csi-pvc
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 500Gi
      storageClassName: nks-nas-csi-kr-2
    ---
    kind: Pod
    apiVersion: v1
    metadata:
      name: my-csi-app
    spec:
      containers:
        - name: my-frontend
          image: busybox
          volumeMounts:
          - mountPath: "/data"
            name: my-volume
          command: [ "sleep", "1000000" ]
      volumes:
        - name: my-volume
          persistentVolumeClaim:
            claimName: nas-csi-pvc
    
    • kind: StorageClass
      • parameters.zoneNo: enter ZoneNo for creating an NAS volume.

        RegionZoneZoneNo
        KoreaKR-12
        KoreaKR-23
        SingaporeSGN-474
        SingaporeSGN-575
        JapanJPN-484
        JapanJPN-585

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.