参考:https://blog.51cto.com/foxhound/2553979
条件:三台服务器要单独挂载一个空的磁盘
#ceph cluster
wget https://raw.githubusercontent.com/rook/rook/release-1.6/cluster/examples/kubernetes/ceph/crds.yaml
wget https://raw.githubusercontent.com/rook/rook/release-1.6/cluster/examples/kubernetes/ceph/common.yaml
wget https://raw.githubusercontent.com/rook/rook/release-1.6/cluster/examples/kubernetes/ceph/operator.yaml
wget https://raw.githubusercontent.com/rook/rook/release-1.6/cluster/examples/kubernetes/ceph/cluster.yaml
kubectl apply -f crds.yaml
kubectl apply -f common.yaml
kubectl apply -f operator.yaml
kubectl apply -f cluster.yaml
# rbd
mkdir rbd
cd rbd
wget https://raw.githubusercontent.com/rook/rook/release-1.6/cluster/examples/kubernetes/ceph/csi/rbd/storageclass.yaml
wget https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/csi/rbd/pvc.yaml
wget https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/csi/rbd/pod.yaml
kubectl apply -f storageclass.yaml
kubectl apply -f pvc.yaml
kubectl apply -f pod.yaml
#cephfs
mkdir cephfs
cd cephfs
wget https://raw.githubusercontent.com/rook/rook/release-1.6/cluster/examples/kubernetes/ceph/csi/cephfs/storageclass.yaml
wget https://raw.githubusercontent.com/rook/rook/v1.3.2/cluster/examples/kubernetes/ceph/filesystem.yaml
wget https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/csi/cephfs/pvc.yaml
wget https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/csi/cephfs/pod.yaml
kubectl apply -f storageclass.yaml
kubectl apply -f filesystem.yaml
kubectl apply -f pvc.yaml
kubectl apply -f pod.yaml
#通过nodeport暴露后台
wget https://raw.githubusercontent.com/rook/rook/v1.3.2/cluster/examples/kubernetes/ceph/dashboard-external-https.yaml
kubectl apply -f dashboard-external-https.yaml
管理后台密码获取:
kubectl -n rook-ceph get secret rook-ceph-dashboard-password -o yaml | grep "password:"| awk '{print$2}'|base64 -di
更多参考:https://github.com/rook/rook/tree/v1.6.0/cluster/examples/kubernetes/ceph