You can mount disk volumes to Container Service for Kubernetes (ACK) clusters. This topic describes the features, disk specifications, use scenarios, usage notes, billing rules, and StorageClasses that are related to disk volumes.
Introduction
Alibaba Cloud disks are block-level data storage resources for Elastic Compute Service (ECS), which provide low latency, high performance, high durability, and high reliability. They use a distributed triplicate mechanism to ensure data reliability for ECS instances. If service disruptions occur within a zone due to hardware errors, data in the zone is automatically replicated to an unaffected disk in another zone to ensure data availability. For more information, see Disks.
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.
NoteYou 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.
Use scenarios
The following table describes the operations that you can perform on disks to meet your business requirements.
Business requirement | Reference |
Store application data | For more information, see the following topics: |
Resize a system disk or a data disk | For more information about disk expansion, see Overview. For more information, see the following topics: |
Persistent storage | For more information, see the following topics: |
Limits
Item | Description |
Disk category | You cannot mount or unmount subscription disks. Use pay-as-you-go disks or use disks together with storage capacity units (SCUs). |
Whether it can be shared | Alibaba Cloud disks cannot be shared. Each disk can be mounted to only one pod. |
Relationship with ECS instances |
|
Number of mounted disks and disk capacity |
|
Application type | Mount a disk to a StatefulSet. Note If you mount a disk to a Deployment, you must set the number of replicated pods to 1. In this case, you cannot configure an independent persistent volume (PV) for each pod or prioritize the node on which you want to mount or unmount a disk. If the pods of the Deployment are restarted, disk mounting may fail due to the update policy. We recommend that you do not mount a disk to a Deployment. |
Configure Application Parameters | If you configure the securityContext.fsgroup parameter in the application template, the kubelet performs the |
Billing
Only pay-as-you-go disks can be mounted. When you change the billing method of an ECS instance in your cluster from pay-as-you-go to subscription, you cannot change the billing method of the mounted disks to subscription. Otherwise, the disks cannot be mounted to the cluster. You can purchase SCUs to reduce the disk cost. For more information about SCUs, see SCUs.
StorageClasses are free of charge. Disks that are automatically created by using StorageClasses are billed based on a pay-as-you-go basis.
For information about the billable items of disks, see Block storage devices. For more information about the pricing of disks, visit the ECS product page.
For more information, see Billing.
StorageClasses
If you create a large number of persistent volume claims (PVCs), you must also create a large number of persistent volumes (PVs). This increases the workloads of O&M engineers. To solve this issue, Kubernetes provides the StorageClass object that you can use to enable automatic PV creation.
ACK clusters support the following types of StorageClass:
StorageClass | Description | Recommended scenario |
alicloud-disk-efficiency | Ultra disk | Single zone |
alicloud-disk-ssd | Standard SSD | Single zone |
alicloud-disk-essd | ESSD | Single zone |
alicloud-disk-topology-alltype | Provide a high-availability mode. In this mode, the system first attempts to create an ESSD.
| Multiple zones |
When you configure a StorageClass, the following rules determine the zone where the disk is created:
If you set volumeBindingMode: WaitForFirstConsumer in the StorageClass configuration, a disk is created in the zone where the pod is deployed.
If you set volumeBindingMode: Immediate and specify only one zone in the zoneId parameter of the StorageClass configuration, a disk is created in the specified zone.
If you set volumeBindingMode: Immediate and specify multiple zones in the zoneId parameter of the StorageClass configuration, the system attempts to create a disk in the specified zones in a round robin manner.
If your cluster is deployed across zones, we recommend that you specify volumeBindingMode: WaitForFirstConsumer in the StorageClass configuration. You can create a StorageClass based on the type of disk that is required.
Default StorageClass
Kubernetes provides the default StorageClass feature. If a PVC does not specify a StorageClass, the default StorageClass is used to provision a PV for the PVC. For more information, see Default StorageClass.
The default StorageClass takes effect on all PVCs. Proceed with caution if your cluster uses PVCs of different storage types. For example, you want to create a PV for a PVC that defines a NAS file system, but the default StorageClass may automatically create a disk PV instead. Therefore, ACK clusters do not provide default StorageClasses. If you want to configure a default StorageClass, perform the following steps.
You can configure only one default StorageClass for each cluster. If you configure more than one default StorageClass for a cluster, all default StorageClasses become invalid.
Run the following command to set alicloud-disk-ssd as the default StorageClass:
kubectl patch storageclass alicloud-disk-ssd -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
After the default StorageClass is configured, alicloud-disk-ssd is marked as (default).
kubectl get sc
Expected output:
NAME PROVISIONER AGE alicloud-disk-ssd (default) diskplugin.csi.alibabacloud.com 96m
Use the default StroageClass.
Use the following template to create a PVC without specifying a StorageClass:
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: disk-pvc spec: accessModes: - ReadWriteOnce resources: requests: storage: 20Gi
The cluster automatically creates a disk PV based on 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 also run the following command to disable the default StorageClass:
kubectl patch storageclass alicloud-disk-ssd -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'