[*] 防止阻塞
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 10s
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 10s
This commit is contained in:
@@ -123,7 +123,7 @@ echo "k8s 运行环境安装成功"
|
||||
current_ip=$(hostname -I | awk '{print $1}')
|
||||
if ! echo "$masters" | grep -qw "$current_ip"; then
|
||||
echo "初始化 worker $current_ip 成功"
|
||||
return 0
|
||||
exit 0
|
||||
fi
|
||||
# 安装 keepalived haproxy
|
||||
apt install -y keepalived haproxy
|
||||
@@ -151,7 +151,7 @@ vrrp_instance VI_1 {
|
||||
}
|
||||
EOF
|
||||
sudo systemctl restart keepalived
|
||||
systemctl status keepalived
|
||||
systemctl status keepalived &
|
||||
echo "初始化 master VIP $current_ip 成功"
|
||||
|
||||
# 初始化 haproxy
|
||||
@@ -198,7 +198,7 @@ EOF
|
||||
groupadd -r haproxy || echo "用户组已存在"
|
||||
useradd -r -g haproxy -s /sbin/nologin haproxy || echo "用户已存在"
|
||||
sudo systemctl restart keepalived && sudo systemctl restart haproxy
|
||||
systemctl status haproxy
|
||||
systemctl status haproxy &
|
||||
echo "初始化 master haproxy $current_ip 成功"
|
||||
|
||||
|
||||
@@ -276,12 +276,14 @@ export KUBECONFIG=/etc/kubernetes/admin.conf
|
||||
|
||||
# 安装 operator
|
||||
kubectl create -f https://mirrors.martin98.com/repository/proxy/raw.githubusercontent.com/projectcalico/calico/v$CALICO_VERSION/manifests/tigera-operator.yaml
|
||||
sleep 5
|
||||
kubectl wait --for=condition=Ready pods --all -n tigera-operator --timeout=300s
|
||||
echo "初始化 master $current_ip operator 成功"
|
||||
# 安装 calico
|
||||
curl https://mirrors.martin98.com/repository/proxy/raw.githubusercontent.com/projectcalico/calico/v$CALICO_VERSION/manifests/custom-resources.yaml -O
|
||||
sed -i "s|\(cidr: \).*|\1$pod_subnet|" custom-resources.yaml
|
||||
kubectl create -f custom-resources.yaml
|
||||
sleep 5
|
||||
kubectl wait --for=condition=Ready pods --all -n calico-system --timeout=300s
|
||||
kubectl wait --for=condition=Ready pods --all -n calico-apiserver --timeout=300s
|
||||
echo "初始化 master $current_ip calico 成功"
|
||||
|
||||
Reference in New Issue
Block a user