CCE allows you to specify a StorageClass to automatically create an EVS disk and the corresponding PV. This function is applicable when no underlying storage volume is available.
For clusters v1.19.10 and later, if an HPA policy is used to scale out a workload with EVS volumes mounted, a new pod cannot be started because EVS disks cannot be attached.
Parameter | Description |
|---|---|
PVC Type | In this example, select EVS. |
PVC Name | Enter the PVC name, which must be unique in a namespace. |
Creation Method |
In this example, select Dynamically provision. |
Storage Classes | The default StorageClasses for EVS disks are csi-disk and csi-disk-topology. NOTE: If you use the csi-disk (EVS) StorageClass, a PVC and PV will be created immediately. The EVS disk is created with the PV, and then the PVC is bound to the PV. If you use the csi-disk-topology (EVS created with a delay) StorageClass, a PV will not be immediately created when a PVC is created. Instead, the pods that will be associated with the PVC are scheduled first, and then the EVS disk and PV are created, and finally the PV is bound to the PVC. You can customize a StorageClass and configure its reclaim policy and binding mode. For details, see Creating a StorageClass Through the Console. |
(Optional) Storage Volume Name Prefix | Available only when the cluster version is v1.23.14-r0, v1.25.9-r0, v1.27.6-r0, v1.28.4-r0, or later, and Everest of v2.4.15 or later is installed in the cluster. This parameter specifies the name of the underlying storage that is automatically created. The actual underlying storage name is in the format of "Storage volume name prefix + PVC UID". If this parameter is left blank, the default prefix pvc will be used. For example, if the storage volume name prefix is set to test, the actual underlying storage name is test-{UID}. |
AZ | Select the AZ of the EVS disk. The AZ must be the same as that of the cluster node. NOTE: An EVS disk can only be mounted to a node in the same AZ. After an EVS disk is created, its AZ cannot be changed. |
Disk Type | Select an EVS disk type. EVS disk types vary depending on regions. Obtain the available EVS types on the console. |
Capacity (GiB) | Capacity of the requested storage volume. |
Access Mode | EVS volumes support only ReadWriteOnce, indicating that a storage volume can be mounted to one node in read/write mode. For details, see Volume Access Modes. |
Encryption | Configure whether to encrypt the underlying storage. If you select Enable, select the target key or enter the key ID. Before using encryption, check whether the region where the EVS disk is located supports disk encryption. |
Enterprise Project | This parameter is available only for enterprise accounts with enterprise projects enabled. The enterprise project can be the default project, the project where the cluster is located, or the project specified by the StorageClass. |
Resource Tag | You can add resource tags to classify resources. This function is supported only when the Everest version in the cluster is v2.1.39 or later. You can create predefined tags on the TMS console. These tags are available to all resources that support tags. You can use these tags to improve the tag creation and resource migration efficiency. CCE automatically creates system tags CCE-Cluster-ID={cluster-ID}, CCE-Cluster-Name={cluster-name}, and CCE-Namespace={namespace-name}. These tags cannot be modified. NOTE: After a dynamic PV of the EVS type is created, the resource tags cannot be updated on the CCE console. To update these resource tags, go to the EVS console. |
You can choose Storage in the navigation pane and view the created PVC and PV on the PVCs and PVs tabs, respectively.
Mount and use storage volumes. For details about the parameters, see Table 1. For other parameters, see Workloads.
Parameter | Description |
|---|---|
PVC | Select an existing EVS volume. An EVS volume can be mounted to only one workload. |
Mount Path | Enter a mount path, for example, /tmp. This parameter specifies a container path to which a data volume will be mounted. Do not mount the volume to a system directory such as / or /var/run. This may lead to container errors. Mount the volume to an empty directory. If the directory is not empty, ensure that there are no files that affect container startup. Otherwise, the files will be replaced, leading to container startup failures or workload creation failures. If a volume is mounted to a high-risk directory, use an account with minimum permissions to start the container. Otherwise, high-risk files on the host may be damaged. |
Subpath | Enter the subpath of the storage volume and mount a path in the storage volume to the container. In this way, different folders of the same storage volume can be used in a single pod. tmp, for example, indicates that data in the mount path of the container is stored in the tmp folder of the storage volume. If this parameter is left blank, the root path will be used by default. |
Permission |
|
In this example, the disk is mounted to the /data path of the container. The container data generated in this path is stored in the EVS disk.
A non-shared EVS disk can be attached to only one workload pod. If there are multiple pods, extra pods cannot start properly. Ensure that the number of workload pods is 1 if an EVS disk is attached.
After the workload is created, the data in the container mount directory will be persistently stored. Verify the storage by referring to Verifying Data Persistence.
apiVersion: v1kind: PersistentVolumeClaimmetadata:name: pvc-evs-autonamespace: defaultannotations:everest.io/disk-volume-type: SAS # EVS disk typeeverest.io/crypt-key-id: <your_key_id> # (Optional) Encryption key ID. Mandatory for an encrypted disk.everest.io/enterprise-project-id: <your_enterprise_project_id> # (Optional) Enterprise project IDeverest.io/disk-volume-tags: '{"key1":"value1","key2":"value2"}' # (Optional) Custom resource tagseverest.io/csi.volume-name-prefix: test # (Optional) Storage volume name prefix of the automatically-created underlying storagelabels:failure-domain.beta.kubernetes.io/region: <your_region> # Region of the node where the application is to be deployedfailure-domain.beta.kubernetes.io/zone: <your_zone> # AZ of the node where the application is to be deployedspec:accessModes:- ReadWriteOnce # The value must be ReadWriteOnce for EVS disks.resources:requests:storage: 10Gi # EVS disk capacity, ranging from 1 to 32768storageClassName: csi-disk # The StorageClass is EVS.
Parameter | Mandatory | Description |
|---|---|---|
failure-domain.beta.kubernetes.io/region | Yes | Region where the cluster is located. For details about its value, see Regions and Endpoints. |
failure-domain.beta.kubernetes.io/zone | Yes | AZ where the EVS volume is created. It must be the same as the AZ planned for the workload. For details about its value, see Regions and Endpoints. |
everest.io/disk-volume-type | Yes | EVS disk type. All letters are in uppercase. |
everest.io/crypt-key-id | No | This parameter is mandatory when an EVS disk is encrypted. Enter the encryption key ID selected during EVS disk creation. You can use a custom key or the default key named evs/default. To obtain a key ID, log in to the DEW console, locate the key to be encrypted, and copy the key ID. |
everest.io/enterprise-project-id | No | This parameter specifies the ID of the enterprise project where an EVS disk is created. It is applicable only to enterprise accounts with enterprise projects enabled. To obtain an enterprise project ID, log in to the EPS console, click the name of the target enterprise project, and copy the enterprise project ID. |
everest.io/disk-volume-tags | No | (Optional) This parameter is supported when the Everest version in the cluster is v2.1.39 or later. You can add resource tags to classify resources. You can create predefined tags on the TMS console. These tags are available to all resources that support tags. You can use these tags to improve the tag creation and resource migration efficiency. CCE automatically creates system tags CCE-Cluster-ID={cluster-ID}, CCE-Cluster-Name={cluster-name}, and CCE-Namespace={namespace-name}. These tags cannot be modified. |
everest.io/csi.volume-name-prefix | No | (Optional) This parameter is available only when the cluster version is v1.23.14-r0, v1.25.9-r0, v1.27.6-r0, v1.28.4-r0, or later, and Everest v2.4.15 or later is installed in the cluster. This parameter specifies the name of the underlying storage that is automatically created. The actual underlying storage name is in the format of "Storage volume name prefix + PVC UID". If this parameter is left blank, the default prefix pvc will be used. Enter 1 to 26 characters that cannot start or end with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed. For example, if the storage volume name prefix is set to test, the actual underlying storage name is test-{UID}. |
storage | Yes | Requested PVC capacity, in Gi. The value is an integer ranging from 1 to 32768. If storage is set to a decimal, the value will be rounded up for the EVS disk. For example, if storage is set to 10.1Gi, an 11-GiB EVS disk will be created. |
storageClassName | Yes | StorageClass name, which is csi-disk for an EVS disk. |
kubectl apply -f pvc-evs-auto.yaml
apiVersion: apps/v1kind: StatefulSetmetadata:name: web-evs-autonamespace: defaultspec:replicas: 1selector:matchLabels:app: web-evs-autoserviceName: web-evs-auto # Headless Service nametemplate:metadata:labels:app: web-evs-autospec:containers:- name: container-1image: nginx:latestvolumeMounts:- name: pvc-disk # Volume name, which must be the same as the volume name in the volumes fieldmountPath: /data # Location where the storage volume is mountedimagePullSecrets:- name: default-secretvolumes:- name: pvc-disk # Volume name, which is user-definedpersistentVolumeClaim:claimName: pvc-evs-auto # Name of the created PVC---apiVersion: v1kind: Servicemetadata:name: web-evs-auto # Headless Service namenamespace: defaultlabels:app: web-evs-autospec:selector:app: web-evs-autoclusterIP: Noneports:- name: web-evs-autotargetPort: 80nodePort: 0port: 80protocol: TCPtype: ClusterIP
kubectl apply -f web-evs-auto.yaml
After the workload is created, the data in the container mount directory will be persistently stored. Verify the storage by referring to Verifying Data Persistence.
kubectl get pod | grep web-evs-auto
Expected output:
kubectl exec web-evs-auto-0 -- df | grep data
Expected output:
/dev/sdc 10255636 36888 10202364 0% /data
kubectl exec web-evs-auto-0 -- ls /data
Expected output:
lost+found
kubectl exec web-evs-auto-0 -- touch /data/static
kubectl exec web-evs-auto-0 -- ls /data
Expected output:
lost+foundstatic
kubectl delete pod web-evs-auto-0
Expected output:
pod "web-evs-auto-0" deleted
kubectl exec web-evs-auto-0 -- ls /data
Expected output:
lost+foundstatic
The static file is retained, indicating that the data in the EVS volume can be stored persistently.
You can also perform the operations listed in Table 3.
Operation | Description | Procedure |
|---|---|---|
Expanding the capacity of an EVS disk | Quickly expand the capacity of a mounted EVS volume on the CCE console. |
|
Viewing events | View event names, event types, number of occurrences, Kubernetes events, first occurrence time, and last occurrence time of the PVC or PV. |
|
Viewing a YAML file | View, copy, or download the YAML file of a PVC or PV. |
|
Editing Reclaim Policy | Modify the reclaim policy of a PV. |
|
Synchronizing PVC capacity | When the underlying storage outgrows the PVC, resize the PVC capacity on the CCE console to match the new size. |
|