This topic describes how to use a static OSS volume in the console.

Prerequisites

You have created an OSS bucket. For more information, see Create buckets.
Note If a node and an OSS bucket are in the same region, you can use the internal endpoint of the OSS bucket when you mount it to the node.

Create a PV

  1. Log on to the Container Service console.
  2. In the left-side navigation pane, choose Clusters > Persistent Volumes to go to the PVs and PVCs page.
  3. On the Persistent Volumes tab, click Create in the upper-right corner.
    • PV Type: Supports three types of cloud storage: Cloud Disk, NAS, and OSS. In this example, select OSS.
    • Volume Name: The name of the PV. The name must be unique in the cluster. In this example, enter pv-oss.
    • Volume Plugin-in: Supports Flexvolume and CSI. In this example, select CSI.
    • Capacity: The capacity of the PV.
    • Access Mode: Default is ReadWriteMany.
    • AccessKey ID, AccessKey Secret: The AccessKey pair that is required to access the OSS bucket.
    • Optional Parameters: You can enter custom parameters in the format of -o *** -o ***.
    • Bucket ID.: The OSS bucket to be used. Click Select Bucket. In the dialog box that appears, choose the target bucket and click Select.
    • Endpoint: Select the endpoint of the OSS bucket.
      • If the bucket and the ECS node are in different regions, select Public Endpoint.
      • If the bucket and the ECS node are in the same region, select based on the network type of the cluster:
        • If the network is a VPC network, select VPC Endpoint.
        • If the network is a classic network, select Internal Endpoint.
    • Label: Attach labels to the PV.
  4. Click Create.

Create a PVC

  1. In the left-side navigation pane, choose Clusters > Persistent Volumes to go to the PVs and PVCs page.
  2. On the Persistent Volume Claims tab, click Create in the upper-right corner.
  3. In the Create PVC dialog box that appears, set the parameters.
    • Source: Use Existing PV and Use Storage Class are supported. In this example, select Use Existing PV.
    • PVC Type: Supports three types of cloud storage: Cloud Disk, NAS, and OSS. In this example, select OSS.
      Note This option appears only when you set the Source parameter to Use Existing PV.
    • Name: The name of the PVC. It must be unique in the cluster.
    • Allocation Mode: Select an existing volume.
      Note This option appears only when you set the Source parameter to Use Existing PV.
    • Existing Volumes: Click Select PV. Find the target PV and click Select in the Actions column.
    • Capacity: The capacity of the PVC.
      Note The capacity of the PVC cannot exceed the capacity of the PV that will be bound to this PVC.
    • Access Mode: Default is ReadWriteOnce.
      Note This option appears only when you set the Source parameter to Use Storage Class.
  4. Click Create.
    After the PVC is created, you can find it on the Persistent Volume Claims page. In the following figure, the csi-oss-pvc PVC is already bound with the PV created from the previous step.

Create an application

  1. Configure the container.
    This example describes how to set the volume parameter. For more information about other parameters, see Create deployments by using images.
    Local storage and cloud storage are supported.
    • Local Storage: Supports hostPath, ConfigMaps, Secrets, and EmptyDir. You need to mount the storage to a path in the container. For more information, see Volumes.
    • Cloud Storage: Supports cloud storage.
    In this example, specify the previously created PVC and mount it to the /tmp path in the container.
  2. Set the other parameters and click Create.
    After the application is created, you can use the OSS volume in the application.

You can also use a static OSS volume through command lines. For more information, see Provision static OSS volumes by using YAML files.