From ebfb337d6f8ca3413390d90545d49d0114e4e7fc Mon Sep 17 00:00:00 2001 From: zhanglikun Date: Tue, 30 Jan 2024 18:09:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89set=20-euo=20pipefail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cluster.sh | 7 +++++-- docker/install.sh | 2 -- flannel/install.sh | 2 -- ingress-nginx/install.sh | 2 -- init/init.sh | 1 - keepalived/install.sh | 1 - kernel_5.4/install.sh | 1 - kubeadm/create_cluster.sh | 1 - kubeadm/install.sh | 1 - single.sh | 1 - 10 files changed, 5 insertions(+), 14 deletions(-) diff --git a/cluster.sh b/cluster.sh index 0c6ecbb..7f44a84 100755 --- a/cluster.sh +++ b/cluster.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -euo pipefail source cluster.env @@ -35,9 +34,13 @@ ssh root@${MASTER1} "cd /tmp/keepalived/ && bash install.sh && cp -r keepalived1 ssh root@${MASTER2} "cd /tmp/keepalived/ && bash install.sh && cp -r keepalived2.conf /etc/keepalived/keepalived.conf && systemctl restart keepalived" ssh root@${MASTER3} "cd /tmp/keepalived/ && bash install.sh && cp -r keepalived3.conf /etc/keepalived/keepalived.conf && systemctl restart keepalived" +# 安装 kubeadm 组件 +ssh root@${MASTER1} "cd /tmp/kubeadm/ && bash install.sh" +ssh root@${MASTER2} "cd /tmp/kubeadm/ && bash install.sh" +ssh root@${MASTER3} "cd /tmp/kubeadm/ && bash install.sh" + # 创建集群 cd kubeadm -./install.sh ./create_cluster.sh ${API_SERVER} | tee /tmp/install.log # 获取安装信息 diff --git a/docker/install.sh b/docker/install.sh index 56d4672..d658331 100644 --- a/docker/install.sh +++ b/docker/install.sh @@ -1,6 +1,4 @@ #!/bin/bash -set -euo pipefail - yum install -y docker-ce-20.10/*.rpm diff --git a/flannel/install.sh b/flannel/install.sh index 4381e9b..fb51f31 100644 --- a/flannel/install.sh +++ b/flannel/install.sh @@ -1,5 +1,3 @@ #!/bin/bash -set -euo pipefail - ls *.tar | xargs -I {} docker load -i {} diff --git a/ingress-nginx/install.sh b/ingress-nginx/install.sh index 63b467c..c6798cc 100644 --- a/ingress-nginx/install.sh +++ b/ingress-nginx/install.sh @@ -1,6 +1,4 @@ #!/bin/bash -set -euo pipefail - ls *.tar | xargs -I {} docker load -i {} kubectl taint node $(hostname) node-role.kubernetes.io/master- diff --git a/init/init.sh b/init/init.sh index c4b7e95..0be2b0e 100755 --- a/init/init.sh +++ b/init/init.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -euo pipefail if [ $(id -u) != "0" ]; then echo "Error: You must be root to run this script" diff --git a/keepalived/install.sh b/keepalived/install.sh index e7233f3..22c6679 100644 --- a/keepalived/install.sh +++ b/keepalived/install.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -euo pipefail yum install -y ./*.rpm systemctl enable --now keepalived \ No newline at end of file diff --git a/kernel_5.4/install.sh b/kernel_5.4/install.sh index 512c9f2..2553d23 100644 --- a/kernel_5.4/install.sh +++ b/kernel_5.4/install.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -euo pipefail yum install -y 1/* diff --git a/kubeadm/create_cluster.sh b/kubeadm/create_cluster.sh index 1721d03..d184569 100755 --- a/kubeadm/create_cluster.sh +++ b/kubeadm/create_cluster.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -euo pipefail # 初始化集群 sudo kubeadm init \ diff --git a/kubeadm/install.sh b/kubeadm/install.sh index 8a7b36a..61b4c31 100644 --- a/kubeadm/install.sh +++ b/kubeadm/install.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -euo pipefail yum install -y ./*.rpm ls *.tar | xargs -I {} docker load -i {} diff --git a/single.sh b/single.sh index 388b43d..d604767 100755 --- a/single.sh +++ b/single.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -euo pipefail source single.env