[+] 更新 k3s 脚本
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 15s
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 15s
This commit is contained in:
parent
f3e2fe88d5
commit
9876eeb491
57
init-k3s.sh
57
init-k3s.sh
@ -2,10 +2,33 @@
|
||||
|
||||
current_ip=$(hostname -I | awk '{print $1}')
|
||||
|
||||
# 镜像加速
|
||||
cat <<EOF > /etc/rancher/k3s/registries.yaml
|
||||
mirrors:
|
||||
docker.io:
|
||||
registry.k8s.io:
|
||||
endpoint:
|
||||
- https://docker.martin98.com/v2/docker
|
||||
https://registry.k8s.io:
|
||||
https://k8s.gcr.io:
|
||||
endpoint:
|
||||
- https://docker.martin98.com/v2/k8s
|
||||
https://gcr.io:
|
||||
endpoint:
|
||||
- https://docker.martin98.com/v2/gcr
|
||||
https://ghcr.io:
|
||||
endpoint:
|
||||
- https://docker.martin98.com/v2/ghcr
|
||||
https://quay.io:
|
||||
endpoint:
|
||||
- https://docker.martin98.com/v2/quay
|
||||
EOF
|
||||
|
||||
|
||||
curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -s - \
|
||||
--cluster-cidr $pod_subnet \
|
||||
--service-cidr $service_subnet \
|
||||
--node-external-ip=$vip
|
||||
--node-external-ip=$vip_ip
|
||||
|
||||
# 安装 keepalived
|
||||
apt install -y keepalived
|
||||
@ -34,4 +57,34 @@ vrrp_instance VI_1 {
|
||||
EOF
|
||||
sudo systemctl restart keepalived
|
||||
systemctl status keepalived &
|
||||
echo "初始化 master VIP[$state] $current_ip 成功"
|
||||
echo "初始化 master VIP[$state] $current_ip 成功"
|
||||
|
||||
|
||||
#cat /var/lib/rancher/k3s/server/node-token
|
||||
#
|
||||
#
|
||||
#
|
||||
#curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | \
|
||||
# INSTALL_K3S_MIRROR=cn \
|
||||
# K3S_URL=https://myserver:6443 \
|
||||
# K3S_TOKEN=mynodetoken sh -
|
||||
#cat <<EOF
|
||||
#------------------------------------------------------------------------------------
|
||||
#初始化 master $current_ip 成功
|
||||
#$OUTPUT
|
||||
#
|
||||
## master 加入
|
||||
#kubeadm join $vip_ip:6443 \\
|
||||
# --token $TOKEN \\
|
||||
# --discovery-token-ca-cert-hash $TOKEN_HASH \\
|
||||
# --control-plane --certificate-key $CERTS
|
||||
#
|
||||
## worker 加入
|
||||
#kubeadm join $vip_ip:6443 \\
|
||||
# --token $TOKEN \\
|
||||
# --discovery-token-ca-cert-hash $TOKEN_HASH
|
||||
#
|
||||
#------------------------------------------------------------------------------------
|
||||
#EOF
|
||||
#
|
||||
#kubectl get nodes
|
Loading…
x
Reference in New Issue
Block a user