其他分享
首页 > 其他分享> > k8s 使用ceph

k8s 使用ceph

作者:互联网

Ceph 块存储客户端通过内核模块或librbd库与 Ceph 集群通信。
块存储 与k8s
https://docs.ceph.com/en/latest/rbd/rbd-kubernetes/

试验步骤
创建存储池

ceph osd pool create kubernetes 32 32

为存储池开启rbd功能

ceph osd pool application enable kubernetes  rbd

初始化存储

rbd pool init -p kubernetes

由于试验环境一致存在pg同步因此临时把pg副本数量调整为1。生产环境不建议

ceph osd pool set kubernetes min_size 1
ceph osd pool set kubernetes size 1
ceph osd pool get kubernetes size

为pod挂载提供用户

ceph auth get-or-create client.kubernetes mon 'profile rbd' osd 'profile rbd pool=kubernetes' mgr 'profile rbd pool=kubernetes'

[client.kubernetes]
key = AQAO13di1Rd/AhAAH38UyAR2UhqzdyBP5lxk+g==

获取集群的fsid

ceph mon dump

epoch 1
fsid fbe5d74c-2d76-4103-9768-c9b766b7af1c
last_changed 2022-05-02 13:14:24.128643
created 2022-05-02 13:14:24.128643
min_mon_release 14 (nautilus)
0: [v2:10.4.7.31:3300/0,v1:10.4.7.31:6789/0] mon.ceph-mon2
dumped monmap epoch 1

提前准备好镜像,如果你的网络可以这一步可以跳过

docker pull quay.io/k8scsi/csi-provisioner:canary
docker tag quay.io/k8scsi/csi-provisioner:canary gcr.io/k8s-staging-sig-storage/csi-provisioner:canary

docker pull antidebug/csi-snapshotter:v5.0.0
docker tag antidebug/csi-snapshotter:v5.0.0 registry.k8s.io/sig-storage/csi-snapshotter:v5.0.1

docker pull dyrnq/csi-attacher:v3.4.0
docker tag dyrnq/csi-attacher:v3.4.0 registry.k8s.io/sig-storage/csi-attacher:v3.4.0

docker pull objectscale/csi-resizer:v1.4.0
docker tag objectscale/csi-resizer:v1.4.0 registry.k8s.io/sig-storage/csi-resizer:v1.4.0

docker pull dyrnq/csi-node-driver-registrar:v2.4.0
docker tag dyrnq/csi-node-driver-registrar:v2.4.0 registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.4.0

docker pull quay.io/cephcsi/cephcsi:canary
docker pull quay.io/cephcsi/cephcsi:canary

kubectl apply -f https://gitee.com/mingtian66/k8s/raw/master/存储/ceph-config.yml
kubectl apply -f https://gitee.com/mingtian66/k8s/raw/master/存储/ceph-csi-config.yml
kubectl apply -f https://gitee.com/mingtian66/k8s/raw/master/存储/ceph-csi-encryption-kms-config.yml
kubectl apply -f https://gitee.com/mingtian66/k8s/raw/master/存储/csi-rbd-sc.yml
hkubectl apply -f https://gitee.com/mingtian66/k8s/raw/master/存储/csi-rbd-secret.yml
test-pod.yml
kubectl apply -f https://raw.githubusercontent.com/ceph/ceph-csi/master/deploy/rbd/kubernetes/csi-provisioner-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/ceph/ceph-csi/master/deploy/rbd/kubernetes/csi-nodeplugin-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/ceph/ceph-csi/master/deploy/rbd/kubernetes/csi-rbdplugin-provisioner.yaml
kubectl apply -f https://raw.githubusercontent.com/ceph/ceph-csi/master/deploy/rbd/kubernetes/csi-rbdplugin.yaml

标签:rbd,csi,kubernetes,ceph,使用,docker,k8s
来源: https://www.cnblogs.com/wangend/p/16268526.html