https://docs.openebs.io/docs/next/ugcstor-csi.html
如果出现k8s.gcr.io/sig-storage 相关镜像拉取失败
wget https://openebs.github.io/charts/cstor-operator.yamlsed -i "s#k8s.gcr.io/sig-storage#registry.aliyuncs.com/google_containers#g" cstor-operator.yamlkubectl apply -f cstor-operator.yaml
查看块设备
kubectl get bd -n openebsNAME NODENAME SIZE CLAIMSTATE STATUS AGEblockdevice-e43d8a3af67696f0b94f501ba9c9d943 k8s-node1 10736352768 Unclaimed Active 3m35s
All the NDM cStor operator pods must be in a running state. To get the status of the pods execute:\
kubectl get pod -n openebs
输出结果
# kubectl get pod -n openebsNAME READY STATUS RESTARTS AGEcspc-operator-654f545f85-dsqdp 1/1 Running 0 9m30scvc-operator-ccdff6f9f-dfwq7 1/1 Running 0 9m22sopenebs-cstor-admission-server-7f49d85966-kjjpv 1/1 Running 0 9m13sopenebs-cstor-csi-controller-0 6/6 Running 0 9m41sopenebs-cstor-csi-node-89hrl 2/2 Running 0 9m40sopenebs-cstor-csi-node-g8r87 2/2 Running 0 9m40sopenebs-ndm-d88gb 1/1 Running 0 8m17sopenebs-ndm-operator-5588776b5f-dgrvt 1/1 Running 0 8m17sopenebs-ndm-tf6fn
Nodes must have disks attached to them. To get the list of attached block devices, execute:
kubectl get bd -n openebsNAME NODENAME SIZE CLAIMSTATE STATUS AGEblockdevice-e43d8a3af67696f0b94f501ba9c9d943 k8s-node1 10736352768 Unclaimed Active 9m37s
Creating a CStorPoolCluster:
- Get all the node labels present in the cluster with the following command, these node labels will be required to modify the CSPC yaml.
Modify the CSPC yaml to use the worker nodes. Use the value from labels kubernetes.io/hostname=< node_name >. This label value and node name could be different in some platforms. In this case, the label values and node names are: kubernetes.io/hostname:”worker-node-1”, kubernetes.io/hostname: “worker-node-2” and kubernetes.io/hostname: “worker-node-3”.# kubectl get node --show-labelsNAME STATUS ROLES AGE VERSION LABELSk8s-master Ready master 22h v1.19.12 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master,kubernetes.io/os=linux,node-role.kubernetes.io/master=,topology.cstor.openebs.io/nodeName=k8s-masterk8s-node1 Ready <none> 22h v1.19.12 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-node1,kubernetes.io/os=linux,topology.cstor.openebs.io/nodeName=k8s-node1
获取kubernetes.io/hostname: 也是就是hostname
vim
apiVersion: cstor.openebs.io/v1kind: CStorPoolClustermetadata:name: cstor-disk-poolnamespace: openebsspec:pools:- nodeSelector:kubernetes.io/hostname: "k8s-node1"dataRaidGroups:- blockDevices:- blockDeviceName: "blockdevice-e43d8a3af67696f0b94f501ba9c9d943"poolConfig:dataRaidGroupType: "stripe"
执行
kubectl apply -f cspc.yamlcstorpoolcluster.cstor.openebs.io/cstor-disk-pool created
查看
kubectl get cspc -n openebsNAME HEALTHYINSTANCES PROVISIONEDINSTANCES DESIREDINSTANCES AGEcstor-disk-pool 1 1 27s
查看是否
kubectl get cspi -n openebsNAME HOSTNAME FREE CAPACITY READONLY PROVISIONEDREPLICAS HEALTHYREPLICAS STATUS AGEcstor-disk-pool-zznw k8s-node1 9630M 9630078500 false 0 0 ONLINE 20m
cs
kind: StorageClassapiVersion: storage.k8s.io/v1metadata:name: cstor-csi-diskprovisioner: cstor.csi.openebs.ioallowVolumeExpansion: trueparameters:cas-type: cstorcstorPoolCluster: cstor-disk-poolreplicaCount: "1"
