版本
Rancher 2.2.6
Rook Release-1.0
參考文檔
- 官方文檔 https://rook.io/docs/rook/v1.0
- kubernetes部署rook+ceph存儲系統(tǒng)https://blog.csdn.net/networken/article/details/85772418
- Rancher 2使用rook搭建ceph存儲類http://www.reibang.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的使用,所以生產(chǎn)環(huán)境請注意。
- 安裝Rook common和operator
2.1 使用helm
先安裝helm和tiller,在rancher的應(yīng)用商店中加入 https://charts.rook.io/release, 默認配置安裝即可。
2.2 使用kubectl
先git clone下rook乎芳,然后checkout到stable的版本,目前是Release-1.0帖池,進入rook/cluster/examples/kubernetes/ceph/,執(zhí)行以下命令奈惑。
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
執(zhí)行完成后睡汹,在rancher上修改rook-ceph命名空間到default(或其他項目)中肴甸,會看到rook-ceph-agent,rook-ceph-operator和rook-discover囚巴。
2.3 安裝Rook cluster
- Release1.0版本原在,需要解決dashboard的500錯誤問題,修改image至ceph/ceph:v14.2.2-20190722
- 作者直接讓ceph使用所有節(jié)點的所有空間彤叉,去注釋了directories庶柿。實際應(yīng)用時可按需求配置
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
-
安裝完成后,三節(jié)點的負載如圖
- 添加存儲類
kubectl --kubeconfig=kube_config_cluster.yml create -f storageclass.yaml
-
添加ingress秽浇,訪問dashboard浮庐。dashboard的密碼在資源-密文中的rook-ceph-dashboard-password條目
建立busybox測試,掛載硬盤柬焕,能看到服務(wù)成功啟動兔辅,ceph-dashboard下的block下的Images有相應(yīng)的pvc
最后在rancher集群層級的菜單中進入存儲-存儲類,將rook-ceph-block設(shè)置為默認