K8S开启默认的StroageClass
当集群中有多个storageclass时,一般需要指定一个默认的sc,这样可以自动的选择一个进行创建pvc。To enable dynamic storage provisioning based on storage class, the cluster administrator needs to enable the DefaultStorageClass admission contro.
当集群中有多个storageclass时,一般需要指定一个默认的sc,这样可以自动的选择一个进行创建pvc。
To enable dynamic storage provisioning based on storage class, the cluster administrator needs to enable the DefaultStorageClass admission controller on the API server. This can be done, for example, by ensuring that DefaultStorageClass is among the comma-delimited, ordered list of values for the --enable-admission-plugins flag of the API server component. For more information on API server command-line flags, check kube-apiserver documentation.
1、需要添加—DefaultStorageClass参数
--enable-admission-plugins=ServiceAccount,NamespaceLifecycle,NamespaceExists,LimitRanger,ResourceQuota,DefaultStorageClass
2、1.9版本之前是–admission-control来控制,之后的就需要改用 --enable-admission-plugins 来控制。所以也一起修改
基于此,我们调整如下
3、最后,我们需要手动打上default storageclass标签,
操作如下:
-[appuser@chenqiang-dev ~]$ kubectl get sc
NAME PROVISIONER AGE
csi-cephfs cephfs.csi.ceph.com 262d
csi-rbd rbd.csi.ceph.com 120d
-[appuser@chenqiang-dev ~]$ kubectl patch storageclass csi-rbd -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}’
-[appuser@chenqiang-dev ~]$ kubectl get sc
NAME PROVISIONER AGE
csi-cephfs cephfs.csi.ceph.com 262d
csi-rbd (default) rbd.csi.ceph.com 120d
更多推荐
所有评论(0)