You can use the CSI plug-in to mount a Network Attached Storage (NAS) file system to a sandboxed container. This significantly improves I/O performance. This topic provides an example of how to use the CSI plug-in to directly mount a NAS file system to a sandboxed container. A NAS file system can also be mounted to a container through the host or the 9pfs file system. This topic also compares the I/O performance in these mount modes.
Prerequisites
Background information

How the direct mount solution works

Step | Description |
---|---|
① | The kubelet requests the CSI plug-in to mount a NAS file system. |
② | The CSI plug-in sends a request to QueryServer to query whether a mounted volume that corresponds to the NAS file system exists. QueryServer is a local database that stores information about mounted volumes. |
③ | If no such mounted volume is found, information about the NAS file system, such as the mount target and mount directory, is written to QueryServer. |
④ | When a pod is ready, the kubelet starts to create a container. The request to mount the NAS file system is forwarded to Kata-Runtime. |
⑤ | Kata-Runtime sends a request to QueryServer to query information about the NAS file system. This includes the mount target and mount directory. |
⑥ | Kata-Runtime sends a request to Kata-Agent. |
⑦ | Kata-Agent starts a container and mounts the NAS file system to the container. |
Examples
The following example describes how to mount a NAS file system to a sandboxed container. In this example, an Apsara File Storage NAS instance is created and a YAML file template is used to create resource objects.
Comparison of I/O performance in different mount modes
-
Input/output operations per second (IOPS) of random reads
Mount mode Result Host read: IOPS=24.3k, BW=94.8MiB/s (99.4MB/s)(5687MiB/60004msec) CSI plug-in read: IOPS=26.0k, BW=102MiB/s (107MB/s)(6101MiB/60005msec) 9PFS read: IOPS=780, BW=3120KiB/s (3195kB/s)(183MiB/60001msec) -
IOPS of random writes
Mount mode Result Host write: IOPS=14.3k, BW=55.9MiB/s (58.6MB/s)(3354MiB/60006msec) CSI plug-in write: IOPS=13.8k, BW=53.8MiB/s (56.4MB/s)(3226MiB/60008msec) 9PFS write: IOPS=356, BW=1428KiB/s (1462kB/s)(83.7MiB/60001msec) -
Throughput of random reads
Mount mode Result Host read: IOPS=331, BW=331MiB/s (347MB/s)(29.9GiB/92439msec) CSI plug-in read: IOPS=251, BW=252MiB/s (264MB/s)(29.9GiB/121561msec) 9PFS read: IOPS=130, BW=130MiB/s (136MB/s)(7861MiB/60422msec) -
Throughput of random writes
Mount mode Result Host write: IOPS=507, BW=507MiB/s (532MB/s)(29.9GiB/60372msec) CSI plug-in write: IOPS=508, BW=508MiB/s (533MB/s)(29.9GiB/60255msec) 9PFS write: IOPS=1, BW=1500KiB/s (1536kB/s)(88.0MiB/60061msec)
The preceding results show that the throughput and IOPS are almost the same between a NAS file system that is mounted through the host and a NAS file system that is mounted by using CSI. However, a NAS file system that is mounted by using CSI has significant advantages in the IOPS than a NAS file system that is mounted through 9pfs.