https://docs.openebs.io/docs/next/ugcstor-csi.html
如果出现k8s.gcr.io/sig-storage 相关镜像拉取失败
wget https://openebs.github.io/charts/cstor-operator.yaml
sed -i "s#k8s.gcr.io/sig-storage#registry.aliyuncs.com/google_containers#g" cstor-operator.yaml
kubectl apply -f cstor-operator.yaml
查看块设备
kubectl get bd -n openebs
NAME NODENAME SIZE CLAIMSTATE STATUS AGE
blockdevice-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 openebs
NAME READY STATUS RESTARTS AGE
cspc-operator-654f545f85-dsqdp 1/1 Running 0 9m30s
cvc-operator-ccdff6f9f-dfwq7 1/1 Running 0 9m22s
openebs-cstor-admission-server-7f49d85966-kjjpv 1/1 Running 0 9m13s
openebs-cstor-csi-controller-0 6/6 Running 0 9m41s
openebs-cstor-csi-node-89hrl 2/2 Running 0 9m40s
openebs-cstor-csi-node-g8r87 2/2 Running 0 9m40s
openebs-ndm-d88gb 1/1 Running 0 8m17s
openebs-ndm-operator-5588776b5f-dgrvt 1/1 Running 0 8m17s
openebs-ndm-tf6fn
Nodes must have disks attached to them. To get the list of attached block devices, execute:
kubectl get bd -n openebs
NAME NODENAME SIZE CLAIMSTATE STATUS AGE
blockdevice-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-labels
NAME STATUS ROLES AGE VERSION LABELS
k8s-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-master
k8s-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/v1
kind: CStorPoolCluster
metadata:
name: cstor-disk-pool
namespace: openebs
spec:
pools:
- nodeSelector:
kubernetes.io/hostname: "k8s-node1"
dataRaidGroups:
- blockDevices:
- blockDeviceName: "blockdevice-e43d8a3af67696f0b94f501ba9c9d943"
poolConfig:
dataRaidGroupType: "stripe"
执行
kubectl apply -f cspc.yaml
cstorpoolcluster.cstor.openebs.io/cstor-disk-pool created
查看
kubectl get cspc -n openebs
NAME HEALTHYINSTANCES PROVISIONEDINSTANCES DESIREDINSTANCES AGE
cstor-disk-pool 1 1 27s
查看是否
kubectl get cspi -n openebs
NAME HOSTNAME FREE CAPACITY READONLY PROVISIONEDREPLICAS HEALTHYREPLICAS STATUS AGE
cstor-disk-pool-zznw k8s-node1 9630M 9630078500 false 0 0 ONLINE 20m
cs
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: cstor-csi-disk
provisioner: cstor.csi.openebs.io
allowVolumeExpansion: true
parameters:
cas-type: cstor
cstorPoolCluster: cstor-disk-pool
replicaCount: "1"