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

(kubectl) Creating a PV from an Existing OBS Bucket

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

Scenario

CCE allows you to use an existing OBS bucket to create a PersistentVolume (PV). You can create a PersistentVolumeClaim (PVC) and bind it to the PV.

Notes and Constraints

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

Procedure

  1. Log in to the OBS console, create an OBS bucket, and record the bucket name and storage class.
  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 PV and PVC. Assume that the file names are pv-obs-example.yaml and pvc-obs-example.yaml.

    touch pv-obs-example.yaml pvc-obs-example.yaml

    Kubernetes Cluster Version

    Description

    YAML Example

    1.11 ≤ K8s version ≤ 1.13

    Clusters from v1.11 to v1.13

    Example YAML

    K8s version = 1.9

    Clusters of v1.9

    Example YAML

    Clusters from v1.11 to v1.13

    • Example YAML file for the PV:
      apiVersion: v1 
      kind: PersistentVolume 
      metadata: 
        name: pv-obs-example 
        annotations:
          pv.kubernetes.io/provisioned-by: flexvolume-huawei.com/fuxiobs
      spec: 
        accessModes: 
        - ReadWriteMany 
        capacity: 
          storage: 1Gi 
        claimRef:
          apiVersion: v1
          kind: PersistentVolumeClaim
          name: pvc-obs-example
          namespace: default
        flexVolume: 
          driver: huawei.com/fuxiobs 
          fsType: obs 
          options: 
            fsType: obs 
            region: ap-southeast-1
            storage_class: STANDARD 
            volumeID: test-obs 
        persistentVolumeReclaimPolicy: Delete 
        storageClassName: obs-standard
      Table 1 Key parameters

      Parameter

      Description

      driver

      Storage driver used to mount the volume. Set the driver to huawei.com/fuxiobs for the OBS volume.

      storage_class

      Storage class, including STANDARD (standard bucket) and STANDARD_IA (infrequent access bucket).

      region

      Region where the cluster is located.

      volumeID

      OBS bucket name.

      To obtain the name, log in to the CCE console, choose Resource Management > Storage, click the PVC name in the OBS tab page, and copy the PV name on the PV Details tab page.

      storage

      Storage capacity, in Gi. The value is fixed at 1Gi.

      storageClassName

      Storage class supported by OBS, including obs-standard (standard bucket) and obs-standard-ia (infrequent access bucket).

      spec.claimRef.apiVersion

      The value is fixed at v1.

      spec.claimRef.kind

      The value is fixed at PersistentVolumeClaim.

      spec.claimRef.name

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

      spec.claimRef.namespace

      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: obs-standard
          volume.beta.kubernetes.io/storage-provisioner: flexvolume-huawei.com/fuxiobs
        name: pvc-obs-example
        namespace: default
      spec:
        accessModes:
        - ReadWriteMany
        resources:
          requests:
            storage: 1Gi
        volumeName: pv-obs-example
      Table 2 Key parameters

      Parameter

      Description

      volume.beta.kubernetes.io/storage-class

      Storage class supported by OBS, including obs-standard and obs-standard-ia.

      volume.beta.kubernetes.io/storage-provisioner

      Must be set to flexvolume-huawei.com/fuxiobs.

      volumeName

      Name of the PV.

      storage

      Storage capacity, in Gi. The value is fixed at 1Gi.

    Clusters of v1.9

    • Example YAML file for the PV:
      apiVersion: v1 
      kind: PersistentVolume 
      metadata: 
        name: pv-obs-example 
        namespace: default  
      spec: 
        accessModes: 
        - ReadWriteMany 
        capacity: 
          storage: 1Gi 
        flexVolume: 
          driver: huawei.com/fuxiobs 
          fsType: obs 
          options: 
            fsType: obs 
            kubernetes.io/namespace: default 
            region: ap-southeast-1
            storage_class: STANDARD 
            volumeID: test-obs 
        persistentVolumeReclaimPolicy: Delete 
        storageClassName: obs-standard
      Table 3 Key parameters

      Parameter

      Description

      driver

      Storage driver used to mount the volume. Set the driver to huawei.com/fuxiobs for the OBS volume.

      storage_class

      Storage class, including STANDARD (standard bucket) and STANDARD_IA (infrequent access bucket).

      region

      Region where the cluster is located.

      volumeID

      OBS bucket name.

      To obtain the name, log in to the CCE console, choose Resource Management > Storage, click the PVC name in the OBS tab page, and copy the PV name on the PV Details tab page.

      storage

      Storage capacity, in Gi. The value is fixed at 1Gi.

      storageClassName

      Storage class supported by OBS, including obs-standard (standard bucket) and obs-standard-ia (infrequent access bucket).

    • Example YAML file for the PVC:
      apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
        annotations:
          volume.beta.kubernetes.io/storage-class: obs-standard
          volume.beta.kubernetes.io/storage-provisioner: flexvolume-huawei.com/fuxiobs
        name: pvc-obs-example
        namespace: default
      spec:
        accessModes:
        - ReadWriteMany
        resources:
          requests:
            storage: 1Gi
        volumeName: pv-obs-example
        volumeNamespace: default
      Table 4 Key parameters

      Parameter

      Description

      volume.beta.kubernetes.io/storage-class

      Storage class supported by OBS, including obs-standard and obs-standard-ia.

      volume.beta.kubernetes.io/storage-provisioner

      Must be set to flexvolume-huawei.com/fuxiobs.

      volumeName

      Name of the PV.

      storage

      Storage capacity, in Gi. The value is fixed at 1Gi.

  4. Create a PV.

    kubectl create -f pv-obs-example.yaml

  5. Create a PVC.

    kubectl create -f pvc-obs-example.yaml

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