• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. User Guide 2.0
  4. Storage Management
  5. Using EVS Disks

Using EVS Disks

To meet data persistency requirements, CCE allows EVS disks to be mounted to containers. By using EVS disks, you can mount a remote file directory of the storage system to the container so that data in the data volume is permanently stored. Even if the container is deleted, only the mount relationship is deleted. The data in the data volume is still stored in the storage system.

Application Scenarios

Currently, EVS disks of three specifications are supported: common I/O, high I/O, and ultra-high I/O.

  • Common I/O: The backend storage is provided by the SATA storage media. Common I/O is applicable to scenarios where large capacity and low read/write rate are required, and the volume of transactions is low. Examples include development testing and enterprise office applications.
  • High I/O: The backend storage is provided by the SAS storage media. High I/O is applicable to scenarios where relatively high performance, high read/write rate, and real-time data storage are required. Examples include creating file systems and sharing distributed files.
  • Ultra-high I/O: The backend storage is provided by the SSD storage media. Super-high I/O is applicable to scenarios where high performance, high read/write rate, and data-intensive applications are required. Examples include NoSQL, relational database, and data warehouse (such as SAP HANA).

Creating Storage Volumes of EVS Disks

  1. Log in to the CCE console. In the navigation pane, choose Resource Management > Storage and then click Create in the navigation pane.
  2. Configure basic disk information, as shown in Table 1.

    Table 1 Basic disk information

    Parameter

    Description

    PVC Name

    Name of the PersistentVolumeClaim (PVC). A storage volume is automatically created when a PVC is created. One PVC corresponds to one storage volume. The name of a storage volume is automatically generated when a PVC is created.

    Cluster Name

    Cluster where the new EVS disk is deployed.

    Namespace

    Namespace where the EVS disk is deployed.

    Type

    Type of the new EVS disk.

    Disk Capacity (GB)

    Capacity of the new EVS disk.

    Access Mode

    ReadWriteMany: The volume can be mounted as read-write by many nodes.

    AZ

    Physical location where resources use independent power supplies and networks. AZs are physically isolated but interconnected through an internal network.

  3. Click Create Now. Confirm order details, click Submit, click Back to Storage List and wait until the EVS disk has been created successfully.

    After the EVS disk has been created successfully, the created storage is displayed in the storage list. If the storage status is Bound, the storage has been created successfully.

  4. Click the storage name. On the storage details page that is displayed, view the storage information such as the PVC name and creation time.

Using Storage Volumes of EVS Disks

  1. Create an application by following the procedure in section Creating a Stateless Application or section Creating a Stateful Application. Choose Data Storage > Cloud Storage. On the page that is displayed, click Add Cloud Storage.
  2. Set the storage type to EVS.

    Table 2 Parameters required for mounting EVS disks

    Parameter

    Description

    Storage Type

    EVS: The usage of an EVS disk is the same as that of a traditional disk. EVS disks have higher data reliability and I/O throughput and are more user-friendly than traditional disks. EVS disks are available for file systems, databases, and system software or applications that require block storage devices.

    Allocation Mode

    Manual

    Select an existing storage volume. If no storage volume is available, follow the prompts to create one.

    Automatic

    A storage volume is created automatically. You need to enter the storage capacity.

    NOTE:

    A storage volume that is created automatically will not be tagged.

    1. If you have selected EVS as the storage type, first select an AZ. This must be the same as the CCE node where the container will run.
    2. Select a storage sub-type.
      • Common I/O: EVS disks that have common I/O and use SATA.
      • High I/O: EVS disks that have high I/O and use SAS.
      • Ultra-high I/O: EVS disks that have super-high I/O and use SSD.
    3. Enter the storage capacity in GB. Ensure that the storage capacity quota is not exceeded; otherwise, creation will fail.

    Add Container Path

    1. Click Add Container Path.
    2. Container Path: Enter the container path to which the data volume is mounted.
      NOTICE:
      • Do not mount a data volume to a system directory such as / or /var/run. This action may cause a container error to occur. You are advised to mount the data volume to an empty directory. If the directory is not empty, ensure that the directory does not contain any files that affect container startup; otherwise, the files will be replaced, making it impossible for the container to be properly started. The application creation will fail.
      • When the data volume is mounted to a high-risk directory, you are advised to use a low-permission account to start the container; otherwise, high-risk files on the host machine may be damaged.
    3. Set permissions.
      • Read-only: only allows you to read data volumes in the container path.
      • Read/Write: allows you to modify the data volumes in the container path. However, newly written data will not be migrated during container migration.

  3. Click OK.

