Updated on 2024-08-16 GMT+08:00

(kubectl) Automatically Creating an EVS Disk

Notes and Constraints

The following configuration example applies to clusters of Kubernetes 1.13 or earlier.

Procedure

  1. Use kubectl to connect to the cluster. For details, see Connecting to a Cluster Using kubectl.
  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

    Example YAML file for clusters of v1.9, v1.11, and v1.13:
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: pvc-evs-auto-example
      namespace: default
      annotations:
        volume.beta.kubernetes.io/storage-class: sas
      labels:
        failure-domain.beta.kubernetes.io/region: ap-southeast-1
        failure-domain.beta.kubernetes.io/zone: ap-southeast-1a
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi
    Table 1 Key parameters

    Parameter

    Description

    volume.beta.kubernetes.io/storage-class

    EVS disk type. The value is in lowercase.

    failure-domain.beta.kubernetes.io/region

    Region where the cluster is located.

    failure-domain.beta.kubernetes.io/zone

    AZ where the EVS volume is created. It must be the same as the AZ planned for the workload.

    storage

    Storage capacity in the unit of Gi.

    accessModes

    Read/write mode of the volume.

    You can set this parameter to ReadWriteMany (shared volume) and ReadWriteOnce (non-shared volume).

  3. Run the following command to create a PVC.

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

    After the command is executed, an EVS disk is created in the partition where the cluster is located. Choose Storage > EVS to view the EVS disk. Alternatively, you can view the EVS disk based on the volume name on the EVS console.