Skip to content

Commit

Permalink
更新删除节点脚本和文档
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmzj committed Feb 19, 2019
1 parent 9df8906 commit a80351e
Show file tree
Hide file tree
Showing 3 changed files with 208 additions and 191 deletions.
4 changes: 3 additions & 1 deletion 99.clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@
- "/etc/systemd/system/etcd.service"

# to clean 'lb' nodes
- hosts: lb
- hosts:
- lb
- ex-lb
tasks:
- name: stop keepalived service
shell: systemctl disable keepalived && systemctl stop keepalived
Expand Down
17 changes: 12 additions & 5 deletions docs/op/del_one_node.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,29 @@

## 删除流程解释

- 0.获取待删除节点参数`NODE_TO_DEL`
- 1.待删除节点可能是kube-node节点,因此先执行`kubectl drain`,如果不是忽略执行报错
- 2.参照`99.clean.yml`脚本方式删除节点可能的服务和配置,忽略执行报错
- 3.待删除节点可能是kube-node节点,执行`kubectl delete node`, 如果不是忽略执行报错
- 4.修改ansible hosts,移除删除节点

## 删除操作

- 1.替换待删除节点变量,假设为192.168.1.1
- 假设待删除节点为 192.168.1.1

``` bash
$ sed -i 's/NODE_TO_DEL/192.168.1.1/g' /etc/ansible/tools/clean_one_node.yml
```
# 带参数执行如下
$ ansible-playbook /etc/ansible/tools/clean_one_node.yml -e NODE_TO_DEL=192.168.1.1

- 2.执行删除
```
# 或者不带参数执行,然后根据提示输入/确认
$ ansible-playbook /etc/ansible/tools/clean_one_node.yml
```

## 验证

- 验证删除节点上是否相关服务均已停止
- 验证 ansible hosts 文件中已删除节点

## Debug

如果出现清理失败,类似报错:`... Device or resource busy: '/var/run/docker/netns/xxxxxxxxxx'`,需要手动umount该目录后重新清理
Expand Down
Loading

0 comments on commit a80351e

Please sign in to comment.