A PVC describes a workload's request for storage resources. This request consumes existing PVs in the cluster. If there is no PV available, underlying storage and PVs are dynamically created. When creating a PVC, you need to describe the attributes of the requested persistent storage, such as the size of the volume and the read/write permissions.
When a PVC is created, the system checks whether there is an available PV with the same configuration in the cluster. If yes, the PVC binds the available PV to the cluster. If no PV meets the matching conditions, the system dynamically creates a storage volume.
Description |
PVC Field |
PV Field |
Matching Logic |
---|---|---|---|
region |
pvc.metadata.labels (failure-domain.beta.kubernetes.io/region or topology.kubernetes.io/region) |
pv.metadata.labels (failure-domain.beta.kubernetes.io/region or topology.kubernetes.io/region) |
Defined or not defined at the same time. If defined, the settings must be consistent. |
zone |
pvc.metadata.labels (failure-domain.beta.kubernetes.io/zone or topology.kubernetes.io/zone) |
pv.metadata.labels (failure-domain.beta.kubernetes.io/zone or topology.kubernetes.io/zone) |
Defined or not defined at the same time. If defined, the settings must be consistent. |
EVS disk type |
pvc.metadata.annotations (everest.io/disk-volume-type) |
pv.spec.csi.volumeAttributes (everest.io/disk-volume-type) |
Defined or not defined at the same time. If defined, the settings must be consistent. |
Key ID |
pvc.metadata.annotations (everest.io/crypt-key-id) |
pv.spec.csi.volumeAttributes (everest.io/crypt-key-id) |
Defined or not defined at the same time. If defined, the settings must be consistent. |
accessMode |
accessMode |
accessMode |
The settings must be consistent. |
Storage class |
storageclass |
storageclass |
The settings must be consistent. |
PVs can be mounted to the host system only in the mode supported by underlying storage resources. For example, a file storage system can be read and written by multiple nodes, but an EVS disk can be read and written by only one node.
Storage Type |
ReadWriteOnce |
ReadWriteMany |
---|---|---|
EVS |
√ |
× |
SFS |
× |
√ |
OBS |
× |
√ |
SFS Turbo |
× |
√ |
StorageClass describes the storage class used in the cluster. You need to specify StorageClass to dynamically create PVs and underlying storage resources when creating a PVC.
Using the CCE Console
Using YAML
Example YAML for EVS
For details about the value of region, see Regions and Endpoints.
For details about the value of zone, see Regions and Endpoints.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-evs-auto-example namespace: default annotations: everest.io/disk-volume-type: SSD # EVS disk type. everest.io/crypt-key-id: 0992dbda-6340-470e-a74e-4f0db288ed82 # (Optional) Key ID. The key is used to encrypt EVS disks. labels: failure-domain.beta.kubernetes.io/region: eu-de failure-domain.beta.kubernetes.io/zone: eu-de-01 spec: accessModes: - ReadWriteOnce # The value must be ReadWriteOnce for EVS. resources: requests: storage: 10Gi # EVS disk capacity, ranging from 1 to 32768. storageClassName: csi-disk # The storage class type is EVS.
Example YAML for OBS:
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: obs-warm-provision-pvc namespace: default annotations: everest.io/obs-volume-type: STANDARD # OBS bucket type. Currently, standard (STANDARD) and infrequent access (WARM) are supported. csi.storage.k8s.io/fstype: obsfs # File type. obsfs indicates to create a parallel file system (recommended), and s3fs indicates to create an OBS bucket. spec: accessModes: - ReadWriteMany # The value must be ReadWriteMany for OBS. resources: requests: storage: 1Gi # This field is valid only for verification (fixed to 1, cannot be empty or 0). The value setting does not take effect for OBS buckets. storageClassName: csi-obs # The storage class type is OBS.
If a PV has been created, you can create a PVC to apply for PV resources.
Using the CCE Console
Using YAML
Example YAML for EVS
For details about the value of region, see Regions and Endpoints.
For details about the value of zone, see Regions and Endpoints.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-test namespace: default annotations: everest.io/disk-volume-type: SAS # EVS disk type. everest.io/crypt-key-id: fe0757de-104c-4b32-99c5-ee832b3bcaa3 # (Optional) Key ID. The key is used to encrypt EVS disks. volume.beta.kubernetes.io/storage-provisioner: everest-csi-provisioner labels: failure-domain.beta.kubernetes.io/region: eu-de failure-domain.beta.kubernetes.io/zone: eu-de-01 spec: accessModes: - ReadWriteOnce # The value must be ReadWriteOnce for EVS. resources: requests: storage: 10Gi storageClassName: csi-disk # Storage class name. The value is csi-disk for EVS. volumeName: cce-evs-test # PV name.
Example YAML for SFS:
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-sfs-test namespace: default annotations: volume.beta.kubernetes.io/storage-provisioner: everest-csi-provisioner spec: accessModes: - ReadWriteMany # The value must be ReadWriteMany for SFS. resources: requests: storage: 100Gi # Requested PVC capacity. storageClassName: csi-nas # Storage class name. The value is csi-nas for SFS. volumeName: cce-sfs-test # PV name.
Example YAML for OBS:
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-obs-test namespace: default annotations: everest.io/obs-volume-type: STANDARD # OBS bucket type. Currently, standard (STANDARD) and infrequent access (WARM) are supported. csi.storage.k8s.io/fstype: s3fs # File type. obsfs indicates to create a parallel file system (recommended), and s3fs indicates to create an OBS bucket. csi.storage.k8s.io/node-publish-secret-name: test-user csi.storage.k8s.io/node-publish-secret-namespace: default volume.beta.kubernetes.io/storage-provisioner: everest-csi-provisioner spec: accessModes: - ReadWriteMany # The value must be ReadWriteMany for OBS. resources: requests: storage: 1Gi # Requested PVC capacity. This field is valid only for verification (fixed to 1, cannot be empty or 0). The value setting does not take effect for OBS buckets. storageClassName: csi-obs # Storage class name. The value is csi-obs for OBS. volumeName: cce-obs-test # PV name.
Example YAML for SFS Turbo:
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-test namespace: default annotations: volume.beta.kubernetes.io/storage-provisioner: everest-csi-provisioner spec: accessModes: - ReadWriteMany # The value must be ReadWriteMany for SFS Turbo. resources: requests: storage: 100Gi # Requested PVC capacity. storageClassName: csi-sfsturbo # Storage class name. The value is csi-sfsturbo for SFS Turbo. volumeName: pv-sfsturbo-test # PV name.
The disk type, encryption setting, and disk mode of the created EVS PVC are consistent with those of the snapshot's source EVS disk.
Using the CCE Console
Using YAML
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-test namespace: default annotations: everest.io/disk-volume-type: SSD # EVS disk type, which must be the same as that of the source EVS disk of the snapshot. labels: failure-domain.beta.kubernetes.io/region: eu-de failure-domain.beta.kubernetes.io/zone: spec: accessModes: - ReadWriteOnce resources: requests: storage: '10' storageClassName: csi-disk dataSource: name: cce-disksnap-test # Snapshot name kind: VolumeSnapshot apiGroup: snapshot.storage.k8s.io