feat(k01): add agent join mode to install-k3s.sh

This commit is contained in:
zetaloop
2026-05-05 12:29:56 +08:00
parent c456f3e296
commit e92bdf30d9
2 changed files with 58 additions and 36 deletions
+9 -15
View File
@@ -64,27 +64,21 @@ CNPG 每个 Cluster Ready 后自动生成 `<cluster>-app` Secretusername/pass
## 加节点
在 server 上取 token
```bash
cat /var/lib/rancher/k3s/server/node-token
```
新机器上执行:
```bash
cd /root/juwan-backend/deploy/k01
bash install-k3s.sh agent
echo "<zot-admin-password>" > /root/registry-password && chmod 600 /root/registry-password
K3S_URL=https://<server-ip>:6443 K3S_TOKEN=<token> bash install-k3s.sh agent
```
`install-k3s.sh agent` 会自动从 server 取 node-token 并加入集群。也可以手动操作:
```bash
cat /var/lib/rancher/k3s/server/node-token
curl -sfL https://get.k3s.io | \
K3S_URL=https://<server-ip>:6443 K3S_TOKEN=<token> \
sh -
scp root@<server-ip>:/etc/rancher/k3s/registries.yaml /etc/rancher/k3s/
systemctl restart k3s-agent
```
pod 调度由 k3s 自动分配。有状态 pod 如需固定在某台节点上,可加 `nodeSelector`
## 日常操作
```bash