ACK supports the use of various disk types as persistent volumes to meet the storage performance and cost requirements of different scenarios. You can change the disk type of cloud disk persistent volumes according to your needs. For instance, if you initially chose a standard SSD and later need higher IOPS, you can upgrade to an enhanced SSD (ESSD).
Prerequisites
-
The cluster version must be v1.20 or later and use the CSI storage plug-in.
-
The storage-operator widget must be installed in the cluster, with a version not lower than v1.26.1-50a1499-aliyun.
NoteThe storage-operator widget is typically installed by default. You can navigate to Managing the storage-operator widget.
in the left-side navigation pane on the cluster management page. Under the Storage tab, you can check the installation status and version information of the storage-operator widget. For more information, see -
If you have an ACK dedicated cluster, ensure that the WorkerRole and MasterRole have ModifyDiskSpec permission. For details on how to do this, see Create a custom policy.
NoteFor an ACK managed cluster, no authorization is needed.
Considerations
-
Disk type changes are not supported for ESSD AutoPL or basic disks.
The following upgrade scenarios are supported:
Current disk type
Upgradable to disk type
Ultra disk
Standard SSD, ESSD (PL0, PL1, PL2, or PL3), ESSD AutoPL
NoteYou cannot change ultra disks into standard SSDs in Hangzhou Zone D.
Standard SSD
ESSD (PL0, PL1, PL2, or PL3), ESSD AutoPL
ESSD PL0
ESSD (PL1, PL2, or PL3), ESSD AutoPL
ESSD PL1, PL2, PL3
Mutual upgrade between ESSD PL1, PL2, or PL3 performance levels, ESSD AutoPL
-
Some disk types may not be supported for mounting to certain ECS instance types. Ensure that the ECS instance type to which the current pod is scheduled supports the new disk type. For the compatibility between disk types and ECS instance types, see Instance family.
-
Disks used as persistent volumes must be pay-as-you-go. Billing will be based on the new disk type after the change.
For more information, see Limits.
Step 1: Configure the storage-operator widget to enable disk change
Connect to the cluster and modify the ConfigMap file of the storage-operator to enable the disk change feature. The default storage-controller in the storage-operator widget manages disk changes.
kubectl patch configmap/storage-operator \
-n kube-system \
--type merge \
-p '{"data":{"storage-controller":"{\"imageRep\":\"acs/storage-controller\",\"imageTag\":\"\",\"install\":\"true\",\"template\":\"/acs/templates/storage-controller/install.yaml\",\"type\":\"deployment\"}"}}'
Step 2: create a CR to implement disk change
To minimize business impact, perform disk changes during off-peak hours.
-
Create a StatefulSet for testing disk changes.
If you already have a StatefulSet with a mounted disk, you can skip this step.
-
Create a StatefulSet.yaml file with the content below.
This YAML creates a StatefulSet with a pod that mounts a 40 GiB ESSD PL1 disk.
apiVersion: apps/v1 kind: StatefulSet metadata: name: nginx-diskspec spec: selector: matchLabels: app: nginx replicas: 1 template: metadata: labels: app: nginx spec: containers: - name: nginx image: anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/nginx:1.14.1-8.6 ports: - containerPort: 80 volumeMounts: - name: pvc-disk mountPath: /data volumes: - name: pvc-disk persistentVolumeClaim: claimName: disk-pvc volumeClaimTemplates: - metadata: name: pvc-disk labels: app: nginx spec: accessModes: [ "ReadWriteOnce" ] storageClassName: "alicloud-disk-essd" resources: requests: storage: 40Gi
-
Deploy the StatefulSet.
kubectl create -f StatefulSet.yaml
-
Check the pod deployment status.
kubectl get pod -l app=nginx
Expected output:
NAME READY STATUS RESTARTS AGE nginx-diskspec-0 1/1 Running 0 4m4s
-
Examine the PVC information to retrieve the PV name.
kubectl get pvc pvc-disk-nginx-diskspec-0
The command output should resemble the following, where you can find the PV name in the
VOLUME
field asd-uf6ijdcp3aeoi82w****
.NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE pvc-disk-nginx-diskspec-0 Bound d-uf6ijdcp3aeoi82w**** 40Gi RWO alicloud-disk-essd <unset> 5m6s
-
-
Verify the disk type before making changes.
kubectl get pv d-uf6ijdcp3aeoi82w**** -o=jsonpath='{.metadata.labels}'
The command output should indicate
cloud_essd.PL1
as the current disk type.{"csi.alibabacloud.com/disktype":"cloud_essd.PL1"}
-
Create a CR to execute the disk change.
-
Prepare a cr.yaml file.
Below is an example YAML. Replace
pvNames
anddesiredDiskType
as needed.apiVersion: storage.alibabacloud.com/v1beta1 kind: ContainerStorageOperator metadata: name: default spec: operationType: DISKUPGRADE operationParams: pvNames: "d-uf6ijdcp3aeoi82w****" desiredDiskType: "cloud_auto"
Parameter
Description
operationType
The value is DISKUPGRADE, indicating that the current operation is a disk change.
pvNames
Declare the operation object (PV name). Multiple pvNames are supported, separated by commas (,) such as "disk-1***,disk-2***,disk-3***".
desiredDiskType
Declare the changed disk type. Please configure according to the supported upgrade types in Considerations.
cloud_auto
: ESSD AutoPLcloud_essd.PL0
: ESSD PL0cloud_essd.PL1
: ESSD PL1cloud_essd.PL2
: ESSD PL2cloud_essd.PL3
: ESSD PL3cloud_ssd
: Standard SSD
-
Deploy the CR.
kubectl create -f cr.yaml
-
-
Check the disk type after the change.
-
Monitor the CR status to ensure the disk change is successful.
kubectl get ContainerStorageOperator default -o yaml
In the
status
field of the output, confirm the status as shown below:status: message: [] process: 100% status: SUCCESS
-
Inspect the labels of the PV to verify the upgrade to ESSD AutoPL.
kubectl get pv d-uf6ijdcp3aeoi82w**** -o=jsonpath='{.metadata.labels}'
Expected output:
{"csi.alibabacloud.com/disktype":"cloud_auto"}
-