本文作者:丁辉
Helm部署Rook-Ceph
介绍
Rook-Ceph 是一个开源的云原生存储编排器,旨在简化 Ceph 存储集群在 Kubernetes 环境中的部署和管理。Rook-Ceph 将复杂的 Ceph 部署流程简化为易于在 Kubernetes 上实施的操作,使得 Ceph 集群能够无缝地与云原生环境集成。它利用 Kubernetes 的资源管理和调度能力,提供了一种高效且可扩展的方式来部署和管理存储解决方案。
基础准备
节点名称 | IP | 存储盘 |
---|---|---|
ceph-node-1 | 192.168.1.10 | /dev/sdb |
ceph-node-2 | 192.168.1.20 | /dev/sdb |
ceph-node-3 | 192.168.1.30 | /dev/sdb |
添加仓库
1 | helm repo add rook-release https://charts.rook.io/release |
部署Rook-Ceph-Operator
配置 values.yaml 文件
1
vi rook-ceph-operator-values.yaml
内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19# 配置镜像加速
csi:
cephcsi:
repository: quay.dockerproxy.com/cephcsi/cephcsi
registrar:
repository: registry.aliyuncs.com/google_containers/csi-node-driver-registrar
provisioner:
repository: registry.aliyuncs.com/google_containers/csi-provisioner
snapshotter:
repository: registry.aliyuncs.com/google_containers/csi-snapshotter
attacher:
repository: registry.aliyuncs.com/google_containers/csi-attacher
resizer:
repository: registry.aliyuncs.com/google_containers/csi-resizer部署
1
2
3helm install rook-ceph rook-release/rook-ceph \
--namespace rook-ceph --create-namespace \
-f rook-ceph-operator-values.yaml
部署 Rook-Ceph-Cluster
配置 values.yaml 文件
1
vi rook-ceph-cluster-values.yaml
内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49operatorNamespace: rook-ceph
toolbox:
enabled: true
cephClusterSpec:
storage:
useAllNodes: false # 关闭使用所有Node
useAllDevices: false # 关闭使用所有设备
# 指定存储节点和磁盘
nodes:
- name: "192.168.1.10"
devices:
- name: "sdb"
- name: "192.168.1.20"
devices:
- name: "sdb"
- name: "192.168.1.20"
devices:
- name: "sdb"
#- name: "192.168.1.100"
#deviceFilter: "^sd." # 过滤以 "sd." 开头的设备
#- name: "nvme0"
#config:
#osdsPerDevice: "5" # 创建多个 OSD
#- name: "/dev/disk/XXXX-XXXX" # 指定实际设备文件的路径
# 开启监控面板
dashboard:
enabled: true
ssl: false
# 配置调度策略
placement:
all:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: role
operator: In
values:
- storage-node
podAffinity:
podAntiAffinity:
topologySpreadConstraints:
tolerations:
- key: storage-node
operator: ExistsCeph节点添加标签
1
kubectl label nodes {ceph-node-1,ceph-node-2,ceph-node-3} role=storage-node
部署
1
2
3helm install rook-ceph-cluster rook-release/rook-ceph-cluster \
--namespace rook-ceph --create-namespace \
-f rook-ceph-cluster-values.yaml查看状态
1
kubectl -n rook-ceph exec -it $(kubectl get pod -l app=rook-ceph-tools -n rook-ceph | awk '{print $1}' | grep -v NAME) bash
进入容器后查看 ceph 状态
1
ceph -s
health: HEALTH_OK
查看密码登录 Dashboard
1
kubectl -n rook-ceph get secret rook-ceph-dashboard-password -o jsonpath="{['data']['password']}" | base64 --decode && echo
账户:admin
卸载
卸载 Rook-Ceph-Cluster
1
helm uninstall rook-ceph-cluster -n rook-ceph
卸载 Rook-Ceph-Operator
1
helm uninstall rook-ceph -n rook-ceph
删除 CRD 资源
1
2
3
4for CRD in $(kubectl get crd -n rook-ceph | awk '/ceph.rook.io/ {print $1}'); do
kubectl get -n rook-ceph "$CRD" -o name | \
xargs -I {} kubectl patch -n rook-ceph {} --type merge -p '{"metadata":{"finalizers": []}}'
done删除配置资源
1
2kubectl -n rook-ceph patch configmap rook-ceph-mon-endpoints --type merge -p '{"metadata":{"finalizers": []}}'
kubectl -n rook-ceph patch secrets rook-ceph-mon --type merge -p '{"metadata":{"finalizers": []}}'删除命名空间
1
kubectl delete ns rook-ceph
删除持久化目录
1
rm -rf /var/lib/rook
I'm so cute. Please give me money.
- 本文链接: https://blog.offends.cn/Kubernetes/Helm/Helm部署Rook-Ceph.html
- 版权声明: 本博客所有文章除特别声明外,均默认采用 CC BY-NC-SA 4.0 许可协议。