Using an Existing EVS Disk Through a Static PV
CCE Autopilot allows you to create a static PV using an existing EVS disk. After the PV is created, you can create a PVC and bind it to the PV. This mode applies to scenarios where the underlying storage is available or billed on a yearly/monthly basis.
Prerequisites
- You have created a cluster.
- You have created an EVS disk that meets the following requirements:
- The EVS disk cannot be a system disk, DSS disk, or shared disk.
- The EVS disk must be of the SCSI type (the default disk type is VBD when you purchase an EVS disk).
- The EVS disk must not be used by other resources.
- Encrypted EVS disks are not supported.
- The EVS disk must be in the default enterprise project or the enterprise project to which the cluster belongs.
- EVS disks that have been partitioned are not supported.
- Only ext4 EVS disks are supported.
- If you want to create a cluster by running commands, kubectl has been used to connect to the cluster. For details, see Connecting to a Cluster Using kubectl.
Constraints
- Not all regions support EVS volumes. View the regions where EVS volumes are supported on the console. You can also view Function Overview to learn about all regions where EVS volumes are supported.
- EVS disks cannot be used by multiple workloads, multiple pods of the same workload, or multiple tasks. If EVS disks are used when you create a Deployment, select only one pod for the Deployment.
- The cluster version must be v1.27.8-r0, v1.28.6-r0, or later. If the cluster version does not meet the requirements, you need to upgrade the cluster.
- No more than 10 EVS disks can be attached to each workload in a cluster. If more than 10 EVS disks are attached, the workload may run abnormally.
Creating a Volume Using an Existing EVS Disk
Create a storage volume using an existing EVS disk and mount it to a workload on the console or using kubectl.
- Log in to the CCE console and click the cluster name to access the cluster console.
- Statically create a PVC and PV.
- In the navigation pane on the left, choose Storage. Then click the PVCs tab. In the upper right corner, click Create PVC. In the displayed dialog box, configure the parameters.
Figure 1 Creating a PVC
Parameter
Description
PVC Type
In this example, select EVS.
PVC Name
Enter the PVC name, which must be unique in the same namespace.
Namespace
A namespace is a conceptual grouping of resources or objects. Each namespace provides isolation for data from other namespaces.
After a cluster is created, the default namespace is created by default. If there is no special requirement, select the default namespace.
Creation Method
- If underlying storage is available, create a PV or use an existing PV to statically create a PVC.
- If no underlying storage is available, select Dynamically provision. For details, see Using an EVS Disk Through a Dynamic PV.
In this example, select Create new to create a PV and PVC at the same time on the console.
PVa
Select an existing PV in the cluster. Create a PV in advance. For details, see "Creating a storage volume" in Related Operations.
You do not need to specify this parameter in this example.
EVSb
Click Select EVS. On the displayed page, select the EVS disk that meets your requirements and click OK.
PV Nameb
Enter the PV name, which must be unique in the same cluster.
Access Modeb
EVS volumes support only ReadWriteOnce, indicating that a storage volume can only be mounted to one node in read/write mode. For details, see Volume Access Modes.
Reclaim Policyb
You can select Delete or Retain to specify the reclaim policy of the underlying storage when the PVC is deleted. For details, see PV Reclaim Policy.
In this example, select Retain.
NOTE:
If multiple PVs use the same underlying storage volume, use Retain to avoid cascading deletion of underlying volumes.
NOTE:
a: The parameter is available when Creation Method is set to Use existing.
b: The parameter is available when Creation Method is set to Create new.
- Click Create to create a PVC and a PV.
In the navigation pane on the left, choose Storage. View the created PVC and PV on the PVCs and PVs tabs, respectively.
- In the navigation pane on the left, choose Storage. Then click the PVCs tab. In the upper right corner, click Create PVC. In the displayed dialog box, configure the parameters.
- Create a workload.
- In the navigation pane on the left, choose Workloads. Then click the StatefulSets tab.
- In the upper right corner, click Create Workload. On the displayed page, click Data Storage in the Container Settings area and click Add Volume to select PVC.
Mount and use storage volumes. For details about the parameters, see Table 1. For other parameters, see Creating a Workload.
In this example, the volume is mounted to the /data path of the container. The container data generated in this path is stored in the EVS disk.
NOTE:
A non-shared EVS disk can be mounted to only one pod. If there are multiple pods, extra pods cannot start normally. Ensure that the number of pods for running a workload is 1 if an EVS disk is mounted.
Figure 2 Parameters for mounting a storage volumeTable 1 Parameters for mounting a storage volume Parameter
Description
PVC
Select an existing EVS volume.
An EVS volume can only be mounted to one workload.
Mount Path
Enter a mount path, for example, /data.
This parameter indicates the container path that the volume will be mounted to. Do not mount the volume to a system directory such as / or /var/run. This may cause 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. If there are such files, they will be replaced, which will lead to a container startup or workload creation failure.NOTICE:If a volume is mounted to a high-risk directory, use an account with minimum permissions to start the container, or 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. data, for example, indicates that data in the mount path of the container is stored in the data directory of the storage volume. If this parameter is left blank, the root path is used by default.
Permission
- Read-only: You can only read the data in the mounted volume.
- Read-write: You can modify the volume mounted to the path. Newly written data will not be migrated if the container is migrated, which may cause data loss.
- Configure other parameters and click Create Workload.
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.
- Use kubectl to connect to the cluster.
- Create a PV. If a PV has been created in your cluster, skip this step. When using a YAML file to create a PV, do not use parameters that are not declared in the file, such as status, spec.claimRef, and annotation.everest.io/set-disk-metadata, or the PV may be abnormal.
- Create the pv-evs.yaml file.
apiVersion: v1 kind: PersistentVolume metadata: annotations: pv.kubernetes.io/provisioned-by: everest-csi-provisioner everest.io/reclaim-policy: retain-volume-only # (Optional) The underlying storage is retained when the PV is deleted. name: pv-evs # PV name labels: failure-domain.beta.kubernetes.io/region: <your_region> # Replace the region with the one where the cluster is located. failure-domain.beta.kubernetes.io/zone: <your_zone> # Replace the AZ with the one where the EVS disk is located. spec: accessModes: - ReadWriteOnce # Access mode, which must be ReadWriteOnce for EVS disks capacity: storage: 10Gi # EVS disk capacity, in GiB. The value ranges from 1 to 32768. csi: driver: disk.csi.everest.io # Dependent storage driver for the mounting fsType: ext4 # Set the file system type to ext4. volumeHandle: <your_volume_id> # Volume ID of the EVS disk volumeAttributes: everest.io/disk-mode: SCSI # Device type of the EVS disk. Only SCSI is supported. everest.io/disk-volume-type: SAS # EVS disk type storage.kubernetes.io/csiProvisionerIdentity: everest-csi-provisioner everest.io/enterprise-project-id: <your_project_id> # (Optional) Enterprise project ID. If an enterprise project is specified, use the same enterprise project when creating a PVC. Otherwise, the PVC cannot be bound to a PV. everest.io/disk-iops: '3000' # (Optional) IOPS of only a GPSSD2 EVS disk everest.io/disk-throughput: '125' # (Optional) Throughput of only a GPSSD2 EVS disk persistentVolumeReclaimPolicy: Delete # Reclaim policy storageClassName: csi-disk # StorageClass name. The value must be csi-disk for EVS disks.
Table 2 Key parameters Parameter
Mandatory
Description
everest.io/reclaim-policy: retain-volume-only
No
This field is optional. Only retain-volume-only is supported. This field takes effect when the reclaim policy is Delete.
If the reclaim policy is Delete and the value is retain-volume-only, the associated PV is deleted while the underlying storage volume is retained, when a PVC is deleted.
failure-domain.beta.kubernetes.io/region
Yes
Region of the cluster.
For details, see Regions and Endpoints.
failure-domain.beta.kubernetes.io/zone
Yes
AZ of the EVS disk.
You can obtain all supported AZs by querying the AZ list.
fsType
Yes
File system type. Currently, only ext4 is supported.
volumeHandle
Yes
Volume ID of the EVS disk.
To obtain a volume ID, log in to the Cloud Server Console. In the navigation pane on the left, choose Elastic Volume Service > Disks. Click the name of the target EVS disk to go to its details page. On the Summary tab page, click the copy button after ID.
everest.io/disk-volume-type
Yes
EVS disk type. All letters are in uppercase.- SAS: high I/O
- SSD: ultra-high I/O
- GPSSD: general-purpose SSD
- ESSD: extreme SSD
- GPSSD2: general-purpose SSD v2. You need to specify the everest.io/disk-iops and everest.io/disk-throughput annotations.
everest.io/disk-iops
No
Preconfigured IOPS, which is supported only by general-purpose SSD v2 EVS disks.- The IOPS of general-purpose SSD EVS v2 disks ranges from 3,000 to 128,000, and the maximum value is 500 times of the capacity (GiB).
If the IOPS of general-purpose SSD v2 disks is greater than 3000, extra IOPS will be billed. For details, see Price Calculator.
everest.io/disk-throughput
No
Preconfigured throughput, which is supported only by general-purpose SSD v2 EVS disks.
The value ranges from 125 MiB/s to 1,000 MiB/s. The maximum value is a quarter of IOPS.
If the throughput is greater than 125 MiB/s, extra throughput will be billed. For details, see Price Calculator.
everest.io/enterprise-project-id
No
Enterprise project ID of the EVS disk. This parameter is optional. If an enterprise project is specified, use the same enterprise project when creating a PVC, or the PVC cannot be bound to a PV.
To obtain an enterprise project ID, log in to the Cloud Server Console. In the navigation pane on the left, choose Elastic Volume Service > Disks. Click the name of the target EVS disk to go to its details page. On the Summary tab page, click the enterprise project in Management Information to access the enterprise project console. Copy the corresponding ID to obtain the ID of the enterprise project to which the EVS disk belongs.
persistentVolumeReclaimPolicy
Yes
The Delete and Retain reclaim policies are supported. For details, see PV Reclaim Policy. If high data security is required, select Retain to prevent data from being deleted by mistake.
Delete:
- If everest.io/reclaim-policy is not specified, both the PV and EVS disk will be deleted when a PVC is deleted.
- If everest.io/reclaim-policy is set to retain-volume-only, when a PVC is deleted, the PV will be deleted but the EVS disk will be retained.
Retain: When a PVC is deleted, both the PV and underlying storage are retained. You need to manually delete these resources. After the PVC is deleted, the PV is in the Released state and cannot be bound to a PVC again.
storageClassName
Yes
The StorageClass for EVS volumes is csi-disk.
- Run the following command to create a PV:
kubectl apply -f pv-evs.yaml
- Create the pv-evs.yaml file.
- Create a PVC.
- Create the pvc-evs.yaml file.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-evs namespace: default annotations: everest.io/disk-volume-type: SAS # EVS disk type everest.io/enterprise-project-id: <your_project_id> # (Optional) Enterprise project ID. If an enterprise project is specified, use the same enterprise project when creating a PVC. Otherwise, the PVC cannot be bound to a PV. everest.io/disk-iops: '3000' # (Optional) IOPS of only a GPSSD2 EVS disk everest.io/disk-throughput: '125' # (Optional) Throughput of only a GPSSD2 EVS disk labels: failure-domain.beta.kubernetes.io/region: <your_region> # Replace the region with the one where the cluster is located. failure-domain.beta.kubernetes.io/zone: <your_zone> # Replace the AZ with the one where the EVS disk is located. spec: accessModes: - ReadWriteOnce # The value must be ReadWriteOnce for EVS disks. resources: requests: storage: 10Gi # EVS disk capacity, ranging from 1 to 32768. The value must be the same as the storage size of the existing PV. storageClassName: csi-disk # The StorageClass of the EVS disk volumeName: pv-evs # PV name
Table 3 Key parameters Parameter
Mandatory
Description
failure-domain.beta.kubernetes.io/region
Yes
Region of the cluster.
For example, cn-east-3. For details, see Regions and Endpoints.
failure-domain.beta.kubernetes.io/zone
Yes
AZ of the EVS disk.
You can obtain all supported AZs by querying the AZ list.
storage
Yes
Requested capacity in the PVC, in Gi.
The value must be the same as the storage size of the existing PV in 2.a.
volumeName
Yes
PV name, which must be the same as the PV name in 2.a.
storageClassName
Yes
Storage class name, which must be the same as the storage class of the PV in 2.a.
The StorageClass for EVS volumes is csi-disk.
- Run the following command to create a PVC:
kubectl apply -f pvc-evs.yaml
- Create the pvc-evs.yaml file.
- Create a workload.
- Create a file named web-evs.yaml. In this example, the EVS volume is mounted to the /data path.
apiVersion: apps/v1 kind: StatefulSet metadata: name: web-evs namespace: default spec: replicas: 1 # The number of workload replicas that use the EVS volume must be 1. selector: matchLabels: app: web-evs serviceName: web-evs # Headless Service name template: metadata: labels: app: web-evs spec: containers: - name: container-1 image: nginx:latest volumeMounts: - name: pvc-disk # Volume name, which must be the same as the volume name in the volumes field. mountPath: /data #Location where the storage volume is mounted. imagePullSecrets: - name: default-secret volumes: - name: pvc-disk # Custom volume name persistentVolumeClaim: claimName: pvc-evs # Name of the created PVC. --- apiVersion: v1 kind: Service metadata: name: web-evs # Headless Service name namespace: default labels: app: web-evs spec: selector: app: web-evs clusterIP: None ports: - name: web-evs targetPort: 80 nodePort: 0 port: 80 protocol: TCP type: ClusterIP
- Run the following command to create a workload that the EVS volume is mounted to:
kubectl apply -f web-evs.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.
- Create a file named web-evs.yaml. In this example, the EVS volume is mounted to the /data path.
- Log in to the CCE console and click the cluster name to access the cluster console.
- Statically create a PVC and PV.
- In the navigation pane on the left, choose Storage. Then click the PVCs tab. In the upper right corner, click Create PVC. In the displayed dialog box, configure the parameters.
Figure 1 Creating a PVC
Parameter
Description
PVC Type
In this example, select EVS.
PVC Name
Enter the PVC name, which must be unique in the same namespace.
Namespace
A namespace is a conceptual grouping of resources or objects. Each namespace provides isolation for data from other namespaces.
After a cluster is created, the default namespace is created by default. If there is no special requirement, select the default namespace.
Creation Method
- If underlying storage is available, create a PV or use an existing PV to statically create a PVC.
- If no underlying storage is available, select Dynamically provision. For details, see Using an EVS Disk Through a Dynamic PV.
In this example, select Create new to create a PV and PVC at the same time on the console.
PVa
Select an existing PV in the cluster. Create a PV in advance. For details, see "Creating a storage volume" in Related Operations.
You do not need to specify this parameter in this example.
EVSb
Click Select EVS. On the displayed page, select the EVS disk that meets your requirements and click OK.
PV Nameb
Enter the PV name, which must be unique in the same cluster.
Access Modeb
EVS volumes support only ReadWriteOnce, indicating that a storage volume can only be mounted to one node in read/write mode. For details, see Volume Access Modes.
Reclaim Policyb
You can select Delete or Retain to specify the reclaim policy of the underlying storage when the PVC is deleted. For details, see PV Reclaim Policy.
In this example, select Retain.
NOTE:
If multiple PVs use the same underlying storage volume, use Retain to avoid cascading deletion of underlying volumes.
NOTE:
a: The parameter is available when Creation Method is set to Use existing.
b: The parameter is available when Creation Method is set to Create new.
- Click Create to create a PVC and a PV.
In the navigation pane on the left, choose Storage. View the created PVC and PV on the PVCs and PVs tabs, respectively.
- In the navigation pane on the left, choose Storage. Then click the PVCs tab. In the upper right corner, click Create PVC. In the displayed dialog box, configure the parameters.
- Create a workload.
- In the navigation pane on the left, choose Workloads. Then click the StatefulSets tab.
- In the upper right corner, click Create Workload. On the displayed page, click Data Storage in the Container Settings area and click Add Volume to select PVC.
Mount and use storage volumes. For details about the parameters, see Table 1. For other parameters, see Creating a Workload.
In this example, the volume is mounted to the /data path of the container. The container data generated in this path is stored in the EVS disk.
NOTE:
A non-shared EVS disk can be mounted to only one pod. If there are multiple pods, extra pods cannot start normally. Ensure that the number of pods for running a workload is 1 if an EVS disk is mounted.
Figure 2 Parameters for mounting a storage volumeTable 1 Parameters for mounting a storage volume Parameter
Description
PVC
Select an existing EVS volume.
An EVS volume can only be mounted to one workload.
Mount Path
Enter a mount path, for example, /data.
This parameter indicates the container path that the volume will be mounted to. Do not mount the volume to a system directory such as / or /var/run. This may cause 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. If there are such files, they will be replaced, which will lead to a container startup or workload creation failure.NOTICE:If a volume is mounted to a high-risk directory, use an account with minimum permissions to start the container, or 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. data, for example, indicates that data in the mount path of the container is stored in the data directory of the storage volume. If this parameter is left blank, the root path is used by default.
Permission
- Read-only: You can only read the data in the mounted volume.
- Read-write: You can modify the volume mounted to the path. Newly written data will not be migrated if the container is migrated, which may cause data loss.
- Configure other parameters and click Create Workload.
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.
- Use kubectl to connect to the cluster.
- Create a PV. If a PV has been created in your cluster, skip this step. When using a YAML file to create a PV, do not use parameters that are not declared in the file, such as status, spec.claimRef, and annotation.everest.io/set-disk-metadata, or the PV may be abnormal.
- Create the pv-evs.yaml file.
apiVersion: v1 kind: PersistentVolume metadata: annotations: pv.kubernetes.io/provisioned-by: everest-csi-provisioner everest.io/reclaim-policy: retain-volume-only # (Optional) The underlying storage is retained when the PV is deleted. name: pv-evs # PV name labels: failure-domain.beta.kubernetes.io/region: <your_region> # Replace the region with the one where the cluster is located. failure-domain.beta.kubernetes.io/zone: <your_zone> # Replace the AZ with the one where the EVS disk is located. spec: accessModes: - ReadWriteOnce # Access mode, which must be ReadWriteOnce for EVS disks capacity: storage: 10Gi # EVS disk capacity, in GiB. The value ranges from 1 to 32768. csi: driver: disk.csi.everest.io # Dependent storage driver for the mounting fsType: ext4 # Set the file system type to ext4. volumeHandle: <your_volume_id> # Volume ID of the EVS disk volumeAttributes: everest.io/disk-mode: SCSI # Device type of the EVS disk. Only SCSI is supported. everest.io/disk-volume-type: SAS # EVS disk type storage.kubernetes.io/csiProvisionerIdentity: everest-csi-provisioner everest.io/enterprise-project-id: <your_project_id> # (Optional) Enterprise project ID. If an enterprise project is specified, use the same enterprise project when creating a PVC. Otherwise, the PVC cannot be bound to a PV. everest.io/disk-iops: '3000' # (Optional) IOPS of only a GPSSD2 EVS disk everest.io/disk-throughput: '125' # (Optional) Throughput of only a GPSSD2 EVS disk persistentVolumeReclaimPolicy: Delete # Reclaim policy storageClassName: csi-disk # StorageClass name. The value must be csi-disk for EVS disks.
Table 2 Key parameters Parameter
Mandatory
Description
everest.io/reclaim-policy: retain-volume-only
No
This field is optional. Only retain-volume-only is supported. This field takes effect when the reclaim policy is Delete.
If the reclaim policy is Delete and the value is retain-volume-only, the associated PV is deleted while the underlying storage volume is retained, when a PVC is deleted.
failure-domain.beta.kubernetes.io/region
Yes
Region of the cluster.
For details, see Regions and Endpoints.
failure-domain.beta.kubernetes.io/zone
Yes
AZ of the EVS disk.
You can obtain all supported AZs by querying the AZ list.
fsType
Yes
File system type. Currently, only ext4 is supported.
volumeHandle
Yes
Volume ID of the EVS disk.
To obtain a volume ID, log in to the Cloud Server Console. In the navigation pane on the left, choose Elastic Volume Service > Disks. Click the name of the target EVS disk to go to its details page. On the Summary tab page, click the copy button after ID.
everest.io/disk-volume-type
Yes
EVS disk type. All letters are in uppercase.- SAS: high I/O
- SSD: ultra-high I/O
- GPSSD: general-purpose SSD
- ESSD: extreme SSD
- GPSSD2: general-purpose SSD v2. You need to specify the everest.io/disk-iops and everest.io/disk-throughput annotations.
everest.io/disk-iops
No
Preconfigured IOPS, which is supported only by general-purpose SSD v2 EVS disks.- The IOPS of general-purpose SSD EVS v2 disks ranges from 3,000 to 128,000, and the maximum value is 500 times of the capacity (GiB).
If the IOPS of general-purpose SSD v2 disks is greater than 3000, extra IOPS will be billed. For details, see Price Calculator.
everest.io/disk-throughput
No
Preconfigured throughput, which is supported only by general-purpose SSD v2 EVS disks.
The value ranges from 125 MiB/s to 1,000 MiB/s. The maximum value is a quarter of IOPS.
If the throughput is greater than 125 MiB/s, extra throughput will be billed. For details, see Price Calculator.
everest.io/enterprise-project-id
No
Enterprise project ID of the EVS disk. This parameter is optional. If an enterprise project is specified, use the same enterprise project when creating a PVC, or the PVC cannot be bound to a PV.
To obtain an enterprise project ID, log in to the Cloud Server Console. In the navigation pane on the left, choose Elastic Volume Service > Disks. Click the name of the target EVS disk to go to its details page. On the Summary tab page, click the enterprise project in Management Information to access the enterprise project console. Copy the corresponding ID to obtain the ID of the enterprise project to which the EVS disk belongs.
persistentVolumeReclaimPolicy
Yes
The Delete and Retain reclaim policies are supported. For details, see PV Reclaim Policy. If high data security is required, select Retain to prevent data from being deleted by mistake.
Delete:
- If everest.io/reclaim-policy is not specified, both the PV and EVS disk will be deleted when a PVC is deleted.
- If everest.io/reclaim-policy is set to retain-volume-only, when a PVC is deleted, the PV will be deleted but the EVS disk will be retained.
Retain: When a PVC is deleted, both the PV and underlying storage are retained. You need to manually delete these resources. After the PVC is deleted, the PV is in the Released state and cannot be bound to a PVC again.
storageClassName
Yes
The StorageClass for EVS volumes is csi-disk.
- Run the following command to create a PV:
kubectl apply -f pv-evs.yaml
- Create the pv-evs.yaml file.
- Create a PVC.
- Create the pvc-evs.yaml file.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-evs namespace: default annotations: everest.io/disk-volume-type: SAS # EVS disk type everest.io/enterprise-project-id: <your_project_id> # (Optional) Enterprise project ID. If an enterprise project is specified, use the same enterprise project when creating a PVC. Otherwise, the PVC cannot be bound to a PV. everest.io/disk-iops: '3000' # (Optional) IOPS of only a GPSSD2 EVS disk everest.io/disk-throughput: '125' # (Optional) Throughput of only a GPSSD2 EVS disk labels: failure-domain.beta.kubernetes.io/region: <your_region> # Replace the region with the one where the cluster is located. failure-domain.beta.kubernetes.io/zone: <your_zone> # Replace the AZ with the one where the EVS disk is located. spec: accessModes: - ReadWriteOnce # The value must be ReadWriteOnce for EVS disks. resources: requests: storage: 10Gi # EVS disk capacity, ranging from 1 to 32768. The value must be the same as the storage size of the existing PV. storageClassName: csi-disk # The StorageClass of the EVS disk volumeName: pv-evs # PV name
Table 3 Key parameters Parameter
Mandatory
Description
failure-domain.beta.kubernetes.io/region
Yes
Region of the cluster.
For example, cn-east-3. For details, see Regions and Endpoints.
failure-domain.beta.kubernetes.io/zone
Yes
AZ of the EVS disk.
You can obtain all supported AZs by querying the AZ list.
storage
Yes
Requested capacity in the PVC, in Gi.
The value must be the same as the storage size of the existing PV in 2.a.
volumeName
Yes
PV name, which must be the same as the PV name in 2.a.
storageClassName
Yes
Storage class name, which must be the same as the storage class of the PV in 2.a.
The StorageClass for EVS volumes is csi-disk.
- Run the following command to create a PVC:
kubectl apply -f pvc-evs.yaml
- Create the pvc-evs.yaml file.
- Create a workload.
- Create a file named web-evs.yaml. In this example, the EVS volume is mounted to the /data path.
apiVersion: apps/v1 kind: StatefulSet metadata: name: web-evs namespace: default spec: replicas: 1 # The number of workload replicas that use the EVS volume must be 1. selector: matchLabels: app: web-evs serviceName: web-evs # Headless Service name template: metadata: labels: app: web-evs spec: containers: - name: container-1 image: nginx:latest volumeMounts: - name: pvc-disk # Volume name, which must be the same as the volume name in the volumes field. mountPath: /data #Location where the storage volume is mounted. imagePullSecrets: - name: default-secret volumes: - name: pvc-disk # Custom volume name persistentVolumeClaim: claimName: pvc-evs # Name of the created PVC. --- apiVersion: v1 kind: Service metadata: name: web-evs # Headless Service name namespace: default labels: app: web-evs spec: selector: app: web-evs clusterIP: None ports: - name: web-evs targetPort: 80 nodePort: 0 port: 80 protocol: TCP type: ClusterIP
- Run the following command to create a workload that the EVS volume is mounted to:
kubectl apply -f web-evs.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.
- Create a file named web-evs.yaml. In this example, the EVS volume is mounted to the /data path.
Verifying Data Persistence
- View the deployed application and files stored in the EVS volume.
- Run the following command to view the pod:
kubectl get pod | grep web-evs
Expected output:web-evs-0 1/1 Running 0 38s
- Run the following command to verify that the EVS volume has been mounted to the /data path:
kubectl exec web-evs-0 -- df | grep data
Expected output:
/dev/sdc 10255636 36888 10202364 0% /data
- Run the following command to view the created file in the /data path:
kubectl exec web-evs-0 -- ls /data
Expected output:
lost+found
- Run the following command to view the pod:
- Run the following command to create a file named static in the /data path:
kubectl exec web-evs-0 -- touch /data/static
- Run the following command to view the created file in the /data path:
kubectl exec web-evs-0 -- ls /data
Expected output:
lost+found static
- Run the following command to delete the pod named web-evs-0:
kubectl delete pod web-evs-0
Expected output:
pod "web-evs-0" deleted
- The StatefulSet controller automatically creates a replica with the same name as the pod. Run the following command to check whether the file in the /data path has been modified:
kubectl exec web-evs-0 -- ls /data
Expected output:
lost+found static
The static file is retained, indicating that the data can be stored persistently.
Related Operations
Operation |
Description |
Procedure |
---|---|---|
Creating a storage volume (PV) |
You can create a PV on the CCE console. |
|
Expanding the capacity of an EVS volume |
Quickly expand the capacity of a mounted EVS volume on the CCE console. Only the capacity of pay-per-use EVS volumes can be expanded on the CCE console. To expand the capacity of yearly/monthly EVS volumes, click the volume name to go to the EVS console. |
|
Viewing events |
You can 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 |
You can view, copy, and download the YAML files of a PVC or PV. |
|
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot