Rook is an open source cloud-native storage orchestrator, providing the platform, framework, and support for Ceph storage to natively integrate with cloud-native environments.1. 說明
因香橙派和樹莓派資源所限,轉移到基于VirtualBox建立的VMs繼續(xù)實踐。
虛擬機環(huán)境列表:
Host Name | IP | 配置 | 備注 |
k8s-c0-master0 | 10.0.3.6 | Ubuntu 22.04.3 LTS 8核32G, 200G(sda) + 100G(sdb) | 虛擬機 |
k8s-c0-node0 | 10.0.3.7 | Ubuntu 22.04.3 LTS 4核8G, 200G(sda) + 100G(sdb) | ... |
k8s-c0-node1 | 10.0.3.8 | Ubuntu 22.04.3 LTS 4核8G, 200G(sda) + 100G(sdb) | ... |
2.?準備工作
- 下載 ubuntu-22.04.2-live-server-amd64.iso,并映射到啟動光盤
- 虛擬機設置雙網(wǎng)卡,1作橋接(同網(wǎng)訪問),1作NAT網(wǎng)絡(K8s內(nèi)網(wǎng))
- 安裝時選擇鏡像(重要)https://mirrors.aliyun.com/ubuntu
- 初始化K8s環(huán)境
- 為避免CTR拉取鏡像失敗,設置容器代理,編輯 /lib/systemd/system/containerd.service
[Service] Environment="HTTP_PROXY=http://192.168.0.108:1081" Environment="HTTPS_PROXY=http://192.168.0.108:1081" Environment="NO_PROXY=aliyun.com,aliyuncs.com,huaweicloud.com,k8s-master-0,k8s-master-1,k8s-worker-0,localhost,127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
systemctl daemon-reload && systemctl restart containerd
3. 方案及安裝步驟
3.1 Rook
Rook is an open source cloud-native storage orchestrator, providing the platform, framework, and support for Ceph storage to natively integrate with cloud-native environments.
3.2 安裝要求
- Raw devices (no partitions or formatted filesystems)
- Raw partitions (no formatted filesystem)?
- LVM Logical Volumes (no formatted filesystem)
- Persistent Volumes available from a storage class in?
block
?mode
一句話:有個裸盤 (100G /dev/sdb)
保證至少3個節(jié)點,去掉污點
kubectl taint nodes --all node-role.kubernetes.io/control-plane-
3.3 安裝步驟
1. 獲取rook倉庫到安裝路徑,如:/k8s_apps/rook
git clone --single-branch --branch v1.12.6 https://github.com/rook/rook.git
2. 編寫安裝腳本,/k8s_apps/scripts/k8s-rook-ceph.sh
#!/bin/bash
kubectl apply -f /k8s_apps/rook/deploy/examples/crds.yaml
kubectl apply -f /k8s_apps/rook/deploy/examples/common.yaml
kubectl apply -f /k8s_apps/rook/deploy/examples/operator.yaml
kubectl -n rook-ceph get pod
kubectl apply -f /k8s_apps/rook/deploy/examples/cluster.yaml
3. 編寫刪除腳本,/k8s_apps/scripts/rook-ceph-delete.sh
#!/bin/bash
kubectl delete -f /k8s_apps/rook/deploy/examples/wordpress.yaml
kubectl delete -f /k8s_apps/rook/deploy/examples/mysql.yaml
kubectl delete -n rook-ceph cephblockpool replicapool
kubectl delete storageclass rook-ceph-block
kubectl delete -f /k8s_apps/rook/deploy/examples/csi/cephfs/kube-registry.yaml
kubectl delete storageclass csi-cephfs
kubectl -n rook-ceph patch cephcluster rook-ceph --type merge -p '{"spec":{"cleanupPolicy":{"confirmation":"yes-really-destroy-data"}}}'
kubectl -n rook-ceph delete cephcluster rook-ceph
kubectl -n rook-ceph get cephcluster
kubectl delete -f /k8s_apps/rook/deploy/examples/operator.yaml
kubectl delete -f /k8s_apps/rook/deploy/examples/common.yaml
kubectl delete -f /k8s_apps/rook/deploy/examples/crds.yaml
4. 執(zhí)行安裝,一切正常的話,如下圖,不正常的話,執(zhí)行刪除腳本,排除問題后重來。文章來源:http://www.zghlxwxcb.cn/news/detail-720766.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-720766.html
4. 相關命令
- 實時查看pod創(chuàng)建進度
kubectl get pod -n rook-ceph -w
- 實時查看集群創(chuàng)建進度
kubectl get cephcluster -n rook-ceph rook-ceph -w
- 詳細描述
kubectl describe cephcluster -n rook-ceph rook-ceph
5. 參考
- Rook - Rook Ceph Documentation
到了這里,關于K8S集群實踐之九: Ceph的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!