Attaching and Mounting EVS Disks

CCE allows you to import existing EVS disks.

  1. Log in to the CCE console. In the navigation pane, choose Resource Management > Storage. On the EVS tab page, click Import.
  2. Select one or more EVS disks that you want to attach and mount.
  3. Click OK.

Unbinding an EVS Disk

After an EVS disk is successfully created or attached, the EVS disk is automatically bound to the current cluster and cannot be used by other clusters. After the EVS disk is unbound from the cluster, it can be attached and used by other clusters.

If the EVS disk has been mounted to an application, the EVS disk cannot be unbound from the cluster.

  1. Log in to the CCE console. In the navigation pane, choose Resource Management > Storage. In the EVS disk list, click Unbind next to the target EVS disk.
  2. In the dialog box that is displayed, click OK.

Creating an EVS Disk Using kubectl

CCE supports the creation of EVS disks in the form of PersistentVolumeClaim (PVC).

Prerequisites

You have configured the kubectl command and connected an ECS server to the cluster. For details, see Connecting to a Kubernetes Cluster Using kubectl.

Procedure

  1. Log in to the ECS server on which the kubectl commands have been configured. For details, see Logging In to a Linux ECS.
  2. Run the following commands to configure the pvc-evs-auto-example.yaml file, which is used to create a PVC.

    touch pvc-evs-auto-example.yaml

    vi pvc-evs-auto-example.yaml

    The following shows an example of creating an EVS disk.

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      annotations:
        volume.beta.kubernetes.io/storage-class: sas    # Storage type; Currently, EVS supports sas, ssd, and sata
      labels:
        failure-domain.beta.kubernetes.io/region: eu-de
        failure-domain.beta.kubernetes.io/zone: eu-de-01
      name: pvc-evs-auto-example                    # PVC name
      namespace: default
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 10Gi                                  # Storage capacity in Gi.

    In the preceding example:

    • volume.beta.kubernetes.io/storage-class is the EVS disk type. Currently, high I/O (SAS), ultra-high I/O (SSD), and common I/O (SATA) are supported.
    • failure-domain.beta.kubernetes.io/region indicates the region where the cluster is located.
    • failure-domain.beta.kubernetes.io/zone indicates the AZ where the EVS disk is created. It must be the same as the AZ planned for the application.
    • name indicates the name of the PVC to be created.
    • storage indicates the storage capacity in Gi.

  3. Run the following command to create a PVC.

    kubectl create -f pvc-evs-auto-example.yaml

    After the command is executed, you can go to Resource Management > Storage > EVS to view the EVS disk. Alternatively, you can view the EVS disk by volume name on the EVS console.

Creating a PV/PVC for an Existing EVS Disk Using kubectl

