目录
Please enable Javascript to view the contents

RKE 节点清理指南

 ·  ☕ 1 分钟

重要

部署异常需要重来时,仅 rke remove 不够——需要清理节点上残留的容器、镜像、网络接口和目录。

环境说明

  • rke v1.2.6
  • K8s v1.19.6

步骤

1. Drain 节点

1
kubectl drain <node-name> --ignore-daemonsets

2. 移除节点

编辑 cluster.yml,从 nodes 列表删除该节点,然后:

1
rke remove --config cluster.yml

3. 清理节点

在目标节点执行清理脚本:extended-cleanup-rancher2.sh

1
sudo bash extended-cleanup-rancher2.sh

可选参数:

参数作用
-f刷新所有 iptables 规则
-i删除所有容器镜像

该脚本会删除与 Rancher/K8s 相关的所有容器、卷、镜像、网络接口和目录。不适用于 rke2 和 k3s。

4. 重启节点

1
reboot

5. 重新部署

更新 cluster.yml,将节点加回 nodes 列表,重新执行 rke up

分享

Hex
作者
Hex
CloudNative Developer