Last active
June 22, 2022 07:02
-
-
Save yankay/16823b3efee557ef61b93c0b54d354f7 to your computer and use it in GitHub Desktop.
简易安装 使用 hwamei stor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 安装 HwameiStor 并启用 DRBD | |
| # 参考 https://github.com/hwameistor/documentation/blob/main/docs/02installation/01helm-chart.md | |
| # 安装 HwameiStor | |
| helm repo add daocloud https://release.daocloud.io/chartrepo/daocloud | |
| helm repo update | |
| helm upgrade hwameistor daocloud/hwameistor --install -n hwameistor --create-namespace --set k8sImageRegistry=quay.m.daocloud.io --set hwameistorImageRegistry=ghcr.m.daocloud.io | |
| # 安装 SC https://github.com/hwameistor/local-storage/blob/main/deploy/storageclass-lvm-ha.yaml | |
| cd /tmp | |
| git clone https://github.com/hwameistor/local-storage.git | |
| cd /tmp/local-storage/deploy | |
| kubectl apply -f storageclass-lvm.yaml | |
| kubectl apply -f storageclass-lvm-ha.yaml | |
| # 添加磁盘(盘要大一些 ,不小于 100GB ) | |
| kubectl label node node2 "lvm.hwameistor.io/enable=true" | |
| kubectl label node node4 "lvm.hwameistor.io/enable=true" | |
| cat > ./local-disk-claim2.yaml <<- EOF | |
| apiVersion: hwameistor.io/v1alpha1 | |
| kind: LocalDiskClaim | |
| metadata: | |
| name: ldc-node2 | |
| namespace: hwameistor | |
| spec: | |
| nodeName: node2 | |
| description: | |
| diskType: HDD | |
| EOF | |
| kubectl apply -n hwameistor -f local-disk-claim2.yaml | |
| cat > ./local-disk-claim4.yaml <<- EOF | |
| apiVersion: hwameistor.io/v1alpha1 | |
| kind: LocalDiskClaim | |
| metadata: | |
| name: ldc-node4 | |
| namespace: hwameistor | |
| spec: | |
| nodeName: node4 | |
| description: | |
| diskType: HDD | |
| EOF | |
| kubectl apply -n hwameistor -f local-disk-claim4.yaml | |
| kubectl get ldc | |
| kubectl get ld | |
| # 修改 hwameistor-scheduler 无法启动,可以修改一下 | |
| node-role.kubernetes.io/master => node-role.kubernetes.io/control-plane | |
| # 无 DRBD 模式的 Wordpress 安装 | |
| kubectl patch storageclass local-storage-hdd-lvm -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' | |
| kubectl get sc | |
| helm repo add community https://release.daocloud.io/chartrepo/community | |
| helm repo update | |
| helm install wp -n wp1 community/wordpress --set global.imageRegistry=docker.m.daocloud.io --set image.debug=true --set schedulerName=hwameistor-scheduler --set mariadb.schedulerName=hwameistor-scheduler --create-namespace | |
| # 安装 DRBD | |
| # 要求使用 DRBD 9 版本以上 | |
| # 要求 hostname 和 nodename 相同 | |
| sudo apt-add-repository ppa:linbit/linbit-drbd9-stack | |
| sudo apt-get update | |
| sudo apt-get install -y drbd-dkms | |
| sudo modprobe drbd | |
| modinfo drbd | |
| kubectl patch storageclass local-storage-hdd-lvm -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}' | |
| kubectl patch storageclass local-storage-hdd-lvm-ha -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' | |
| kubectl get sc | |
| helm install wp -n wp2 community/wordpress --set global.imageRegistry=docker.m.daocloud.io --set image.debug=true --set schedulerName=hwameistor-scheduler --set mariadb.schedulerName=hwameistor-scheduler --create-namespace | |
| # 选择一个节点驱逐,测试高可用 | |
| kubectl drain node4 --ignore-daemonsets | |
| kubectl get lv | |
| 成功完成了 节点的容灾。 牛B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment