[Deprecated] Create a persistent volume claim

更新时间:
复制 MD 格式

Create a persistent volume claim (PVC) in the ACK console to provision storage for your workloads. A PVC can be backed by a StorageClass (dynamic provisioning) or bound to an existing persistent volume (PV) (static binding).

Prerequisites

Before you begin, ensure that you have:

  • An ACK Serverless cluster. See ACK Serverless quick start.

  • A PV, if you plan to use static binding. This example uses a disk-based PV. See Disk volume overview.

    All PVs created in the ACK console have the alicloud-pvname label added automatically. PVs created outside the console must have this label added manually before they can be bound to a PVC.

Create a PVC

  1. Log on to the ACK console.

  2. In the left-side navigation pane, click Clusters.

  3. On the Clusters page, click the name of your cluster or click Details in the Actions column.

  4. In the left-side navigation pane of the cluster details page, choose Volumes > Persistent Volumes.

  5. In the upper-right corner of the Persistent Volume Claims page, click Create.

  6. In the Create PVC dialog box, configure the following parameters and click Create.

    Parameter Description
    PVC Type The storage type. Must match the type of the associated PV. Options: Cloud Disk, NAS, OSS.
    Name A name for the PVC.
    Allocation Mode How storage is provisioned. Select Use StorageClass for dynamic provisioning, Existing Volumes to bind to an existing PV, or Create Volume to create a new volume.
    Existing Storage Class Required when Allocation Mode is Use StorageClass. Click Select, find the StorageClass in the Select Storage Class dialog box, and click Select in the Actions column.
    Existing Volumes Required when Allocation Mode is Existing Volumes. Click Select PV, find the PV in the Select PV dialog box, and click Select in the Actions column.
    Capacity The storage capacity claimed by the PVC. Cannot exceed the total capacity of the associated PV.
    Access Mode Required when Allocation Mode is Use StorageClass. Default: ReadWriteOnce.

Verify the PVC

After creation, verify that the PVC is bound to a PV:


          kubectl get pvc <pvc-name>
        

A successfully bound PVC shows a Bound status:


          NAME         STATUS   VOLUME        CAPACITY   ACCESS MODES   STORAGECLASS   AGE
<pvc-name>   Bound    <pv-name>     20Gi       RWO                           5s
        

If the status is Pending, see Troubleshooting.

Troubleshooting

PV not visible in the Select PV dialog box

If an existing PV does not appear in the Select PV dialog box, the PV is missing the alicloud-pvname label.

To add the label:

  1. In the left-side navigation pane, choose Volumes > Persistent Volumes.

  2. Find the PV and click Manage Labels in the Actions column.

  3. Add a label with the key alicloud-pvname and the value set to the PV name. For disk-based PVs, the disk ID is used as the PV name by default.

tag

What's next

  • Mount the PVC to a pod by specifying it under volumes in your pod spec.

  • To manage PVs, choose Volumes > Persistent Volumes in the cluster details page.