From 80497e8a1a9db8b718aa583a1a9e28fe916e684f Mon Sep 17 00:00:00 2001 From: zhanglikun Date: Tue, 30 Jan 2024 16:19:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=20init=20=E5=86=85=E5=AE=B9=E5=88=86?= =?UTF-8?q?=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cluster.sh | 7 +++++++ init/init.sh | 5 +---- kubeadm/install.sh | 4 ++++ single.sh | 7 +++---- 4 files changed, 15 insertions(+), 8 deletions(-) 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