This is the multi-page printable view of this section. Click here to print.
Managing a StorageClass
1 - Querying a StorageClass
Run the following command to view the information about the created StorageClass.
kubectl get sc myscThe following is an example of the command output.
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE mysc csi.huawei.com Delete Immediate true 8s
2 - Modifying a StorageClass
Kubernetes allows only the allowVolumeExpansion field of a StorageClass to be modified. The modification method is as follows:
Run the following command to check whether the StorageClass can be expanded:
kubectl get sc myscIf the command output is displayed as the following example, the StorageClass mysc cannot be expanded:
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE mysc csi.huawei.com Delete Immediate false 8sRun the following command to enable capacity expansion for the StorageClass:
kubectl patch sc mysc --patch '{"allowVolumeExpansion":true}'Check the StorageClass again and ensure that the modification is successful.
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE mysc csi.huawei.com Delete Immediate true 8s
3 - Deleting a StorageClass
Run the following command to view the StorageClass:
kubectl get sc myscThe following is an example of the command output.
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE mysc csi.huawei.com Delete Immediate false 8sRun the following command to delete the StorageClass:
kubectl delete sc myscIf the following information is displayed, the deletion is successful:
storageclass.storage.k8s.io "mysc" deleted