简介

https://www.rook.io
https://github.com/rook/rook

ROOK - 图1
https://www.rook.io/docs/rook/v1.6/ceph-storage.html

rook 架构

ROOK - 图2

基于Rook构建Ceph云原生存储.pdf

升级内核

  1. yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm -y
  2. yum remove kernel-tools-libs.x86_64 kernel-tools.x86_64 -y
  3. yum --disablerepo=* --enablerepo=elrepo-kernel install kernel-ml-tools.x86_64 -y
  4. yum --disablerepo=* --enablerepo=elrepo-kernel install kernel-ml.x86_64 -y
  5. grub2-set-default 0
  6. reboot

加载 rbd模块

  1. modprobe rbd
  2. cat > /etc/rc.sysinit << EOF
  3. #!/bin/bash
  4. for file in /etc/sysconfig/modules/*.modules
  5. do
  6. [ -x \$file ] && \$file
  7. done
  8. EOF
  9. cat > /etc/sysconfig/modules/rbd.modules << EOF
  10. modprobe rbd
  11. EOF
  12. chmod 755 /etc/sysconfig/modules/rbd.modules
  13. lsmod |grep rbd

克隆源码

  1. [root@master home]# git clone https://github.com.cnpmjs.org/rook/rook.git
  2. Cloning into 'rook'...
  3. remote: Enumerating objects: 77401, done.
  4. remote: Counting objects: 100% (454/454), done.
  5. remote: Compressing objects: 100% (248/248), done.
  6. remote: Total 77401 (delta 218), reused 345 (delta 186), pack-reused 76947
  7. Receiving objects: 100% (77401/77401), 41.21 MiB | 6.56 MiB/s, done.
  8. Resolving deltas: 100% (53869/53869), done.
  9. [root@master home]#
  1. [root@master rook]# pwd
  2. /home/rook
  3. [root@master rook]# ls -l
  4. total 360
  5. -rw-r----- 1 root root 4844 May 5 18:39 ADOPTERS.md
  6. drwxr-x--- 6 root root 104 May 5 18:39 build
  7. drwxr-x--- 5 root root 47 May 5 18:39 cluster
  8. drwxr-x--- 4 root root 34 May 5 18:39 cmd
  9. -rw-r----- 1 root root 138 May 5 18:39 CODE_OF_CONDUCT.md
  10. -rw-r----- 1 root root 846 May 5 18:39 CODE-OWNERS
  11. -rw-r----- 1 root root 8475 May 5 18:39 CONTRIBUTING.md
  12. -rw-r----- 1 root root 1422 May 5 18:39 DCO
  13. drwxr-x--- 6 root root 103 May 5 18:39 design
  14. drwxr-x--- 3 root root 4096 May 5 18:39 Documentation
  15. -rw-r----- 1 root root 3970 May 5 18:39 go.mod
  16. -rw-r----- 1 root root 232761 May 5 18:39 go.sum
  17. -rw-r----- 1 root root 7957 May 5 18:39 GOVERNANCE.md
  18. drwxr-x--- 6 root root 91 May 5 18:39 images
  19. -rw-r----- 1 root root 8248 May 5 18:39 INSTALL.md
  20. -rw-r----- 1 root root 13380 May 5 18:39 Jenkinsfile
  21. -rw-r----- 1 root root 11368 May 5 18:39 LICENSE
  22. -rw-r----- 1 root root 5965 May 5 18:39 Makefile
  23. -rw-r----- 1 root root 2611 May 5 18:39 OWNERS.md
  24. -rw-r----- 1 root root 131 May 5 18:39 PendingReleaseNotes.md
  25. drwxr-x--- 9 root root 105 May 5 18:39 pkg
  26. -rw-r----- 1 root root 11019 May 5 18:39 README.md
  27. -rw-r----- 1 root root 3192 May 5 18:39 ROADMAP.md
  28. -rw-r----- 1 root root 11049 May 5 18:39 SECURITY.md
  29. drwxr-x--- 7 root root 125 May 5 18:39 tests
  30. [root@master rook]#

切换到kubernetes目录

  1. [root@master kubernetes]# ls -l
  2. total 16
  3. drwxr-x--- 2 root root 47 May 5 18:39 cassandra
  4. drwxr-x--- 7 root root 4096 May 5 18:39 ceph
  5. -rw-r----- 1 root root 1205 May 5 18:39 mysql.yaml
  6. drwxr-x--- 2 root root 269 May 5 18:39 nfs
  7. -rw-r----- 1 root root 129 May 5 18:39 README.md
  8. -rw-r----- 1 root root 1303 May 5 18:39 wordpress.yaml
  9. [root@master kubernetes]#
  1. [root@master ceph]# ls
  2. ceph-client.yaml dashboard-external-https.yaml object-bucket-claim-delete.yaml pool-test.yaml
  3. cluster-external-management.yaml dashboard-external-http.yaml object-bucket-claim-retain.yaml pool.yaml
  4. cluster-external.yaml dashboard-ingress-https.yaml object-ec.yaml pre-k8s-1.16
  5. cluster-on-pvc.yaml dashboard-loadbalancer.yaml object-external.yaml rbdmirror.yaml
  6. cluster-stretched.yaml direct-mount.yaml object-multisite-pull-realm.yaml rgw-external.yaml
  7. cluster-test.yaml filesystem-ec.yaml object-multisite.yaml scc.yaml
  8. cluster.yaml filesystem-mirror.yaml object-openshift.yaml storageclass-bucket-delete.yaml
  9. common-external.yaml filesystem-test.yaml object-test.yaml storageclass-bucket-retain.yaml
  10. common-second-cluster.yaml filesystem.yaml object-user.yaml test-data
  11. common.yaml flex object.yaml toolbox-job.yaml
  12. crds.yaml import-external-cluster.sh operator-openshift.yaml toolbox.yaml
  13. create-external-cluster-resources.py monitoring operator.yaml
  14. create-external-cluster-resources.sh nfs-test.yaml osd-purge.yaml
  15. csi nfs.yaml pool-ec.yaml
  16. [root@master ceph]# pwd
  17. /home/rook/cluster/examples/kubernetes/ceph
  18. [root@master ceph]# cd csi/
  19. [root@master csi]# ls -l
  20. total 0
  21. drwxr-x--- 2 root root 210 May 5 18:39 cephfs
  22. drwxr-x--- 2 root root 214 May 5 18:39 rbd
  23. drwxr-x--- 4 root root 31 May 5 18:39 template
  24. [root@master csi]# cd cephfs/
  25. [root@master cephfs]# ls -l
  26. total 36
  27. -rw-r----- 1 root root 1705 May 5 18:39 kube-registry.yaml
  28. -rw-r----- 1 root root 321 May 5 18:39 pod.yaml
  29. -rw-r----- 1 root root 268 May 5 18:39 pvc-clone.yaml
  30. -rw-r----- 1 root root 310 May 5 18:39 pvc-restore.yaml
  31. -rw-r----- 1 root root 195 May 5 18:39 pvc.yaml
  32. -rw-r----- 1 root root 597 May 5 18:39 snapshotclass.yaml
  33. -rw-r----- 1 root root 219 May 5 18:39 snapshot.yaml
  34. -rw-r----- 1 root root 1496 May 5 18:39 storageclass-ec.yaml
  35. -rw-r----- 1 root root 1490 May 5 18:39 storageclass.yaml
  36. [root@master cephfs]#

安装operator

[root@master ceph]# ll common.yaml operator.yaml
-rw-r----- 1 root root 30170 May  5 18:39 common.yaml
-rw-r----- 1 root root 20393 May  5 18:39 operator.yaml
[root@master ceph]#
kubectl apply -f common.yaml operator.yaml

安装ceph

[root@master ceph]# ll cluster.yaml
-rw-r----- 1 root root 14119 May  5 18:39 cluster.yaml
[root@master ceph]#
kubectl apply -f cluster.yaml

安装块存储

[root@master ceph]# ls csi/rbd/storageclass.yaml
csi/rbd/storageclass.yaml
[root@master ceph]#
kubectl apply -f csi/rbd/storageclass.yaml

安装对象存储

[root@master ceph]# ls object.yaml
object.yaml
kubectl -f object.yaml

安装Shared Filesystem

[root@master ceph]# ls -l filesystem.yaml
-rw-r----- 1 root root 4463 May  5 18:39 filesystem.yaml
[root@master ceph]#
kubectl apply -f filesystem.yaml
kubectl apply -f csi/cephfs/storageclass.yaml

安装dashboard

[root@master ceph]# ls -l dashboard-ingress-https.yaml
-rw-r----- 1 root root 886 May  5 18:39 dashboard-ingress-https.yaml
kubectl apply -f dashboard-ingress-https.yaml

安装工具 toolbox

[root@master ceph]# ls -l toolbox.yaml
-rw-r----- 1 root root 1474 May  5 18:39 toolbox.yaml
[root@master ceph]# kubectl apply -f toolbox.yaml

https://blog.csdn.net/zwjzqqb/article/details/104988391
https://zhuanlan.zhihu.com/p/138991974