在Rancher20上安装RookCeph

25次阅读

共计 2330 个字符,预计需要花费 6 分钟才能阅读完成。

版本

Rancher 2.2.6
Rook Release-1.0

参考文档

  • 官方文档 https://rook.io/docs/rook/v1.0
  • kubernetes 部署 rook+ceph 存储系统 https://blog.csdn.net/networken/article/details/85772418
  • Rancher 2 使用 rook 搭建 ceph 存储类 https://www.jianshu.com/p/f353b71ec58e

安装

1 配置 rancher 的 cluster.yml 文件,
按照官方文档 https://rook.io/docs/rook/v1.0/flexvolume.html
来配置 flexvolume 的路径,修改 cluster.yml。

services:
  ...
  kubelet:
    image: ""
    extra_args: 
      volume-plugin-dir: /usr/libexec/kubernetes/kubelet-plugins/volume/exec
    extra_binds: 
      - /usr/libexec/kubernetes/kubelet-plugins/volume/exec:/usr/libexec/kubernetes/kubelet-plugins/volume/exec

修改后使用 rke up 或 ./rke_linux-amd64 up 重新配置 kubernetes。该配置可能会影响 rancher 的使用,所以生产环境请注意。

2 安装 Rook common 和 operator
可选择 helm 安装方法或 kubectl 安装方法。

  • 使用 helm

先安装 helm 和 tiller,在 rancher 的应用商店中加入 https://charts.rook.io/release, 默认配置安装即可。

  • 使用 kubectl

先 git clone 下 rook,然后 checkout 到 stable 的版本,目前是 Release-1.0,进入 rook/cluster/examples/kubernetes/ceph/, 执行以下命令。
kube_config_cluster.yml 为外部访问 rancher 的 k8s 集群需要的配置文件。

kubectl --kubeconfig=kube_config_cluster.yml create -f common.yaml
kubectl --kubeconfig=kube_config_cluster.yml create -f operator.yaml 

执行完成后,在 rancher 上修改 rook-ceph 命名空间到 default(或其他项目)中,会看到 rook-ceph-agent,rook-ceph-operator 和 rook-discover。
3 安装 Rook cluster

  • Release1.0 版本,需要解决 dashboard 的 500 错误问题,修改 image 至 ceph/ceph:v14.2.2-20190722
  • 作者直接让 ceph 使用所有节点的所有空间,去注释了 directories。实际应用时可按需求配置
  storage: # cluster level storage configuration and selection
    useAllNodes: true
    useAllDevices: true
    deviceFilter:
    location:
    config:
      # The default and recommended storeType is dynamically set to bluestore for devices and filestore for directories.
      # Set the storeType explicitly only if it is required not to use the default.
      # storeType: bluestore
      # metadataDevice: "md0" # specify a non-rotational storage so ceph-volume will use it as block db device of bluestore.
      # databaseSizeMB: "1024" # uncomment if the disks are smaller than 100 GB
      # journalSizeMB: "1024"  # uncomment if the disks are 20 GB or smaller
      # osdsPerDevice: "1" # this value can be overridden at the node or device level
      # encryptedDevice: "true" # the default value for this option is "false"
# Cluster level list of directories to use for filestore-based OSD storage. If uncommented, this example would create an OSD under the dataDirHostPath.
# 去注释
    directories:
    - path: /var/lib/rook
  • 安装完成后,三节点的负载如图

  • 添加存储类
kubectl --kubeconfig=kube_config_cluster.yml create -f storageclass.yaml 
  • 添加 ingress,访问 dashboard。dashboard 的密码在资源 - 密文中的 rook-ceph-dashboard-password 条目

4 建立 busybox 测试,挂载硬盘,能看到服务成功启动,ceph-dashboard 下的 block 下的 Images 有相应的 pvc
5 最后在 rancher 集群层级的菜单中进入存储 - 存储类,将 rook-ceph-block 设置为默认

正文完
 0