Available in VPC
If you add files to a running container, all files are deleted when the process is terminated or the container is restarted due to a failed Kubernetes Liveness Probe check. You can use NAS volumes so that newly added files are retained even after the process ends or the container restarts.
You can create and attach a PersistentVolumeClaim (PVC) when deploying a container that uses a NAS volume.
NAVER Cloud Platform's Ncloud Kubernetes Service provides the Container Storage Interface (CSI) as its volume driver. This driver integrates with Kubernetes and supports tasks such as NAS volume creation, deletion, and resizing.
Supported versions and capacity
This section describes supported versions and capacity.
Supported versions
The following are the NAS CSI versions provided by NAVER Cloud Platform and the compatible Kubernetes versions:
| Ncloud NAS CSI Driver\Kubernetes Version | 1.18 | 1.19 | 1.20 | 1.21 | 1.22 | 1.23+ |
|---|---|---|---|---|---|---|
| v1.0.x | Supported | Supported | Supported | Supported | Supported | Supported |
| v2.0.x | Not supported | Not supported | Not supported | Not supported | Supported | Supported |
| v2.1.x | Not supported | Not supported | Not supported | Not supported | Supported | Supported |
| v2.2.x | Not supported | Not supported | Not supported | Not supported | Supported | Supported |
The following storage services are supported by the Kubernetes version:
| Service\Kubernetes Version | 1.18+ | 1.22+ |
|---|---|---|
| Create volume | Supported | Supported |
| Delete volume | Supported | Supported |
| Expand volume (resize) | Supported | Supported |
| Attach volume to server | Supported | Supported |
| Detach volume from server | Supported | Supported |
| Create snapshot | Not supported | Not supported |
| Delete snapshot | Not supported | Not supported |
| Create subdirectory | Not supported | Supported |
Assignable capacity
You can allocate capacity to Kubernetes NAS volumes in units of 100 GB using CSI. If you do not specify the volume size, a NAS volume is created with the default size of 500 GB. The minimum and maximum allocatable capacity are as follows:
- Minimum: 500 GB
- Maximum: 10,000 GB
Install the NAS CSI driver (for existing clusters without it installed)
The NAS CSI driver is deployed by default when Kubernetes is installed. This section describes how to install NAS CSI on an existing cluster where it is not installed. If NAS CSI is already installed, you do not need to perform the following tasks.
Deploy the NAS CSI driver
The following files refer to the latest stable version. If a problem occurs during installation, run the kubectl apply -f command again to apply any 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.2.0/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.2.0/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.2.0/nas-csi.yaml
NAS CSI driver details
StorageClass
StorageClass is an object that defines the policy and type of each storage. NAVER Cloud Platform provides a StorageClass that uses NAS volumes.
To check the StorageClass object for NAS volumes, check the object named nks-nas-csi. It is displayed as follows:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: nks-nas-csi
mountOptions:
- hard
- nolock
- nfsvers=3
parameters:
csi.storage.k8s.io/provisioner-secret-name: mount-options
csi.storage.k8s.io/provisioner-secret-namespace: kube-system
provisioner: nas.csi.ncloud.com
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
volumeBindingMode: Configures when volume binding and dynamic provisioning are performed. The default value is "Immediate."
| Mode | Description |
|---|---|
Immediate |
Performed when a PVC is created. |
WaitForFirstConsumer |
Performed when a Pod is created. |
reclaimPolicy: Configures the policy for reusing or deleting a PersistentVolume when the PVC is deleted. The default value is "Delete."
| Policy | Description |
|---|---|
Retain |
When a PVC is deleted, the bound PV is retained in a reusable state, and the data in the NAS volume is preserved. |
Delete |
When a PVC is deleted, the bound PV is deleted, and the NAS volume is returned. |
allowVolumeExpansion: You can enable expansion of a PersistentVolumeClaim by setting this value to "true."
A NAS volume retained using the Retain policy can be returned through the NAVER Cloud Platform console or API.
parameters.subDir: You can create subdirectories within a single NAS volume and configure the subdirectory path under the NFS share path so that multiple PVCs can share the same NAS volume. If not specified, a subdirectory is created using the PV name.[NAS CSI v2.2.0+]
When you use the following patterns in the parameters.subDir value, they are automatically replaced with PVC/PV metadata:
| Pattern | Replacement value |
|---|---|
${pvc.metadata.name} |
PVC name |
${pvc.metadata.namespace} |
PVC namespace |
${pv.metadata.name} |
PV name |
The # character cannot be used in the parameters.subDir value.
parameters.deleteOnlySubdir: Configures whether only the subdirectory is deleted when the PVC is deleted. The default value is false.[NAS CSI v2.2.0+]
parameters.deleteOnlySubdir is valid only when reclaimPolicy is set to Delete.
To keep both the NAS volume and its subdirectory, set the reclaimPolicy for the StorageClass to Retain.
Change the default StorageClass
To change the default StorageClass of a created StorageClass object, see Changing the default StorageClass.
CSI Controller
The CSI controller is an interface responsible for operations such as volume creation, deletion, attachment, detachment, and snapshot management.
To check the NAS CSI controller, run the following command to view the relevant Pods in the kube-system namespace:
$ kubectl --kubeconfig $KUBE_CONFIG get pods -n kube-system -l app=nks-nas-csi-controller
CSI Node
A CSI node runs on each Kubernetes worker node and is responsible for operations such as volume formatting, mounting, and unmounting.
To check the NAS CSI node, run the following command to view the relevant Pods in the kube-system namespace:
$ kubectl --kubeconfig $KUBE_CONFIG get pods -n kube-system -l app=nks-nas-csi-node
Use the NAS CSI driver
For detailed examples of using the NAS CSI driver, see NAS volume CSI examples.