This topic describes different types of StorageClass for serverless Kubernetes (ASK) clusters. This topic also describes how to choose proper StorageClass types to meet your business requirements and how to configure a default StorageClass.

StorageClass

The following types of StorageClasses are supported by ASK clusters.
  • alicloud-disk-efficiency: ultra disk.
  • alicloud-disk-ssd: standard SSD.
  • alicloud-disk-essd: ESSD.
  • alicloud-disk-available: a high-availability mode. In this mode, the system first attempts to create a standard SSD. If SSD resources are exhausted, the system attempts to create an ultra disk.
    Notice For alicloud-csi-provisioner earlier than V1.14.8.39-0d749258-aliyun, the system attempts to create a disk in the order of enhanced SSD, standard SSD, and ultra disk.

You can use the preceding types of StorageClasses at the same time in a single zone.

If you specify volumeBindingMode: Immediate and specify only one zone ID in the zoneId parameter of the StorageClass configurations, a disk is created in the specified zone.

Default StorageClass

Kubernetes provides the default StorageClass feature. If no StorageClass is specified for a persistent volume claim (PVC), the default StorageClass is used to provision a persistent volume (PV) for the PVC. For more information, see Default StorageClass.

Note
  • The default StorageClass takes effect on all PVCs. Proceed with caution if your cluster uses PVCs of different storage types. For example, the default StorageClass may create a disk PV for a PVC that defines an Apsara File Storage NAS (NAS) file system. To avoid such situations, ASK clusters do not support the default StorageClass feature. 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.
  1. Configure the default StorageClass.
    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

    The following result is returned:

    NAME                          PROVISIONER                       AGE
    alicloud-disk-ssd (default)   diskplugin.csi.alibabacloud.com   96m
  2. Use the default StroageClass.
    1. 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

      The following result is returned:

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

What to do next

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"}}}'