diff --git a/cluster.sh b/cluster.sh index 8b065b1..4ecd18f 100755 --- a/cluster.sh +++ b/cluster.sh @@ -8,6 +8,13 @@ if [ $(id -u) != "0" ]; then exit 1 fi +# 部署之前先分发 init 内容 +scp -r init/ root@${MASTER1}:/tmp/ +scp -r init/ root@${MASTER2}:/tmp/ +scp -r init/ root@${MASTER3}:/tmp/ +ssh root@${MASTER1} "cd /tmp/init/ && ./init.sh" +ssh root@${MASTER2} "cd /tmp/init/ && ./init.sh" +ssh root@${MASTER3} "cd /tmp/init/ && ./init.sh" # 生成keepalived配置文件 git checkout keepalived/*.conf diff --git a/init/init.sh b/init/init.sh index d8fb8d3..c4b7e95 100644 --- a/init/init.sh +++ b/init/init.sh @@ -27,8 +27,5 @@ swapoff -a sed -i 's/.*swap.*/#&/' /etc/fstab yum install -y ./*.rpm - -cd ../docker && bash ./install.sh && cd - -cd ../kubeadm && bash ./install.sh && cd - -cd ../flannel && bash install.sh +yum install -y ./git-2.31.1/*.rpm diff --git a/kubeadm/install.sh b/kubeadm/install.sh index 8414d0f..8a7b36a 100644 --- a/kubeadm/install.sh +++ b/kubeadm/install.sh @@ -3,5 +3,9 @@ set -euo pipefail yum install -y ./*.rpm ls *.tar | xargs -I {} docker load -i {} + +cd ../docker && bash ./install.sh && cd - +cd ../flannel && bash install.sh + systemctl enable --now kubelet diff --git a/single.sh b/single.sh index c9eda55..388b43d 100755 --- a/single.sh +++ b/single.sh @@ -8,7 +8,6 @@ if [ $(id -u) != "0" ]; then exit 1 fi -cd scripts -./init.sh -./create_cluster.sh ${API_SERVER} -./nginx_ingress.sh +./init/init.sh +./kubeadm/create_cluster.sh ${API_SERVER} +./ingress-nginx/install.sh