取消默认存储

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

    设置默认存储

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

    1. [root@UR-20210425NAMA ~]# kubectl get storageclasses
    2. NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
    3. local-path rancher.io/local-path Delete WaitForFirstConsumer false 42d
    4. [root@UR-20210425NAMA ~]# kubectl patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
    5. storageclass.storage.k8s.io/local-path patched
    6. [root@UR-20210425NAMA ~]# kubectl get storageclasses
    7. NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
    8. local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 42d
    9. [root@UR-20210425NAMA ~]#