|NO.Z.00241|——————————|^^ 部署 ^^|——|KuberNetes&儲存進階.V07|5臺Server|--------------------------------------------|Ceph.v01|rook.v1.5.11部署|
阿新 • • 發佈:2022-03-31
[CloudNative:KuberNetes&儲存進階.V07] [Applications.KuberNetes] [|DevOps|k8s|雲原生儲存及儲存進階|**5節點.上**|Rook安裝1.5.11安裝ceph叢集|]
一、Rook介紹
### --- rook官方地址:
~~~ https://rook.io/docs/rook/v1.5/ceph-quickstart.html
二、ceph部署cluster.yaml配置檔案修改說明
三、ceph部署環境注意事項### --- ceph部署cluster.yaml配置檔案修改說明 [root@k8s-master01 ceph]# vim cluster.yaml storage: # cluster level storage configuration and selection useAllNodes: false useAllDevices: false #deviceFilter: config: ***********省略部分內容***************** nodes: - name: "k8s-master02" devices: - name: "sdb" - name: "k8s-master03" devices: - name: "sdb" - name: "k8s-node01" devices: - name: "sdb" - name: "k8s-node02" directories: - path: "/data/ceph"
### --- ceph部署環境注意事項
~~~ 注意1:rook的版本大於1.3,不要使用目錄建立叢集,要使用單獨的裸盤進行建立,也就是建立一個新的磁碟,掛載到宿主機,不進行格式化,直接使用即可。對於的磁碟節點配置如下:
~~~ 注意2:做這個實驗需要高配置,每個節點配置不能低於2核4G
~~~ 注意3:k8s 1.19以上版本,快照功能需要單獨安裝snapshot控制器
一、下載rook版本包並修改配置檔案
二、配置修改一:修改operator.yaml配置檔案### --- 下載Rook安裝檔案:下載指定版本Rook,也可以參考視訊中的步驟下載最新版 [root@k8s-master01 ~]# git clone --single-branch --branch v1.5.11 https://github.com/rook/rook.git
### --- 切換到ceph的建立目錄
[root@k8s-master01 ~]# cd rook/cluster/examples/kubernetes/ceph
### --- 修改operator檔案配置,將gcr的映象改為阿里雲映象倉庫
[root@k8s-master01 ceph]# vim operator.yaml
# The default version of CSI supported by Rook will be started. To change the version
# of the CSI driver to something other than what is officially supported, change
# these images to the desired release of the CSI driver.
# ROOK_CSI_CEPH_IMAGE: "quay.io/cephcsi/cephcsi:v3.2.2"
# ROOK_CSI_REGISTRAR_IMAGE: "k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.0.1"
# ROOK_CSI_RESIZER_IMAGE: "k8s.gcr.io/sig-storage/csi-resizer:v1.0.1"
# ROOK_CSI_PROVISIONER_IMAGE: "k8s.gcr.io/sig-storage/csi-provisioner:v2.0.4"
# ROOK_CSI_SNAPSHOTTER_IMAGE: "k8s.gcr.io/sig-storage/csi-snapshotter:v3.0.2"
# ROOK_CSI_ATTACHER_IMAGE: "k8s.gcr.io/sig-storage/csi-attacher:v3.0.2"
# 修改配置一:
ROOK_CSI_REGISTRAR_IMAGE: "registry.cn-beijing.aliyuncs.com/dotbalo/csi-node-driver-registrar:v2.0.1"
ROOK_CSI_RESIZER_IMAGE: "registry.cn-beijing.aliyuncs.com/dotbalo/csi-resizer:v1.0.0"
ROOK_CSI_PROVISIONER_IMAGE: "registry.cn-beijing.aliyuncs.com/dotbalo/csi-provisioner:v2.0.0"
ROOK_CSI_SNAPSHOTTER_IMAGE: "registry.cn-beijing.aliyuncs.com/dotbalo/csi-snapshotter:v3.0.0"
ROOK_CSI_ATTACHER_IMAGE: "registry.cn-beijing.aliyuncs.com/dotbalo/csi-attacher:v3.0.0"
# 修改配置二:
- name: ROOK_ENABLE_DISCOVERY_DAEMON
value: "true"
### --- 註釋
~~~ # 修改配置一:
~~~ 注:修改Rook CSI映象地址,原本的地址可能是gcr的映象,但是gcr的映象無法被國內訪問,所以需要同步gcr的映象到阿里雲映象倉庫,
~~~ 注:將上述內容更改為阿里雲的映象倉庫地址
~~~ 注:如果是其他版本,需要自行同步,同步方法可以在網上找到相關文章。
~~~ # 修改配置二:
~~~ 注:還是operator檔案,新版本rook預設關閉了自動發現容器的部署,可以找到ROOK_ENABLE_DISCOVERY_DAEMON改成true即可:
三、配置修改二:cluster.yaml配置檔案### --- 修改cluster.yaml檔案配置
[root@k8s-node02 ceph]# pwd
/data/ceph
[root@k8s-master01 ceph]# vim cluster.yaml
# 修改一:
mon:
count: 1 # 注:當前實驗環境,mountor的數量改為1,機器壓力,減少資源佔用率
allowMultiplePerNode: false
# 修改二:
storage: # cluster level storage configuration and selection
useAllNodes: false # 所有節點都是儲存節點,在生產環境中,肯定不是這種環境,所以謝偉false
useAllDevices: false # 使用所有磁碟,生產環境肯定不可以,所以false
******************省略部分內容*******************
nodes:
- name: "k8s-master02"
devices:
- name: "sdb"
- name: "k8s-master03"
devices:
- name: "sdb"
- name: "k8s-node01"
devices:
- name: "sdb"
- name: "k8s-node02"
directories:
- path: "/data/ceph"
# 注:新增三個儲存節點,和一個儲存目錄
### --- 修改cluster.yaml檔案配置準備資源
~~~ # 準備工作一:
~~~ 注:為儲存節點新增一塊裸盤和k8s-node01建立儲存目錄
~~~ 注:環境準備說明:儲存準備說明
~~~ 注:k8s-master0;k8s-node01;k8s-node02均作為儲存節點:使用裸盤作為儲存
~~~ # 準備工作二:
~~~ k8s-node02:此環境把node02作為ceph的儲存節點:把/data/ceph作為儲存掛載目錄;作為儲存
[root@k8s-master01 ~]# fdisk -l
Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
### --- cluster.yaml配置說明
~~~ dataDirHostPath: /var/lib/rook // 在每個節點啟動可一個agent,這個是agent資料的儲存目錄;保持預設即可
~~~ 註釋2:
count: 3 // monitor端前數量,此環境寫3個;生產環境可以多起一點
~~~ 註釋3:
dashboard: // ceph的管理介面
enabled: true
~~~ 註釋4:
rulesNamespace: rook-ceph // namespace
~~~ 註釋5:
~~~ # placement: // 節點親和力配置
===============================END===============================
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart ——W.S.Landor
來自為知筆記(Wiz)