k3s+TailScale(伪)一键部署脚本
1. 在所有节点上安装 TailScale
curl -fsSL https://tailscale.com/install.sh | sh2. 生成 key, 勾选Reusable, 复制生成的Key
3. 添加 Auto Approves
4. 在 Server 上执行如下脚本
export TAILSCALE_KEY=<刚才复制的TailScale Key> export INSTALL_K3S_MIRROR=cn export INSTALL_K3S_EXEC="server --vpn-auth=name=tailscale,joinKey=$TAILSCALE_KEY --node-external-ip=$(tailscale ip --4)" curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | sh - echo "复制如下命令, 在Agent上执行" cat << EOF export INSTALL_K3S_MIRROR=cn export TAILSCALE_KEY=$(TAILSCALE_KEY) export K3S_TOKEN=$(sudo cat /var/lib/rancher/k3s/server/node-token) export INSTALL_K3S_EXEC="agent --vpn-auth=name=tailscale,joinKey=$TAILSCALE_KEY --server https://$(tailscale ip --4):6443 --node-external-ip=\$(tailscale ip --4)" curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | sh - EOF5. 复制刚才的脚本输出(最后几句, 请注意), 在 Agent 上执行
