优化脚本
This commit is contained in:
parent
b1e96472a7
commit
6b1d891775
4
.env
Normal file
4
.env
Normal file
@ -0,0 +1,4 @@
|
||||
MASTER1="10.0.0.112"
|
||||
MASTER2="10.0.0.122"
|
||||
MASTER3="10.0.0.132"
|
||||
VIP="10.0.0.32"
|
19
0-config.sh
19
0-config.sh
@ -1,13 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
master1="10.0.0.112"
|
||||
master2="10.0.0.122"
|
||||
master3="10.0.0.132"
|
||||
vip="10.0.0.32"
|
||||
source .env
|
||||
|
||||
sed -e "s/10.0.0.11/${master1}/g" \
|
||||
-e "s/10.0.0.12/${master2}/g" \
|
||||
-e "s/10.0.0.13/${master3}/g" \
|
||||
-e "s/10.0.0.3/${vip}/g" \
|
||||
-i keepalived/*.conf \
|
||||
-i 2-create_k8s.sh
|
||||
sed -e "s/__MASTER1__/${MASTER1}/g" \
|
||||
-e "s/__MASTER2__/${MASTER2}/g" \
|
||||
-e "s/__MASTER3__/${MASTER3}/g" \
|
||||
-e "s/__VIP__/${VIP}/g" \
|
||||
-i keepalived/*.conf
|
||||
|
||||
sed -e "s/__API_SERVER__/${VIP}/g" -i 2-create_k8s.sh
|
11
1-init.sh
11
1-init.sh
@ -1,4 +1,11 @@
|
||||
sudo systemctl disable --now firewalld
|
||||
#!/bin/bash
|
||||
|
||||
if [ $(id -u) != "0" ]; then
|
||||
echo "Error: You must be root to run this script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
systemctl disable --now firewalld
|
||||
setenforce 0
|
||||
sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
|
||||
|
||||
@ -15,7 +22,7 @@ EOF
|
||||
sudo sysctl --system
|
||||
|
||||
# 关闭swap
|
||||
sudo swapoff -a
|
||||
swapoff -a
|
||||
sed -i 's/.*swap.*/#&/' /etc/fstab
|
||||
|
||||
cd ./docker && bash ./install.sh && cd ..
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
apiserver="10.0.0.3"
|
||||
apiserver="__API_SERVER__"
|
||||
|
||||
|
||||
sudo kubeadm init \
|
||||
|
@ -22,13 +22,13 @@ vrrp_instance VI_1 { # 实例名
|
||||
track_script {
|
||||
check
|
||||
}
|
||||
unicast_src_ip 10.0.0.11
|
||||
unicast_src_ip __MASTER1__
|
||||
unicast_peer {
|
||||
10.0.0.12
|
||||
10.0.0.13
|
||||
__MASTER2__
|
||||
__MASTER3__
|
||||
}
|
||||
virtual_ipaddress {
|
||||
10.0.0.3 dev ens192
|
||||
__VIP__ dev ens192
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,13 +22,13 @@ vrrp_instance VI_1 { # 实例名
|
||||
track_script {
|
||||
check
|
||||
}
|
||||
unicast_src_ip 10.0.0.12
|
||||
unicast_src_ip __MASTER2__
|
||||
unicast_peer {
|
||||
10.0.0.11
|
||||
10.0.0.13
|
||||
__MASTER1__
|
||||
__MASTER3__
|
||||
}
|
||||
virtual_ipaddress {
|
||||
10.0.0.3 dev ens192
|
||||
__VIP__ dev ens192
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,13 +22,13 @@ vrrp_instance VI_1 { # 实例名
|
||||
track_script {
|
||||
check
|
||||
}
|
||||
unicast_src_ip 10.0.0.13
|
||||
unicast_src_ip __MASTER3__
|
||||
unicast_peer {
|
||||
10.0.0.11
|
||||
10.0.0.12
|
||||
__MASTER1__
|
||||
__MASTER2__
|
||||
}
|
||||
virtual_ipaddress {
|
||||
10.0.0.3 dev ens192
|
||||
__VIP__ dev ens192
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user