This topic describes how to use a static NAS volume in the console.

Background information

  • You have created a NAS file system. For more information, see Manage file systems.
  • You have created a mount target. For more information, see Manage mount targets.

    The NAS mount target and the cluster nodes must be in the same VPC network.

Create a PV

  1. Log on to the Container Service console.
  2. In the left-side navigation pane, choose Clusters > Persistent Volumes to go to the PVs and PVCs page.
  3. On the Persistent Volumes tab, click Create in the upper-right corner.
    • PV Type: Supports three types of cloud storage: Cloud Disk, NAS, and OSS. In this example, select NAS.
    • Volume Name: The name of the PV. The name must be unique in the cluster. In this example, enter pv-nas.
    • Volume Plugin-in: Supports Flexvolume and CSI. In this example, select CSI.
    • Capacity: The capacity of the PV. Note that the NAS file system provides unlimited capacity. This parameter does not limit the usage of the NAS file system and defines only the capacity of the PV.
    • Access Mode: Supports ReadWriteMany and ReadWriteOnce. Default is ReadWriteMany.
    • Mount Target Domain Name: You can Select Mount Target or enter a custom mount target.
    • Show Advanced Options: Set advanced parameters.
      • Subdirectory: Enter a subdirectory in the NAS file system. The subdirectory must start with a forward slash (/). If this parameter is set, the PV will be mounted to the subdirectory.
        • If the specified subdirectory does not exist under the root directory of the NAS file system, the system automatically creates this subdirectory.
        • This parameter is optional. The PV is mounted to the root directory of the NAS file system by default.
        • To specify a subdirectory in a NAS Extreme file system, the subdirectory must start with /share.
      • Version: The version of the PV.
    • Label: Attach labels to the PV.
  4. Click Create.

Create a PVC

  1. In the left-side navigation pane, choose Clusters > Persistent Volumes to go to the PVs and PVCs page.
  2. On the Persistent Volume Claims tab, click Create in the upper-right corner.
  3. In the Create PVC dialog box that appears, set the parameters.
    • Source: Use Existing PV and Use Storage Class are supported. In this example, select Use Existing PV.
    • PVC Type: Supports three types of cloud storage: Cloud Disk, NAS, and OSS. In this example, select NAS.
      Note This option appears only when you set the Source parameter to Use Existing PV.
    • Name: The name of the PVC. It must be unique in the cluster.
    • Allocation Mode: Select an existing volume.
      Note This option appears only when you set the Source parameter to Use Existing PV.
    • Existing Volumes: Click Select PV. Find the target PV and click Select in the Actions column.
    • Capacity: The capacity of the PVC.
      Note The capacity of the PVC cannot exceed the capacity of the PV that will be bound to this PVC.
    • Access Mode: Default is ReadWriteOnce.
      Note This option appears only when you set the Source parameter to Use Storage Class.
  4. Click Create.
    After the PVC is created, you can find it on the Persistent Volume Claims page. In the following figure, the csi-nas-pvc PVC is already bound with the PV created from the previous step.

Create an application

  1. In the left-side navigation pane, choose Applications > Deployments and then click Create from Image in the upper-right corner.
  2. Set the following parameters: Name, Cluster, Namespace, Replicas, Type, Annotations, and Labels. The replicas parameter specifies the number of Pods. Click Next.
    Note In this example, set the type parameter to Deployment.
  3. Configure the container.
    This example describes how to set the volume parameter. For more information about other parameters, see Create deployments by using images.
    Local storage and cloud storage are supported.
    • Local Storage: Supports hostPath, ConfigMaps, Secrets, and EmptyDir. You need to mount the storage to a path in the container. For more information, see Volumes.
    • Cloud Storage: Supports cloud storage.
    In this example, specify the previously created PVC and mount it to the /tmp path in the container.
  4. Set the other parameters and click Create.
    After the application is created, you can use the NAS volume in the application.

You can also use a static NAS volume through command lines. For more information, see Use a static NAS volume through YAML.