This topic describes the scenarios where you can mount an Apsara File Storage NAS (NAS) file system to pods and how to mount a NAS file system. After you mount a NAS file system to multiple pods, the pods can share data with each other.
Prerequisites
- Create a managed Kubernetes cluster.
- Use kubectl to connect to an ACK cluster.
- A NAS file system is created in the NAS File System console. For more information, see Mount an NFS file system. The NAS file system and your Kubernetes cluster must be deployed in the same zone.
- A mount target is added to the NAS file system. For more information, see Mount an SMB file system on Windows. Make sure that the NAS file system and your Kubernetes cluster are connected to the same virtual private cloud (VPC).
Background information
If a NAS file system is mounted to multiple pods, data in the file system is shared
by the pods. The application must be capable of automatically synchronizing application
data across pods.
Note You are not allowed to grant permissions to access /directory (root directory) of the NAS file system. The user account and user group to which
the directory belongs cannot be modified.
Scenarios
- You want to run applications that require high disk I/O throughput.
- You need a storage service whose read and write throughput is higher than Object Storage Service (OSS).
- You want to share files across hosts. For example, you want to use a NAS file system as a file server.
Procedure
- Create a NAS file system and add a mount target to it.
- Manually create a persistent volume (PV) and a persistent volume claim (PVC).
The following content describes how to create a PV or PVC by using the flexvolume plug-in provided by Alibaba Cloud and then mount a NAS file system.
Create a PV
Expected results:
- Log on to the ACK console.
- In the left-side navigation pane, click Clusters.
- On the Clusters page, find the cluster that you want to manage. Then, click the name of the cluster or click Details in the Actions column.
- In the left-side pane of the details page, click Volumes.
- Click the Persistent Volumes tab to view the PV that you created.
Create a PVC
Before you create a PVC for a NAS file system, you must set the selector
parameter to specify the PV with which the PVC is associated.
Expected results:
- Log on to the ACK console.
- In the left-side navigation pane, click Clusters.
- On the Clusters page, find the cluster that you want to manage. Then, click the name of the cluster or click Details in the Actions column.
- In the left-side pane of the details page, click Volumes.
- Click the Persistent Volume Claims tab to view the PVC that you created.
Deploy an application
Expected results:
- Log on to the ACK console.
- In the left-side navigation pane, click Clusters.
- On the Clusters page, find the cluster that you want to manage. Then, click the name of the cluster or click Applications in the Actions column.
- In the left-side navigation pane of the details page, click Workloads.
- On the page that appears, click the Deployments tab to view the application that you deployed.