This topic describes the recommended methods that you can use to mount File Storage NAS (NAS) file systems on Container Service for Kubernetes (ACK) clusters. You can mount NAS file systems by using the Container Storage Interface (CSI) plug-in or Container Network File System (CNFS).
We recommend that you mount a NAS file system by using one of the following methods. If you mount a NAS file system by using other methods, the file system may be exposed to stability risks. The NAS technical team cannot estimate the impact of these risks. You are solely responsible for all the losses and consequences that may arise from the risks.
Storage plug-ins of ACK
Based on the CSI plug-in, Alibaba Cloud ACK is deeply integrated with Alibaba Cloud storage services and is fully compatible with Kubernetes-native storage services.
CNFS is a new method for container storage management developed based on the CSI plug-in. CNFS is compatible with the traditional CSI storage method. We recommend that you use CNFS to manage and access NAS volumes when you use ACK. This significantly improves performance and provides powerful management capabilities and I/O observability.
If your container cluster is small, infrequently scaled, and mainly used for testing purposes, you can also use the HostPath method to access NAS file systems. For more information, see Use hostPath volumes.
If you are using a self-managed Kubernetes cluster that contains a large number of nodes and supports auto-scaling, we recommend that you use the CSI plug-in to access NAS file systems. For a cluster with a stable scale, we recommend that you use built-in volumes of Kubernetes to access NAS file systems. For more information, see Mount a NAS file system on a self-managed Kubernetes cluster.
Take note of the following items:
To mount a file system on a new ACK cluster, we recommend that you use CNFS.
To mount a file system on an existing ACK cluster, we recommended that you migrate the cluster to CNFS.
To mount a file system on an existing Kubernetes cluster, we recommend that you use a storage plug-in that is already installed.
For more information about the CSI plug-in, see CSI overview.
Use CNFS to mount file systems (recommended)
If you use a traditional shared NAS file system in a container, the following problems may occur: The latency in reading and writing small files is high, precise control of capacity quotas is missing, mistakenly deleted files cannot be recovered, and observable metrics of storage volumes are missing. CNFS allows you to abstract NAS file systems as custom Kubernetes objects by using the CustomResourceDefinition (CRD) resource. You can use the custom objects to create, delete, describe, mount, monitor, and scale up NAS file systems. In addition, you can use the acceleration client of NAS in the CSI plug-in to significantly accelerate access to NAS. CNFS is free of charge. After you enable the acceleration client, CNFS consumes about 50 to 100 MB of memory in the pod.
Metric | Benchmarking scenario1 | Before the CNFS acceleration client is used | After the CNFS acceleration client is used |
Read and write performance on metadata | Duration of traversing one million directories | 18 minutes | < 60 seconds |
Duration of creating a file of 4 KB in size | 3,000 microseconds | < 200 microseconds | |
Duration of reading a file of 4 KB in size for the second time | 400 microseconds | < 100 microseconds | |
Read and write throughput | Read and write throughput of a single node2 | 200 to 500 MB/s | > 800 MB/s |
Overall performance in comprehensive scenarios | Duration of extracting 5,000 images that each is 150 KB in size | 52 seconds | About 15 seconds |
Duration of creating a Redis project | 27 seconds | About 21 seconds |
The values provided in the preceding table are only theoretical values (reference values). The actual values are subject to your operating environment.
Note 1: The type of Elastic Compute Service (ECS) instance that is used to run the benchmark test is ecs.hfg6.4xlarge. The benchmark data may vary based on the environment.
Note 2: The bandwidth of the ECS instance and the type of the NAS file system affect the read and write throughput of the node.
If you use CNFS to access NAS file systems, see Use CNFS to manage NAS file systems (recommended).
If you use containers for scientific computing, such as AI training and biological computing, building continuous integration or continuous delivery (CI/CD) platforms, or providing website services, we recommend that you enable the distributed read cache feature of CNFS. For more information, see Enable the distributed caching feature of the CNFS client.
For more information about CNFS, see Use CNFS to manage NAS file systems (recommended).
Use the CSI plug-in to mount file systems
For information about how to mount file systems by using the CSI plug-in, see NAS volume overview.
The CSI plug-in supports the following methods:
Mount file systems as static persistent volumes (PVs). For more information, see Mount a statically provisioned NAS volume by using NFS.
Mount file systems as dynamic PVs. For more information, see Mount a dynamically provisioned NAS volume by using NFS.
For more information, see Manage the CSI plug-in, Set quotas on the subdirectories of NAS NFS volumes, and FAQ about NAS volumes.