Rancher 误删除下游 RKE2 集群节点恢复方法

如果通过 Rancher UI 误删除了下游 RKE2 集群节点,最简单的恢复方式是重新注册节点;若涉及节点数量较多且需要快速恢复,可通过恢复 local 集群和下游 RKE2 集群的 ETCD 快照来完成恢复。

需要注意的是,仅恢复下游 RKE2 集群的 ETCD 快照是不够的。对于 Custom 类型的 RKE2 集群,每个节点在 local 集群中都对应有 Machine 等资源,因此需要一并考虑恢复。

此方法需要确保 local 集群和下游 RKE2 集群都有删除操作前的 ETCD 快照备份。

恢复 local 集群 ETCD 快照

此处测试,local 同样为 RKE2 集群,执行如下操作:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
root@test-1:~# rke2 etcd-snapshot ls
WARN[0000] Unknown flag --token found in config.yaml, skipping
WARN[0000] Unknown flag --tls-san found in config.yaml, skipping
WARN[0000] Unknown flag --tls-san found in config.yaml, skipping
WARN[0000] Unknown flag --system-default-registry found in config.yaml, skipping
Name Location Size Created
on-demand-test-1-1765953512 file:///var/lib/rancher/rke2/server/db/snapshots/on-demand-test-1-1765953512 36634656 2025-12-17T14:38:32+08:00

root@test-1:~# systemctl stop rke2-server

root@test-1:~# rke2 server \
--cluster-reset \
--cluster-reset-restore-path=/var/lib/rancher/rke2/server/db/snapshots/on-demand-test-1-1765953512

root@test-1:~# systemctl start rke2-server

恢复后,在 Rancher UI 查看 Machine 资源是否恢复:

恢复下游 RKE2 集群 ETCD 快照

可以直接通过 Rancher UI 进行恢复:

恢复完成:

Author

Warner Chen

Posted on

2025-12-17

Updated on

2025-12-17

Licensed under

You need to set install_url to use ShareThis. Please set it in _config.yml.
You forgot to set the business or currency_code for Paypal. Please set it in _config.yml.

Comments

You forgot to set the shortname for Disqus. Please set it in _config.yml.