Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

(kubectl) Creating a PV from an Existing EVS Disk

Updated on 2025-02-18 GMT+08:00

Notes and Constraints

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

Procedure

  1. Log in to the EVS console, create an EVS disk, and record the volume ID, capacity, and disk type of the EVS disk.
  2. Use kubectl to connect to the cluster. For details, see Connecting to a Cluster Using kubectl.
  3. Create two YAML files for creating the PersistentVolume (PV) and PersistentVolumeClaim (PVC). Assume that the file names are pv-evs-example.yaml and pvc-evs-example.yaml.

    touch pv-evs-example.yaml pvc-evs-example.yaml

    Kubernetes Cluster Version

    Description

    YAML Example

    1.11.7 ≤ K8s version ≤ 1.13

    Clusters from v1.11.7 to v1.13

    Example YAML

    1.11 ≤ K8s version < 1.11.7

    Clusters from v1.11 to v1.11.7

    Example YAML

    K8s version = 1.9

    Clusters of v1.9

    Example YAML

    Clusters from v1.11.7 to v1.13

    • Example YAML file for the PV:
      apiVersion: v1 
      kind: PersistentVolume 
      metadata: 
        labels: 
          failure-domain.beta.kubernetes.io/region: ap-southeast-1
          failure-domain.beta.kubernetes.io/zone:  ap-southeast-1a
        annotations:
          pv.kubernetes.io/provisioned-by: flexvolume-huawei.com/fuxivol
        name: pv-evs-example 
      spec: 
        accessModes: 
        - ReadWriteOnce 
        capacity: 
          storage: 10Gi 
        claimRef:
          apiVersion: v1
          kind: PersistentVolumeClaim
          name: pvc-evs-example
          namespace: default
        flexVolume: 
          driver: huawei.com/fuxivol 
          fsType: ext4 
          options:
            disk-mode: SCSI
            fsType: ext4 
            volumeID: 0992dbda-6340-470e-a74e-4f0db288ed82 
        persistentVolumeReclaimPolicy: Delete 
        storageClassName: sas
      Table 1 Key parameters

      Parameter

      Description

      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

      EVS volume capacity in the unit of Gi.

      storageClassName

      EVS disk type. Supported values: High I/O (SAS) and Ultra-high I/O (SSD)

      driver

      Storage driver.

      For EVS disks, set this parameter to huawei.com/fuxivol.

      volumeID

      Volume ID of the EVS disk.

      To obtain the volume ID, log in to the CCE console, choose Resource Management > Storage, click the PVC name in the EVS tab page, and copy the PVC ID on the PVC details page.

      disk-mode

      Device type of the EVS disk. The value is VBD or SCSI.

      For CCE clusters earlier than v1.11.7, you do not need to set this field. The value defaults to VBD.

      This field is mandatory for CCE clusters from v1.11.7 to v1.13 that use Linux x86. As the EVS volumes dynamically provisioned by a PVC are created from SCSI EVS disks, you are advised to choose SCSI when manually creating volumes (static PVs). Volumes in the VBD mode can still be used after cluster upgrades.

      spec.claimRef.apiVersion

      The value is fixed at v1.

      spec.claimRef.kind

      The value is fixed at PersistentVolumeClaim.

      spec.claimRef.name

      PVC name. The value is the same as the name of the PVC created in the next step.

      spec.claimRef.namespace

      Namespace of the PVC. The value is the same as the namespace of the PVC created in the next step.

    • Example YAML file for the PVC:
      apiVersion: v1  
      kind: PersistentVolumeClaim  
      metadata:  
        annotations:  
          volume.beta.kubernetes.io/storage-class: sas
          volume.beta.kubernetes.io/storage-provisioner: flexvolume-huawei.com/fuxivol 
        labels: 
          failure-domain.beta.kubernetes.io/region: ap-southeast-1
          failure-domain.beta.kubernetes.io/zone: ap-southeast-1a     
        name: pvc-evs-example 
        namespace: default  
      spec:  
        accessModes:  
        - ReadWriteOnce  
        resources:  
          requests:  
            storage: 10Gi
        volumeName: pv-evs-example
      Table 2 Key parameters

      Parameter

      Description

      volume.beta.kubernetes.io/storage-class

      Storage class, which must be the same as that of the existing PV.

      volume.beta.kubernetes.io/storage-provisioner

      The field must be set to flexvolume-huawei.com/fuxivol.

      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

      Requested capacity in the PVC, in Gi.

      The value must be the same as the storage size of the existing PV.

      volumeName

      Name of the PV.

    Clusters from v1.11 to v1.11.7

    • Example YAML file for the PV:
      apiVersion: v1 
      kind: PersistentVolume 
      metadata: 
        labels: 
          failure-domain.beta.kubernetes.io/region: ap-southeast-1
          failure-domain.beta.kubernetes.io/zone:  
        name: pv-evs-example 
      spec: 
        accessModes: 
        - ReadWriteOnce
        capacity: 
          storage: 10Gi 
        flexVolume: 
          driver: huawei.com/fuxivol 
          fsType: ext4 
          options:
            fsType: ext4 
            volumeID: 0992dbda-6340-470e-a74e-4f0db288ed82 
        persistentVolumeReclaimPolicy: Delete 
        storageClassName: sas
      Table 3 Key parameters

      Parameter

      Description

      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

      EVS volume capacity in the unit of Gi.

      storageClassName

      EVS disk type. Supported values: High I/O (SAS) and Ultra-high I/O (SSD)

      driver

      Storage driver.

      For EVS disks, set this parameter to huawei.com/fuxivol.

      volumeID

      Volume ID of the EVS disk.

      To obtain the volume ID, log in to the CCE console, choose Resource Management > Storage, click the PVC name in the EVS tab page, and copy the PVC ID on the PVC details page.

      disk-mode

      Device type of the EVS disk. The value is VBD or SCSI.

      For CCE clusters earlier than v1.11.7, you do not need to set this field. The default value is VBD.

      This field is mandatory for CCE clusters from v1.11.7 to v1.13 that use Linux x86. As the EVS volumes dynamically provisioned by a PVC are created from SCSI EVS disks, you are advised to choose SCSI when manually creating volumes (static PVs). Volumes in the VBD mode can still be used after cluster upgrades.

    • Example YAML file for the PVC:
      apiVersion: v1  
      kind: PersistentVolumeClaim  
      metadata:  
        annotations:  
          volume.beta.kubernetes.io/storage-class: sas
          volume.beta.kubernetes.io/storage-provisioner: flexvolume-huawei.com/fuxivol 
        labels: 
          failure-domain.beta.kubernetes.io/region: ap-southeast-1
          failure-domain.beta.kubernetes.io/zone: ap-southeast-1a     
        name: pvc-evs-example 
        namespace: default  
      spec:  
        accessModes:  
        - ReadWriteOnce
        resources:  
          requests:  
            storage: 10Gi
        volumeName: pv-evs-example
      Table 4 Key parameters

      Parameter

      Description

      volume.beta.kubernetes.io/storage-class

      Storage class. The value can be sas or ssd. The value must be the same as that of the existing PV.

      volume.beta.kubernetes.io/storage-provisioner

      The field must be set to flexvolume-huawei.com/fuxivol.

      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

      Requested capacity in the PVC, in Gi.

      The value must be the same as the storage size of the existing PV.

      volumeName

      Name of the PV.

    Clusters of v1.9

    • Example YAML file for the PV:
      apiVersion: v1 
      kind: PersistentVolume 
      metadata: 
        labels: 
          failure-domain.beta.kubernetes.io/region: ap-southeast-1
          failure-domain.beta.kubernetes.io/zone:  
        name: pv-evs-example 
        namespace: default 
      spec: 
        accessModes: 
        - ReadWriteOnce
        capacity: 
          storage: 10Gi 
        flexVolume: 
          driver: huawei.com/fuxivol 
          fsType: ext4 
          options: 
            fsType: ext4 
            kubernetes.io/namespace: default 
            volumeID: 0992dbda-6340-470e-a74e-4f0db288ed82 
        persistentVolumeReclaimPolicy: Delete 
        storageClassName: sas
      Table 5 Key parameters

      Parameter

      Description

      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

      EVS volume capacity in the unit of Gi.

      storageClassName

      EVS disk type. Supported values: High I/O (SAS) and Ultra-high I/O (SSD)

      driver

      Storage driver.

      For EVS disks, set this parameter to huawei.com/fuxivol.

      volumeID

      Volume ID of the EVS disk.

      To obtain the volume ID, log in to the CCE console, choose Resource Management > Storage, click the PVC name in the EVS tab page, and copy the PVC ID on the PVC details page.

      disk-mode

      Device type of the EVS disk. The value is VBD or SCSI.

      For CCE clusters earlier than v1.11.7, you do not need to set this field. The default value is VBD.

      This field is mandatory for CCE clusters from v1.11.7 to v1.13 that use Linux x86. As the EVS volumes dynamically provisioned by a PVC are created from SCSI EVS disks, you are advised to choose SCSI when manually creating volumes (static PVs). Volumes in the VBD mode can still be used after cluster upgrades.

    • Example YAML file for the PVC:
      apiVersion: v1  
      kind: PersistentVolumeClaim  
      metadata:  
        annotations:  
          volume.beta.kubernetes.io/storage-class: sas
          volume.beta.kubernetes.io/storage-provisioner: flexvolume-huawei.com/fuxivol 
        labels: 
          failure-domain.beta.kubernetes.io/region: ap-southeast-1
          failure-domain.beta.kubernetes.io/zone: 
        name: pvc-evs-example 
        namespace: default  
      spec:  
        accessModes:  
        - ReadWriteOnce 
        resources:  
          requests:  
            storage: 10Gi
        volumeName: pv-evs-example
        volumeNamespace: default
      Table 6 Key parameters

      Parameter

      Description

      volume.beta.kubernetes.io/storage-class

      Storage class, which must be the same as that of the existing PV.

      volume.beta.kubernetes.io/storage-provisioner

      The field must be set to flexvolume-huawei.com/fuxivol.

      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

      Requested capacity in the PVC, in Gi.

      The value must be the same as the storage size of the existing PV.

      volumeName

      Name of the PV.

  4. Create a PV.

    kubectl create -f pv-evs-example.yaml

  5. Create a PVC.

    kubectl create -f pvc-evs-example.yaml

    After the operation is successful, choose Resource Management > Storage to view the created PVC. You can also view the EVS disk by name on the EVS console.

  6. (Optional) Add the metadata associated with the cluster to ensure that the EVS disk associated with the mounted static PV is not deleted when the node or cluster is deleted.

    CAUTION:

    If you skip this step in this example or when creating a static PV or PVC, ensure that the EVS disk associated with the static PV has been unbound from the node before you delete the node.

    1. Obtain the tenant token. For details, see Obtaining a User Token.
    2. Obtain the EVS access address EVS_ENDPOINT. For details, see Regions and Endpoints.

    3. Add the metadata associated with the cluster to the EVS disk backing the static PV.
      curl -X POST ${EVS_ENDPOINT}/v2/${project_id}/volumes/${volume_id}/metadata --insecure \
          -d '{"metadata":{"cluster_id": "${cluster_id}", "namespace": "${pvc_namespace}"}}' \
          -H 'Accept:application/json' -H 'Content-Type:application/json;charset=utf8' \
          -H 'X-Auth-Token:${TOKEN}'
      Table 7 Key parameters

      Parameter

      Description

      EVS_ENDPOINT

      EVS access address. Set this parameter to the value obtained in 6.b.

      project_id

      Project ID.

      volume_id

      ID of the associated EVS disk. Set this parameter to volume_id of the static PV to be created. You can also log in to the EVS console, click the name of the EVS disk to be imported, and obtain the ID from Summary on the disk details page, as shown in Figure 1.

      cluster_id

      ID of the cluster where the EVS PV is to be created. On the CCE console, choose Resource Management > Clusters. Click the name of the cluster to be associated. On the cluster details page, obtain the cluster ID, as shown in Figure 2.

      pvc_namespace

      Namespace where the PVC is to be bound.

      TOKEN

      User token. Set this parameter to the value obtained in 6.a.

      Figure 1 Obtaining the disk ID
      Figure 2 Obtaining the cluster ID

      For example, run the following commands:

      curl -X POST https://evs.ap-southeast-1.myhuaweicloud.com:443/v2/060576866680d5762f52c0150e726aa7/volumes/69c9619d-174c-4c41-837e-31b892604e14/metadata --insecure \
          -d '{"metadata":{"cluster_id": "71e8277e-80c7-11ea-925c-0255ac100442", "namespace": "default"}}' \
          -H 'Accept:application/json' -H 'Content-Type:application/json;charset=utf8' \
          -H 'X-Auth-Token:MIIPe******IsIm1ldG

      After the request is executed, run the following commands to check whether the EVS disk has been associated with the metadata of the cluster:

      curl -X GET ${EVS_ENDPOINT}/v2/${project_id}/volumes/${volume_id}/metadata --insecure \
          -H 'X-Auth-Token:${TOKEN}'

      For example, run the following commands:

      curl -X GET https://evs.ap-southeast-1.myhuaweicloud.com/v2/060576866680d5762f52c0150e726aa7/volumes/69c9619d-174c-4c41-837e-31b892604e14/metadata --insecure \
          -H 'X-Auth-Token:MIIPeAYJ***9t1c31ASaQ=='

      The command output displays the current metadata of the EVS disk.

      {
          "metadata": {
              "namespace": "default",
              "cluster_id": "71e8277e-80c7-11ea-925c-0255ac100442",
              "hw:passthrough": "true"
          }
      }

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback