Cloud disk persistent volumes

更新时间:
复制 MD 格式

This topic describes disk volumes for Alibaba Cloud Container Service for Kubernetes (ACK) clusters. It covers their features, storage specifications, scenarios, limits, billing, and StorageClasses.

Features

Disks are block storage products offered by Alibaba Cloud for Elastic Compute Service (ECS) instances. They provide low latency, high performance, persistence, and high reliability. Disks use a distributed triplicate mechanism to ensure data reliability for ECS instances. Your data is automatically replicated within a zone to prevent data unavailability caused by hardware failures and to protect your services from component failures. For more information, see Disk overview.

  • ESSD AutoPL disks: You can configure the burst performance and provisioned performance of ESSD AutoPL disks based on your business requirements. ESSD AutoPL disks inherit the features and performance of enhanced SSDs (ESSDs) and provide the capability of decoupling disk capacity from disk performance. For more information, see ESSD AutoPL disks.

    We recommend that you use ESSD AutoPL disks in the following scenarios:

    • Scenarios for which ESSDs are suitable, such as large-sized online transactional processing (OLTP) databases, NoSQL databases, and Elasticsearch, Logstash, and Kibana (ELK) distributed logs.

    • Scenarios in which disk performance needs to be increased without extending disk capacity.

    • Scenarios in which business workloads significantly fluctuate and disks need to burst their performance when workload spikes occur.

  • ESSDs: ESSDs are based on the next-generation distributed block storage architecture and utilize 25 Gigabit Ethernet and remote direct memory access (RDMA). Each ESSD has low one-way latency and can deliver up to 1,000,000 random read/write IOPS. For more information, see ESSDs.

    We recommend that you use ESSDs for scenarios such as OLTP databases, NoSQL databases, and ELK distributed logs.

  • Standard SSDs: Standard SSDs are high-performance disks that provide consistent high random IOPS and high data reliability.

    We recommend that you use standard SSDs for scenarios such as I/O-intensive applications, small and medium-sized relational databases, and NoSQL databases.

  • ESSD Entry disks: ESSD Entry disks provide enterprise-grade features and data protection capabilities. We recommend that you use ESSD Entry disks as system disks or for scenarios such as development and testing.

    Note

    You can attach ESSD Entry disks only to instances of the u1 and e instance families. For information about the instance families, see the u1, universal instance family section in the "Universal instance families" topic and the e, economy instance family section in the "Shared instance families" topic.

  • Ultra disks: Ultra disks are cost-effective and provide medium random IOPS and high data reliability. We recommend that you use ultra disks as system disks for scenarios such as development and testing.

  • Basic disks: Basic disks are the previous generation of disks and are unavailable for purchase.

Scenarios

You can perform the following operations on disks as needed:

Business need

Reference

Store application data

Insufficient system or data disk capacity

For more information about how to expand a disk, see Disk expansion guide.

Persistent storage

For instructions, see:

Limits

  • Disks are non-shared storage. If multi-attach is not enabled for a disk, it can be mounted to only one pod at a time. For more information about multi-attach, see Use the multi-attach and reservation features of NVMe disks.

  • You can mount a disk only to a pod that resides in the same zone as the disk. Cross-zone mounting is not supported.

  • The ECS instance types to which a cloud disk can be attached depend on the category of the disk.

    When you mount a disk volume to a pod, make sure that the instance type of the ECS instance on which the pod runs supports the category of the disk that you want to mount. For more information about the matching rules between disk categories and ECS instance types, see Overview of instance families.

Billing

  • Only pay-as-you-go disks can be attached. Subscription disks are not supported. If you change the billing method of an ECS instance in a cluster from pay-as-you-go to subscription, do not change the billing method of the disk to subscription. Otherwise, the disk cannot be attached. You can purchase Storage Capacity Units (SCUs) to reduce disk costs. For more information about SCU billing, see Storage Capacity Unit (SCU).

  • You are not charged for StorageClass itself. However, disks that are automatically created by a StorageClass are billed as pay-as-you-go disks.

  • For information about disk billing items, see Elastic Block Storage billing. For information about disk pricing, see Detailed Pricing.

