offline-kubernetes-install/cluster.sh

36 lines
962 B
Bash
Raw Normal View History

2023-09-12 22:58:49 +08:00
#!/bin/bash
set -euo pipefail
source cluster.env
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script"
exit 1
fi
2023-09-13 10:45:29 +08:00
# 生成keepalived配置文件
git
sed -e "s/__MASTER1__/${MASTER1}/g" \
-e "s/__MASTER2__/${MASTER2}/g" \
-e "s/__MASTER3__/${MASTER3}/g" \
-e "s/__VIP__/${VIP}/g" \
-e "s/__NETWORK_NIC__/${NETWORK_NIC}/g" \
-i keepalived/*.conf
# 分发仓库文件
scp -r * root@${MASTER1}:/tmp/
scp -r * root@${MASTER2}:/tmp/
scp -r * root@${MASTER3}:/tmp/
# 分发配置
ssh root@${MASTER1} "cd /tmp/keepalived/ && cp keepalived1.conf /etc/keepalived/keepalived.conf && bash install.sh"
ssh root@${MASTER2} "cd /tmp/keepalived/ && cp keepalived2.conf /etc/keepalived/keepalived.conf && bash install.sh"
ssh root@${MASTER3} "cd /tmp/keepalived/ && cp keepalived3.conf /etc/keepalived/keepalived.conf && bash install.sh"
exit 1
2023-09-12 22:58:49 +08:00
cd scripts
2023-09-12 23:12:13 +08:00
./init.sh
2023-09-13 10:45:29 +08:00
./create_cluster.sh ${API_SERVER}
2023-09-12 23:12:13 +08:00
./nginx_ingress.sh