自建的kubernetes集群中创建local pv时并不能自动创建,为了解决这个问题可以使用provisioner(卷插件机制),选在openebs。
官方github:
https://github.com/openebs/openebs
kubectl apply -f https://openebs.github.io/charts/openebs-operator.yaml
查看openebs的组件:
kubectl get all -n openebs
查看下sc,openebs创建pv是通过sc来进行:
将openebs-hostpath设置为default sc,这样当有local pv的需求时,便会自动通过default sc自动创建对应的local pv并绑定到对应的pvc上。
设置openebs-hostpath为default sc:
kubectl patch storageclass openebs-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
执行并验证:
完毕。