This topic describes how to mount a Cloud Paralleled File System (CPFS) to an Alibaba Cloud Container Service for Kubernetes (ACK) cluster. Deep Learning Containers (DLC) allows you to store source data in CPFSs.

Background information

You can use a pair of persistent volume (PV) and persistent volume claim (PVC) to mount a CPFS to an ACK cluster. However, you cannot directly create a pair of PV and PVC for a CPFS in the ACK console. You must create a YAML file to declare a PV and PVC.

Procedure

  1. Run the following command to check whether the flexvolume-cpfs plug-in is installed:
    $ kubectl get pods -n kube-system | grep flexvolume-cpfs
    flexvolume-cpfs-dcldf                             1/1     Running   0          98m
    flexvolume-cpfs-dkrt8                             1/1     Running   0          98m
    If the flexvolume-cpfs plug-in is not installed, install the plug-in first. For more information, see Use CPFS volumes.
  2. Create a PV.
    1. Create a pai-deeplearing-cpfs-pv.yaml file, and copy the following content to the file:
      apiVersion: v1
      kind: PersistentVolume
      metadata:
      name: pai-deeplearning-cpfs
      labels:
       alicloud-pvname: pai-deeplearning-cpfs
      spec:
      capacity:
       storage: 1000Gi
      accessModes:
       - ReadWriteMany
      flexVolume:
       driver: "alicloud/cpfs"
       options:
         server: "cpfs-****-0th1.cn-shenzhen.cpfs.nas.aliyuncs.com@tcp:cpfs-****-mdm1.cn-shenzhen.cpfs.nas.aliyuncs.com@tcp"
         fileSystem: "****"
         subPath: "/"
         options: "rw"
    2. Log on to the NAS console. On the File System List page, click the ID of the target CPFS in the File System ID/Name column.
    3. On the Basic Information page, check server and fileSystem next to Mount Target.
    4. Set the server and fileSystem parameters in the pai-deeplearing-cpfs-pv.ya file to the displayed values.
    5. Run the following command to create a PV:
      kubectl create -f pai-deeplearing-cpfs-pv.yaml
  3. Create a PVC.
    1. Create a pai-deeplearing-cpfs-pvc file and then copy the following content to the file:
      kind: PersistentVolumeClaim
      apiVersion: v1
      metadata:
      name: pai-deeplearning-cpfs
      spec:
      accessModes:
       - ReadWriteMany
      resources:
       requests:
         storage: 1000Gi
      selector:
       matchLabels:
         alicloud-pvname: pai-deeplearning-cpfs
      Note The value of alicloud-pvname must be the same as that of alicloud-pvname in the pai-deeplearing-cpfs-pv.yaml file.
    2. Run the following command to create a PVC:
      kubectl create -f pai-deeplearing-cpfs-pvc
  4. Run the following commands to check whether the PV and PVC are created:
    $ kubectl get pv | grep pai-deeplearning-cpfs
    pai-deeplearning-cpfs    1000Gi     RWX            Retain           Bound    default/pai-deeplearning-cpfs                                           152m
    $ kubectl get pvc | grep pai-deeplearning-cpfs
    pai-deeplearning-cpfs   Bound    pai-deeplearning-cpfs   1000Gi     RWX
  5. Mount the CPFS to an Elastic Compute Service (ECS) instance deployed in the same region, and upload data to the CPFS. For more information, see Mount a file system.