For more information, see Billing.

StorageClass

If the number of PersistentVolumeClaim (PVC) requests is large, many Persistent Volumes (PVs) must be created. This increases maintenance costs for operations and maintenance (O&M) engineers. To address this, Kubernetes provides a mechanism called StorageClass for automatic PV creation.

ACK provides the following default StorageClasses.

StorageClass

Description

Recommended scenario

alicloud-disk-efficiency

Ultra Disk

Single zone

alicloud-disk-ssd

SSD disk

Single zone

alicloud-disk-essd

ESSD disk

Single zone

alicloud-disk-topology-alltype

Provides a high availability (HA) option. ESSD disks are created with priority.

  • If ESSD disks are sold out or the current node does not support ESSD disks, the system attempts to create an SSD disk.

  • If SSD disks are sold out or the current node does not support SSD disks, the system attempts to create an ultra disk.

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: alicloud-disk-topology-alltype
    parameters:
      type: cloud_essd,cloud_ssd,cloud_efficiency
    provisioner: diskplugin.csi.alibabacloud.com
    reclaimPolicy: Delete
    allowVolumeExpansion: true
    volumeBindingMode: WaitForFirstConsumer

Multi-zone

When you create a disk using a StorageClass, the zone is selected based on the following rules:

  • If the StorageClass is configured with volumeBindingMode: WaitForFirstConsumer, the disk is created in the same zone as the pod that is associated with the PVC.

  • If the StorageClass is configured with volumeBindingMode: Immediate and the zoneId parameter is set to a single zone, the disk is created in that zone.

  • If the StorageClass is configured with volumeBindingMode: Immediate and the zoneId parameter is set to multiple zones, a zone is selected from the specified zones in a round-robin manner to create the disk.

Therefore, if you have a multi-zone cluster, use a StorageClass in WaitForFirstConsumer mode. You can create a StorageClass for the required disk type.

Default StorageClass

Kubernetes provides a Default StorageClass mechanism. You can use a Default StorageClass to create a data volume when a StorageClass is not specified in the PVC. For more information, see Default StorageClass.

Note
  • Because a Default StorageClass affects all PVCs, use it with caution in clusters that have different types of volumes. For example, you may want to create and bind a NAS-typed PVC and PV, but a disk PV is automatically created instead due to the Default StorageClass. For this reason, ACK clusters do not provide a Default StorageClass by default. If you want to use a Default StorageClass, refer to the following configuration.

  • A maximum of one Default StorageClass can be configured in a cluster. Otherwise, the feature will not work correctly.

  1. Run the following command to configure the StorageClass (alicloud-disk-ssd) as a Default StorageClass.

    kubectl patch storageclass alicloud-disk-ssd -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

    Query the StorageClasses in the cluster. You can see that (default) is added to the name of alicloud-disk-ssd.

    kubectl get sc

    Expected output:

    NAME                          PROVISIONER                       AGE
    alicloud-disk-ssd (default)   diskplugin.csi.alibabacloud.com   96m
  2. Use the Default StorageClass.

    Use the following template to create a PVC without a specified StorageClass.

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: disk-pvc
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 20Gi

    The cluster automatically creates a disk volume (PV) and uses the Default StorageClass (alicloud-disk-ssd).

    kubectl get pvc

    Expected output:

    NAME       STATUS   VOLUME                   CAPACITY   ACCESS MODES   STORAGECLASS        AGE
    disk-pvc   Bound    d-bp18pbai447qverm3ttq   20Gi       RWO            alicloud-disk-ssd   49s

You can run the following command to cancel the default storage class configuration.

kubectl patch storageclass alicloud-disk-ssd -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'