With dynamic provisioning for File Storage NAS, you can automatically provision storage for workloads on demand, eliminating the need to create PVs in advance. This feature provides data persistence and sharing, allowing multiple Pods to read and write simultaneously, and simplifies storage management for use cases like web applications and log retention.
How it works
With dynamic volumes, when an application creates a PVC, the system automatically creates a new storage volume and a corresponding PV on demand. This provisioning is determined by the StorageClass specified in the PVC. This mode offers greater flexibility and supports automatic storage volume expansion.
Mount mode
You can specify the mount mode with the volumeAs parameter in a StorageClass. This parameter defines the relationship between a PV and the NAS file system.
|
Mount mode |
Description |
Scenario |
|
In subpath mode, each PV is mapped to a unique subdirectory within a NAS file system. This mode facilitates data isolation. |
|
|
|
In sharepath mode, all PVs map to the same NAS directory defined in the StorageClass. Therefore, all PVCs using this StorageClass access the same shared directory. |
Multiple Pods across different namespaces need to mount the same NAS subdirectory. |
|
|
filesystem (Not recommended) |
In file system mode, a new, dedicated NAS file system instance is dynamically created for each PV. |
This mode is suitable for applications that require strict isolation in terms of performance and security. It enables the dynamic creation and deletion of independent NAS file systems and mount targets for each application, but incurs higher costs. |
Workflow
The workflow for mounting a NAS dynamic volume is as follows.
|
|
|
Prerequisites
-
The csi-plugin and csi-provisioner components are installed.
CSI components are installed by default. Verify that they remain installed. You can check the installation status on the page. We recommend upgrading the CSI components to the latest version.
-
To use subpath and sharepath, you need an Apsara File Storage NAS file system that meets the following requirements. Otherwise, create a file system.
NAS has limitations on mount connectivity, the number of file systems, and protocol types.
-
Protocol: Only NFS is supported.
-
VPC: The Apsara File Storage NAS file system must be in the same VPC as your cluster. Apsara File Storage NAS supports cross-zone mounting but not cross-VPC mounting.
-
Mount Target: Add a mount target that is in the same VPC as your cluster and is active. For more information, see Manage mount targets. Note the mount target address.
-
(Optional) Encryption Type: To encrypt data in a volume, configure the encryption type when you create the Apsara File Storage NAS file system.
-
Usage notes
-
Do not delete mount targets: To prevent node I/O errors, do not delete a mount target in the NAS console while its corresponding volume is in use.
-
Concurrent writes: NAS provides shared storage. When multiple Pods mount the same volume, your application must handle potential data consistency issues from concurrent writes.
For more information about limitations on concurrent writes to NAS, see Multiple processes writing to the same log file and Latency in reading updated file content across ECS instances.
-
Mount performance: If you configure the
securityContext.fsgroupparameter in your application, kubelet recursively runschmodorchownafter the volume is mounted, significantly increasing Pod startup time.To optimize mount performance, see NAS volume FAQ.
Method 1: Mount a volume using subpath
In this method, the CSI provisioner automatically creates a dedicated subpath in the NAS file system for each PersistentVolumeClaim (PVC). This subpath functions as the PersistentVolume (PV).
-
The version of the CSI plug-in must be 1.31.4 or later. To upgrade the plug-in, see Upgrade the CSI plug-in.
-
You have created a NAS file system and have its mount target.
1. Create a StorageClass
A StorageClass acts as a template for provisioning dynamic volumes and defines the source and behavior of the storage resources.
kubectl
-
Create a file named
alicloud-nas-subpath.yamlwith the following content:apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: # The name of the StorageClass, which must be unique within the cluster. name: alicloud-nas-subpath mountOptions: - nolock,tcp,noresvport - vers=3 parameters: # Set to subpath. volumeAs: subpath # The format of the server field is <nas-server-address>:/<path>. server: "0cd8b4a576-g****.cn-hangzhou.nas.aliyuncs.com:/k8s" archiveOnDelete: "true" provisioner: nasplugin.csi.alibabacloud.com reclaimPolicy: Retain allowVolumeExpansion: trueParameter
Description
mountOptionsThe mount options for NAS, including the NFS protocol version. By default, volumes are mounted using NFSv3. You can specify a different version with an option such as
vers=4.0. For information about the NFS protocols supported by different NAS types, see NFS protocols.parameters.volumeAsThe volume provisioning mode. Set to
subpath.parameters.serverThe NAS mount target and the subpath to mount, in the format
<nas-server-address>:/<path>.-
<nas-server-address>: The mount target of the NAS file system. For more information, see Manage mount targets. -
:/<path>: The NAS subpath to mount. If this parameter is not set or the specified subpath does not exist, the root directory is mounted by default.-
General-purpose NAS: The root directory is
/. -
Extreme NAS: The root directory is
/share. When you mount a subpath, thepathmust start with/share, such as/share/data.
-
parameters.archiveOnDeleteSpecifies whether to delete the data on the backend storage when a PVC is deleted and its
reclaimPolicyis set toDelete.This option acts as a safeguard to prevent accidental data loss on shared NAS storage.
-
true(default): The directory and its files are not deleted. Instead, they are archived and renamed in the formatarchived-{pvName}.{timestamp}. -
false: The corresponding directory and its data are permanently deleted.This operation deletes the NAS subpath and its files, not the NAS file system itself.
To delete a NAS file system, see Delete a file system.
In scenarios where PVs are frequently created and deleted, setting this parameter to
falsemay cause the CSI controller's task queue to become blocked, which prevents new PVs from being created. For more information, see The controller's task queue is full and new PVs cannot be created when you use a dynamic NAS volume.provisionerThe driver. Set this parameter to
nasplugin.csi.alibabacloud.comwhen you use the Alibaba Cloud NAS CSI plug-in.reclaimPolicyThe reclaim policy of the PV.
-
Delete(default): When the PVC is deleted, the backend storage data is processed based on thearchiveOnDeletesetting. -
Retain: When the PVC is deleted, the PV and the data in the NAS file system are not deleted and must be deleted manually. This policy is recommended for scenarios that require high data security to prevent accidental data loss.
allowVolumeExpansionSupported only by General-purpose NAS.
Allows dynamic expansion of PVs created by this StorageClass by modifying the PVC capacity.
This StorageClass uses the NAS directory quota feature to manage PV capacity, enabling precise size control. You can expand the volume online by editing the
spec.resources.requests.storagefield of the PVC. For more information, see Set directory quotas for dynamic NAS volumes.NAS directory quotas take effect asynchronously. If you perform high-speed, large-volume data writes immediately after a PV is created or expanded, you may exceed the specified capacity because the quota is not yet fully enforced. For more information, see Usage limits.
-
-
Create the StorageClass.
kubectl create -f alicloud-nas-subpath.yaml
Console
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
-
Click Create, specify a unique name for the StorageClass within the cluster, select NAS as the PV Type, and then follow the on-screen instructions to create the StorageClass.
The key parameters are described in the following table.
Parameter
Description
Select Mount Target
The mount target of the NAS file system.
Volume Mode
The volume provisioning mode. Select Subdirectory. A subpath is automatically created under the specified mount path. Data is stored at
<NAS mount target>:<mount path>/<pv-name>/.Mount Path
The NAS subdirectory to mount. If this parameter is not specified, the root directory is mounted by default.
If the directory does not exist in the NAS file system, it is automatically created and then mounted.
-
General-purpose NAS: The root directory is
/. -
Extreme NAS: The root directory is
/share. When you mount a subdirectory, thepathmust start with/share, such as/share/data.
Reclaim Policy
The reclaim policy of the PV.
-
Delete(default): When the PVC is deleted, the backend storage data is processed based on thearchiveOnDeletesetting. -
Retain: When the PVC is deleted, the PV and the data in the NAS file system are not deleted and must be deleted manually. This policy is recommended for scenarios that require high data security to prevent accidental data loss.
Mount Options
The mount options for NAS, including the NFS protocol version. By default, volumes are mounted using NFSv3. You can specify a different version with an option such as
vers=4.0. For information about the NFS protocols supported by different NAS types, see NFS protocols.After the StorageClass is created, you can view it in the StorageClasses list.
-
2. Create a PVC
A PersistentVolumeClaim (PVC) is an application's request for storage that triggers an associated StorageClass to dynamically provision and bind a matching PersistentVolume (PV).
kubectl
-
Create a file named
nas-pvc.yamlwith the following content:kind: PersistentVolumeClaim apiVersion: v1 metadata: name: nas-csi-pvc spec: accessModes: - ReadWriteMany # Specify the StorageClass to use. storageClassName: alicloud-nas-subpath resources: requests: # Declare the required capacity of the storage volume. storage: 20GiParameter
Description
accessModesThe access mode. Valid values:
-
ReadWriteMany(default): The volume can be mounted as read-write by many nodes. -
ReadWriteOnce: The volume can be mounted as read-write by a single node. -
ReadOnlyMany: The volume can be mounted as read-only by many nodes.
storageClassNameThe name of the StorageClass to use.
storageThe required capacity of the storage volume. By default, this declaration acts as a resource request and does not limit the actual storage space available to the pod.
The capacity limit of a NAS file system is determined by its specifications. For more information, see General-purpose NAS and Extreme NAS.
However, when
allowVolumeExpansionin the StorageClass is set totrue, this value becomes a strictly enforced hard limit. The CSI plug-in sets the NAS directory quota based on this configuration to limit the available capacity of the PV. -
-
Create the PVC.
kubectl create -f nas-pvc.yaml -
Check the PV.
kubectl get pvThe expected output is similar to the following, which shows that the StorageClass automatically provisioned a PersistentVolume (PV) and bound it to the PVC.
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS VOLUMEATTRIBUTESCLASS REASON AGE nas-a7540d97-0f53-4e05-b7d9-557309****** 20Gi RWX Retain Bound default/nas-csi-pvc alicloud-nas-subpath <unset> 5m
Console
In the left navigation pane of the cluster management page, choose .
-
On the Persistent Volume Claims page, click Create, configure the PVC parameters, and then click Create.
Parameter
Description
PVC Type
Select NAS.
Name
The name of the PVC. The name must be unique within the namespace.
Allocation Mode
Select Use StorageClass.
Existing Storage Class
Click Select Storage Class and choose the StorageClass that you created.
Total Capacity
The required capacity of the storage volume. By default, this declaration acts as a resource request and does not limit the actual storage space available to the pod.
The capacity limit of a NAS file system is determined by its specifications. For more information, see General-purpose NAS and Extreme NAS.
However, when
allowVolumeExpansionin the StorageClass is set totrue, this value becomes a strictly enforced hard limit. The CSI plug-in sets the NAS directory quota based on this configuration to limit the available capacity of the PV.Access Mode
The access mode. Valid values:
-
ReadWriteMany(default): The volume can be mounted as read-write by many nodes. -
ReadWriteOnce: The volume can be mounted as read-write by a single node. -
ReadOnlyMany: The volume can be mounted as read-only by many nodes.
-
3. Create an application and mount NAS
After the PVC is created, you can mount the volume to an application. This section shows how to create two Deployments that reference the same PVC, allowing multiple pods to share the same NAS subpath.
kubectl
Create two Deployments that reference the same PVC to allow them to share the same subpath of the NAS file system.
To mount different subpaths from the same NAS file system to different pods, you must create a unique StorageClass and a corresponding PVC for each subpath.
-
Create two files named
nginx-1.yamlandnginx-2.yamlwith the following content.The configurations for both applications are nearly identical. They both reference the same PVC.
-
-
Create the two Deployments.
kubectl create -f nginx-1.yaml -f nginx-2.yaml -
Check the status of the pods.
kubectl get pod -l app=nginxExpected output:
NAME READY STATUS RESTARTS AGE nas-test-1-b75d5b6bc-***** 1/1 Running 0 51s nas-test-2-b75d5b6bc-***** 1/1 Running 0 44s -
Inspect each pod to verify that it uses the correct PersistentVolumeClaim (PVC).
Replace
<podName>with the actual name of each pod.kubectl describe pod <podName> | grep "ClaimName:"In the expected output, both pods use the same PVC, which confirms that they share the same subpath of the NAS file system.
Console
Repeat the following steps to create two Deployments that use the same PVC, which allows them to share the same subpath of the NAS file system.
On the ACK Clusters page, click the name of your cluster. In the left navigation pane, click .
-
Click Create from Image and follow the on-screen instructions to configure and create the application.
The key parameters are described below. You can keep the default values for other parameters. For more information, see Create a stateless application (Deployment).
Section
Parameter
Description
Basic Information
Replicas:
The number of replicas for the Deployment.
Container
Image
The address of the image used to deploy the application.
Required Resources
The vCPU and memory resources required by the container.
Volumes
Click Add PVC and then configure the parameters.
-
Mount Source: Select the PVC that you created.
-
Container Path: Enter the path within the container where the NAS file system will be mounted.
After the deployment is complete, you can click the application name on the Deployments page and check the Pods tab to confirm that the pods are running properly (their status is Running).
-
To verify that the storage is shared and persistent, see Verify shared and persistent storage.
Method 2: Mount using sharepath mode
In this mode, when PVs are created for PVCs that use this StorageClass, the provisioner does not create new directories. Instead, all PVs use the path defined in the StorageClass, mapping each PV to the same NAS directory.
1. Create a StorageClass
A StorageClass acts as a template for provisioning dynamic volumes and defines the source and behavior of the storage resources.
kubectl
-
Create a file named alicloud-nas-sharepath.yaml with the following content.
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: alicloud-nas-sharepath mountOptions: - nolock,tcp,noresvport - vers=3 parameters: volumeAs: sharepath # The format of the server field is <nas-server-address>:/<path> server: "0cd8b4a576-g****.cn-hangzhou.nas.aliyuncs.com:/k8s" provisioner: nasplugin.csi.alibabacloud.com reclaimPolicy: RetainParameter
Description
mountOptionsThe mount options for NAS, including the NFS protocol version. By default, volumes are mounted using NFSv3. You can specify a different version with an option such as
vers=4.0. For information about the NFS protocols supported by different NAS types, see NFS protocols.parameters.volumeAsThe volume provisioning mode. Set to
sharepath.parameters.serverThe NAS mount target and the subpath to mount, in the format
<nas-server-address>:/<path>.-
<nas-server-address>: The mount target of the NAS file system. For more information, see Manage mount targets. -
:/<path>: The NAS subpath to mount. If this parameter is not set or the specified subpath does not exist, the root directory is mounted by default.-
General-purpose NAS: The root directory is
/. -
Extreme NAS: The root directory is
/share. When you mount a subpath, thepathmust start with/share, such as/share/data.
-
provisionerThe driver. Set this parameter to
nasplugin.csi.alibabacloud.comwhen you use the Alibaba Cloud NAS CSI plug-in.reclaimPolicyThe reclaim policy for the PV. For
sharepathmode, this must be Retain. -
-
Create the StorageClass.
kubectl create -f alicloud-nas-sharepath.yaml
Console
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
-
Click Create, specify a unique name for the StorageClass, and select NAS as the PV Type.
Parameter
Description
Select Mount Target
The mount target of the NAS file system.
Volume Mode
The volume provisioning mode. In this example, select Shared Directory, which enables sharepath mode.
Mount Path
The NAS subdirectory to mount. If this parameter is not specified, the root directory is mounted by default.
If the directory does not exist in the NAS file system, it is automatically created and then mounted.
-
General-purpose NAS: The root directory is
/. -
Extreme NAS: The root directory is
/share. When you mount a subdirectory, thepathmust start with/share, such as/share/data.
Reclaim policy
For
sharepathmode, this must be Retain.Mount options
The mount options for NAS, including the NFS protocol version. By default, volumes are mounted using NFSv3. You can specify a different version with an option such as
vers=4.0. For information about the NFS protocols supported by different NAS types, see NFS protocols. -
2. Create a PVC
A PersistentVolumeClaim (PVC) is an application's request for storage that triggers an associated StorageClass to dynamically provision and bind a matching PersistentVolume (PV).
To enable data sharing across namespaces, you will create a PVC with the same name in two different namespaces. Although the PVCs share a name, they are distinct resources because they are in different namespaces. The StorageClass provisions a separate PV for each PVC, and both PVs point to the same shared directory on the NAS file system.
kubectl
-
Create two namespaces,
ns1andns2.kubectl create ns ns1 kubectl create ns ns2 -
Create a file named pvc.yaml with the following content to create a PVC with the same name in both the
ns1andns2namespaces.kind: PersistentVolumeClaim apiVersion: v1 metadata: name: nas-csi-pvc namespace: ns1 spec: accessModes: - ReadWriteMany storageClassName: alicloud-nas-sharepath resources: requests: storage: 20Gi --- kind: PersistentVolumeClaim apiVersion: v1 metadata: name: nas-csi-pvc namespace: ns2 spec: accessModes: - ReadWriteMany storageClassName: alicloud-nas-sharepath resources: requests: storage: 20GiParameter
Description
accessModesThe access mode. Valid values:
-
ReadWriteMany(default): The volume can be mounted as read-write by many nodes. -
ReadWriteOnce: The volume can be mounted as read-write by a single node. -
ReadOnlyMany: The volume can be mounted as read-only by many nodes.
storageClassNameThe name of the StorageClass to use.
storageThe required capacity of the storage volume. By default, this declaration acts as a resource request and does not limit the actual storage space available to the pod.
The capacity limit of a NAS file system is determined by its specifications. For more information, see General-purpose NAS and Extreme NAS.
However, when
allowVolumeExpansionin the StorageClass is set totrue, this value becomes a strictly enforced hard limit. The CSI plug-in sets the NAS directory quota based on this configuration to limit the available capacity of the PV. -
-
Create the PVCs.
kubectl create -f pvc.yaml -
Check the PV status to confirm that PVs have been automatically created and bound to the PVCs.
kubectl get pvThe expected output is similar to the following. The status of both PVs is
Bound, and theCLAIMcolumn shows that each PV is bound to a PVC in a different namespace (ns1/nas-csi-pvcandns2/nas-csi-pvc).NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS VOLUMEATTRIBUTESCLASS REASON AGE nas-0b448885-6226-4d22-8a5b-d0768c****** 20Gi RWX Retain Bound ns1/nas-csi-pvc alicloud-nas-sharepath <unset> 74s nas-bcd21c93-8219-4a11-986b-fd934a****** 20Gi RWX Retain Bound ns2/nas-csi-pvc alicloud-nas-sharepath <unset> 74s
Console
-
Create namespaces.
On the Clusters page, click the name of your cluster. In the left navigation pane, click Namespaces and Quotas.
-
Click Launch and follow the on-screen instructions to create the
ns1andns2namespaces.
In the left navigation pane of the cluster management page, choose .
-
In the
ns1namespace, create a storage claim.On the Persistent Volume Claims page, select
ns1from the Namespace dropdown list and follow the on-screen instructions to create the PVC.Parameter
Description
PVC Type
Select NAS.
Name
The name of the PVC. The name must be unique within the namespace.
Allocation Mode
Select Use StorageClass.
Existing Storage Class
Click Select Storage Class and choose the StorageClass that you created.
Capacity
The required capacity of the storage volume. By default, this declaration acts as a resource request and does not limit the actual storage space available to the pod.
The capacity limit of a NAS file system is determined by its specifications. For more information, see General-purpose NAS and Extreme NAS.
However, when
allowVolumeExpansionin the StorageClass is set totrue, this value becomes a strictly enforced hard limit. The CSI plug-in sets the NAS directory quota based on this configuration to limit the available capacity of the PV.Access Mode
The access mode. Valid values:
-
ReadWriteMany(default): The volume can be mounted as read-write by many nodes. -
ReadWriteOnce: The volume can be mounted as read-write by a single node. -
ReadOnlyMany: The volume can be mounted as read-only by many nodes.
-
-
Follow the previous step to create another PVC in the
ns2namespace.After creation, return to the Persistent Volume Claims page. In both the
ns1andns2namespaces, confirm that both PVCs are bound to their automatically created PVs.
3. Create an application and mount the NAS
After the PVCs are created, you can mount their bound PVs to your applications. In this section, you will create an application in each of the two namespaces and mount the corresponding PVC. This configuration allows both applications to share the NAS subdirectory defined in the StorageClass.
kubectl
-
Create two files named
nginx-ns1.yamlandnginx-ns2.yamlwith the following content.The configurations for both applications are nearly identical. They each bind to the PVC in their respective namespace.
-
-
Create the two Deployments.
kubectl create -f nginx-ns1.yaml -f nginx-ns2.yaml -
Check the Pod status.
kubectl get pod -A -l app=nginxExpected output:
NAMESPACE NAME READY STATUS RESTARTS AGE ns1 nas-test-b75d5b6bc-***** 1/1 Running 0 2m19s ns2 nas-test-b75d5b6bc-***** 1/1 Running 0 2m11s -
Check the detailed configuration of a Pod to confirm the PVC mount.
Replace
<namespace-name>and<pod-name>with the actual namespace and Pod name.kubectl describe pod -n <namespace-name> <pod-name> | grep "ClaimName:"In the expected output, the two Pods mount
ns1/nas-csi-pvcandns2/nas-csi-pvcrespectively.
Console
On the ACK Clusters page, click the name of your cluster. In the left navigation pane, click .
-
In the
ns1namespace, create a Deployment and mount the corresponding PVC.-
Select Namespace from the Namespace dropdown list and click Create from Image.
-
Follow the on-screen instructions to create the application.
The key parameters are described below. Leave other parameters at their default values. For more information, see Create a stateless workload (Deployment).
Section
Parameter
Description
Basic Information
Replicas:
The replica count of the Deployment.
Container
Image
The address of the image used to deploy the application.
Required Resources
The required vCPU and memory resources.
Volumes
Click Add PVC and configure the parameters.
-
Mount Source: Select the PVC that you created.
-
Container Path: Enter the path within the container where the NAS file system will be mounted, such as /data.
-
-
-
Follow the previous step to create another Deployment in the
ns2namespace and mount the corresponding PVC.Return to the Deployments page. In the
ns1andns2namespaces, check the status of each Deployment to confirm that the Pods are running and have mounted the correct PVCs.
To verify the results, see Verify shared and persistent storage.
Method 3: Mount a volume in filesystem mode
The filesystem mode allows you to dynamically create and manage a dedicated NAS file system and mount target for an application. Unlike the sharepath mode, each PV created in filesystem mode corresponds to a separate NAS file system instance.
Each PV of the filesystem type corresponds to a dedicated NAS file system and one mount target.
-
By default, when you delete a PV of the
filesystemtype, the corresponding NAS file system and mount target are retained. To automatically delete the NAS file system and mount target when the PV is deleted, add the following parameters to the StorageClass:-
reclaimPolicy: Delete -
parameters.deleteVolume: "true"
-
-
When using an ACK dedicated cluster, grant the necessary permissions to the csi-provisioner.
1. Create a StorageClass
2. Create a PVC
3. Create application and mount NAS
Verify shared and persistent storage
After you successfully deploy the application, you can verify that the storage volume works as expected. This section uses subpath mode to create nas-test-1 and nas-test-2 as an example for verification.
|
Shared storage |
Persistent storage |
|
To verify shared storage, create a file in one Pod and then view it in another.
|
To verify persistent storage, restart the Deployment and check if the data still exists in the new Pod's file system.
|
For production environments
-
Security and data protection
-
Use the Retain reclaim policy: Set the
reclaimPolicyof your StorageClass toRetain. This prevents data loss if a PVC is accidentally deleted. -
Use permission groups for access control: NAS uses permission groups to manage network access. Follow the principle of least privilege: add only the private IP addresses of cluster nodes or their vSwitch CIDR blocks to the permission group. Avoid overly broad permissions, such as
0.0.0.0/0.
-
-
Performance and cost optimization
-
Select an appropriate NAS type: Refer to File system selection to choose a NAS type that meets your application's IOPS and throughput requirements.
-
Optimize mount options (
mountOptions): Adjust NFS mount parameters based on your workload characteristics. For example, using protocol versions such asvers=4.0orvers=4.1can improve performance and file locking capabilities in some scenarios. For workloads with large-scale file I/O, test differentrsizeandwsizevalues to optimize read and write throughput.
-
-
Operations and reliability
-
Configure health checks: Configure a liveness probe for your application pods to verify that the mount point is healthy. If a mount point becomes unresponsive, ACK automatically restarts the pod, triggering a remount of the storage volume.
-
Set up monitoring and alerts: Use container storage monitoring to configure alerts to promptly detect storage volume issues or performance bottlenecks.
-
Resource release
To avoid unexpected charges, release the associated resources in the following order when the NAS storage volume is no longer required.
-
Delete the workload
-
Action: Delete all workloads (such as Deployments and StatefulSets) that use the NAS storage volume. This prevents application Pods from mounting, reading from, or writing to the volume.
-
Example command:
kubectl delete deployment <your-deployment-name>
-
-
Delete the PVC
-
Action: Delete the PVC associated with the workload. After the PVC is deleted, the behavior of the bound PV and the backend NAS depends on the
reclaimPolicydefined in the corresponding StorageClass.-
Subpath mode
-
If
reclaimPolicyisRetain: After the PVC is deleted, its bound PV enters theReleasedstate. The PV object and the corresponding subdirectory and data on the backend NAS are retained and must be deleted manually. -
If
reclaimPolicyisDelete: After the PVC is deleted, its bound PV is automatically deleted. The handling of the backend NAS subdirectory depends on thearchiveOnDeleteparameter:-
If
archiveOnDeleteis"true": The backend data is not deleted but is renamed and archived asarchived-{pvName}.{timestamp}. -
If
archiveOnDeleteis"false": The PV's corresponding subdirectory on the backend NAS and all its data are permanently deleted. Proceed with caution.
In an ACK Serverless cluster, due to permission restrictions, even if
reclaimPolicy: Deleteis configured, the backend NAS directory and data are not deleted or archived. Only the PV object is deleted. -
-
-
Sharepath mode
This mode supports only a
reclaimPolicyofRetain. After the PVC is deleted, its bound PV enters theReleasedstate. The PV object, the backend shared directory, and all data are retained. -
Filesystem mode
-
If
reclaimPolicyisRetain: After the PVC is deleted, its bound PV enters theReleasedstate. The PV object, the dynamically created backend NAS file system, and the mount point are all retained. -
If
reclaimPolicyisDelete: After the PVC is deleted, its bound PV is automatically deleted. The handling of the backend NAS file system depends on thedeleteVolumeparameter:-
If
deleteVolumeis"false": The backend NAS file system and mount point are retained and must be deleted manually. -
If
deleteVolumeis"true": The backend NAS file system and mount point are automatically deleted. Proceed with caution.
-
-
-
-
Example command:
kubectl delete pvc <your-pvc-name>
-
-
Delete the PV
-
Action: You can delete a PV when it is in the
AvailableorReleasedstate. This action only removes the PV definition from the Kubernetes cluster but does not delete any data from the backend NAS file system. -
Example command:
kubectl delete pv <your-pv-name>
-
-
Delete the backend NAS file system (optional)
-
subpathandsharepathmodes: See Delete a file system. This operation permanently deletes all data on the NAS, and the data cannot be recovered. Proceed with caution. Before you perform this operation, you must confirm that the NAS has no business dependencies. -
filesystemmode: If the backend NAS file system is not automatically deleted when you delete a PVC, see Delete a file system to locate and manually delete the corresponding file system.
-
Related documents
-
If you encounter problems when mounting or using NAS storage volumes, refer to the following documents for troubleshooting.
-
You can use CNFS to independently manage NAS file systems for improved performance and QoS control. For detailed instructions, see Manage NAS file systems by using CNFS.
-
NAS storage volumes mounted using subpath support directory quotas. For more information, see Set directory quotas for dynamic NAS storage volumes.