CCE allows you to use an existing EVS disk to create a PersistentVolume (PV) and bind the PV to the PVC.

  1. Log in to the EVS console, and obtain the ID of the existing EVS disk.
  2. Log in to the ECS server on which kubectl commands have been configured. For details, see Logging In to a Linux ECS.
  3. Run the following command to configure the pv-evs-example.yaml file, which is used to create a PV.

    vi pv-evs-example.yaml

    The following shows an example of creating a PV using an EVS disk.

    apiVersion: v1
    kind: PersistentVolume
    metadata:
      labels:
        failure-domain.beta.kubernetes.io/region: eu-de
        failure-domain.beta.kubernetes.io/zone: eu-de-02
      name: pv-evs-example
      namespace: default
    spec:
      accessModes:
      - ReadWriteMany
      capacity:
        storage: 10Gi
      flexVolume:
        driver: huawei.com/fuxivol
        fsType: ext4
        options:
          fsType: ext4
          volumeID: 0992dbda-6340-470e-a74e-4f0db288ed82
      persistentVolumeReclaimPolicy: Delete
      storageClassName: sata
    In the preceding example:
    • failure-domain.beta.kubernetes.io/region indicates the region where the cluster is located.
    • failure-domain.beta.kubernetes.io/zone indicates the AZ where the EVS disk is created. It must be the same as the AZ planned for the application.
    • driver indicates the driver for the storage to be mounted. Set this parameter to huawei.com/fuxivol for EVS disks.
    • volumeID: indicates the ID of the EVS disk.
    • storage indicates the storage capacity in Gi.
    • storageClassName is the EVS disk type. Currently, high I/O (SAS), ultra-high I/O (SSD), and common I/O (SATA) are supported.

  1. Run the following command to create a PV.

    kubectl create -f pv-sfs-example.yaml

  2. Run the following commands to configure the pvc-evs-example.yaml file, which is used to create a PVC.

    touch pvc-evs-example.yaml

    vi pvc-evs-example.yaml

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      annotations:
        volume.beta.kubernetes.io/storage-class: sata        # Storage type; Currently, EVS supports sas, ssd, and sata
      labels:
        failure-domain.beta.kubernetes.io/region: eu-de
        failure-domain.beta.kubernetes.io/zone: eu-de-02
      name: pvc-evs-auto-example                              # PersistentVolumeClaim name
      namespace: default
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 10Gi                  # Storage capacity in Gi.
      volumeName: pv-evs-example

  1. Run the following command to create a PVC.

    kubectl create -f pvc-evs-example.yaml

    After the command is executed, go to Resource Management > Storage > EVS to view the EVS disk. Alternatively, you can view the EVS disk by volume name on the EVS console.

Mounting an EVS Disk Using kubectl

After an EVS disk is created or imported to the CCE console, you can mount it in an application.

EVS disks cannot be mounted across AZs. Before mounting, you can run the kubectl get pvc command to query the available PVCs in the partition where the current cluster is located.

  1. Run the following commands to configure the evs-pod-example.yaml file, which is used to create a pod.

    touch evs-pod-example.yaml

    vi evs-pod-example.yaml

    The following shows an example of mounting an EVS disk.

    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: evs-pod-example
      namespace: default
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: evs-pod-example
      template:
        metadata:
          labels:
            app: evs-pod-example
        spec:
          containers:
          - image: nginx:1.1
            name: container-0
            volumeMounts:
            - mountPath: /tmp
              name: pvc-evs-example
          restartPolicy: Always
          volumes:
          - name: pvc-evs-example
            persistentVolumeClaim:
              claimName: pvc-evs-auto-example

    In the preceding example:

    • name is the name of the pod to be created.
    • app is the name of a pod application.
    • mountPath is the mount path in a container. In the example, the EVS disk is mounted to the /tmp directory.
    • spec.template.spec.containers.volumeMounts.name and spec.template.spec.volumes.name must be consistent because they have a mapping relationship.

  2. Run the following command to create a pod.

    kubectl create -f evs-pod-example.yaml

    After the pod is created, choose Resource Management > Storage > EVS on the CCE console to view the binding relationship between the application and PVC.

Related Operations

After the EVS disk is created, you can perform operations described in Table 3.
Table 3 Other operations

Operation

Description

Deleting an EVS disk

  1. Select the EVS disk to be deleted and click Delete in the Operation column.
  2. Follow the prompts to delete the EVS disk.