整理文件结构

This commit is contained in:
zhanglikun 2023-09-12 17:40:05 +08:00
parent bb0cf1697d
commit 19766ba1a1
7 changed files with 27 additions and 8 deletions

2
.env
View File

@ -1,5 +1,3 @@
MODE="single"
# MODE="cluster"
MASTER1="10.0.0.112" MASTER1="10.0.0.112"
MASTER2="10.0.0.122" MASTER2="10.0.0.122"
MASTER3="10.0.0.132" MASTER3="10.0.0.132"

View File

@ -3,10 +3,13 @@ set -euo pipefail
source .env source .env
# 生成keepalived配置文件
sed -e "s/__MASTER1__/${MASTER1}/g" \ sed -e "s/__MASTER1__/${MASTER1}/g" \
-e "s/__MASTER2__/${MASTER2}/g" \ -e "s/__MASTER2__/${MASTER2}/g" \
-e "s/__MASTER3__/${MASTER3}/g" \ -e "s/__MASTER3__/${MASTER3}/g" \
-e "s/__VIP__/${VIP}/g" \ -e "s/__VIP__/${VIP}/g" \
-i keepalived/*.conf -i keepalived/*.conf
# 修改脚本内VIP
sed -e "s/__API_SERVER__/${VIP}/g" -i 2-create_k8s.sh sed -e "s/__API_SERVER__/${VIP}/g" -i 2-create_k8s.sh

View File

@ -2,4 +2,4 @@
set -euo pipefail set -euo pipefail
# 更新内核, 可选操作 # 更新内核, 可选操作
cd ../kernel_5.4 && bash install.sh && cd .. cd ../kernel_5.4 && bash install.sh && cd -

View File

@ -26,6 +26,6 @@ sudo sysctl --system
swapoff -a swapoff -a
sed -i 's/.*swap.*/#&/' /etc/fstab sed -i 's/.*swap.*/#&/' /etc/fstab
cd ./docker && bash ./install.sh && cd .. cd ../docker && bash ./install.sh && cd -
cd ./kubeadm && bash ./install.sh && cd .. cd ../kubeadm && bash ./install.sh && cd -

View File

@ -25,4 +25,4 @@ source <(kubectl completion bash)
EOF EOF
fi fi
cd flannel && bash install.sh && cd .. cd ../flannel && bash install.sh && cd -

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
cd ingress-nginx && bash install.sh && cd .. cd ../ingress-nginx && bash install.sh && cd -

18
single.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
set -euo pipefail
VIP="10.0.0.32"
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script"
exit 1
fi
source .env
cd scripts
./1-init.sh
sed -e "s/__API_SERVER__/${VIP}/g" -i 2-create_k8s.sh
./2-create_k8s.sh
./3-nginx_ingress.sh