[+] 更新 bash
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 13s
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 13s
This commit is contained in:
parent
919511263f
commit
1e3d6cfcaa
43
init-k3s.sh
43
init-k3s.sh
@ -60,26 +60,39 @@ systemctl status keepalived &
|
||||
|
||||
|
||||
|
||||
# 开始部署
|
||||
curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -s - server \
|
||||
--cluster-init \
|
||||
--cluster-cidr $pod_subnet \
|
||||
--service-cidr $service_subnet \
|
||||
--node-external-ip=$vip_ip \
|
||||
--tls-san=$vip_ip
|
||||
# 检查是否为 Master-01
|
||||
if [ "$current_ip" == "$master" ]; then
|
||||
# 开始部署
|
||||
curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -s - server \
|
||||
--cluster-init \
|
||||
--cluster-cidr $pod_subnet \
|
||||
--service-cidr $service_subnet \
|
||||
--node-external-ip=$vip_ip \
|
||||
--tls-san=$vip_ip
|
||||
|
||||
kubectl get nodes
|
||||
|
||||
TOKEN=$(cat /var/lib/rancher/k3s/server/node-token)
|
||||
|
||||
cat <<EOF
|
||||
TOKEN=$(cat /var/lib/rancher/k3s/server/node-token)
|
||||
cat <<EOF
|
||||
------------------------------------------------------------------------------------
|
||||
初始化 master VIP[$state] $current_ip 成功
|
||||
|
||||
# 加入节点
|
||||
export pod_subnet=$pod_subnet
|
||||
export service_subnet=$service_subnet
|
||||
export vip_ip=$vip_ip
|
||||
export vip=$vip_ip/16
|
||||
export master=$master
|
||||
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-k3s.sh | bash
|
||||
|
||||
curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | K3S_TOKEN=$TOKEN sh -s - server \
|
||||
--server https://$vip_ip:6443 \
|
||||
--tls-san=$vip_ip
|
||||
------------------------------------------------------------------------------------
|
||||
EOF
|
||||
|
||||
else
|
||||
curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | K3S_TOKEN=$TOKEN sh -s - server \
|
||||
--server https://$vip_ip:6443 \
|
||||
--tls-san=$vip_ip
|
||||
fi
|
||||
|
||||
|
||||
kubectl get nodes
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user