[+] 更新 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 &
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 开始部署
|
# 检查是否为 Master-01
|
||||||
curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -s - server \
|
if [ "$current_ip" == "$master" ]; then
|
||||||
--cluster-init \
|
# 开始部署
|
||||||
--cluster-cidr $pod_subnet \
|
curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -s - server \
|
||||||
--service-cidr $service_subnet \
|
--cluster-init \
|
||||||
--node-external-ip=$vip_ip \
|
--cluster-cidr $pod_subnet \
|
||||||
--tls-san=$vip_ip
|
--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)
|
TOKEN=$(cat /var/lib/rancher/k3s/server/node-token)
|
||||||
|
cat <<EOF
|
||||||
cat <<EOF
|
|
||||||
------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------
|
||||||
初始化 master VIP[$state] $current_ip 成功
|
初始化 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
|
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