Skip to content
Snippets Groups Projects
Unverified Commit a9e11623 authored by Samuel Liu's avatar Samuel Liu Committed by GitHub
Browse files

fix remove node (#6666)

parent a870dd36
Branches
Tags
No related merge requests found
...@@ -69,9 +69,9 @@ ansible-playbook -i inventory/mycluster/hosts.yml remove-node.yml -b -v \ ...@@ -69,9 +69,9 @@ ansible-playbook -i inventory/mycluster/hosts.yml remove-node.yml -b -v \
--extra-vars "node=nodename,nodename2" --extra-vars "node=nodename,nodename2"
``` ```
If a node is completely unreachable by ssh, add `--extra-vars reset_nodes=no` If a node is completely unreachable by ssh, add `--extra-vars reset_nodes=false`
to skip the node reset step. If one node is unavailable, but others you wish to skip the node reset step. If one node is unavailable, but others you wish
to remove are able to connect via SSH, you could set reset_nodes=no as a host to remove are able to connect via SSH, you could set `reset_nodes=false` as a host
var in inventory. var in inventory.
## Connecting to Kubernetes ## Connecting to Kubernetes
......
...@@ -70,7 +70,7 @@ Before using `--limit` run playbook `facts.yml` without the limit to refresh fac ...@@ -70,7 +70,7 @@ Before using `--limit` run playbook `facts.yml` without the limit to refresh fac
With the old node still in the inventory, run `remove-node.yml`. You need to pass `-e node=NODE_NAME` to the playbook to limit the execution to the node being removed. With the old node still in the inventory, run `remove-node.yml`. You need to pass `-e node=NODE_NAME` to the playbook to limit the execution to the node being removed.
If the node you want to remove is not online, you should add `reset_nodes=false` to your extra-vars: `-e node=NODE_NAME reset_nodes=false`. If the node you want to remove is not online, you should add `reset_nodes=false` to your extra-vars: `-e node=NODE_NAME -e reset_nodes=false`.
Use this flag even when you remove other types of nodes like a master or etcd nodes. Use this flag even when you remove other types of nodes like a master or etcd nodes.
### 5) Remove the node from the inventory ### 5) Remove the node from the inventory
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
msg: "Delete nodes confirmation failed" msg: "Delete nodes confirmation failed"
when: delete_nodes_confirmation != "yes" when: delete_nodes_confirmation != "yes"
- hosts: kube-master - hosts: kube-master[0]
gather_facts: no gather_facts: no
roles: roles:
- { role: kubespray-defaults } - { role: kubespray-defaults }
...@@ -41,15 +41,15 @@ ...@@ -41,15 +41,15 @@
- hosts: "{{ node | default('kube-node') }}" - hosts: "{{ node | default('kube-node') }}"
gather_facts: no gather_facts: no
roles: roles:
- { role: kubespray-defaults } - { role: kubespray-defaults, when: reset_nodes|default(True)|bool }
- { role: bootstrap-os, tags: bootstrap-os } - { role: bootstrap-os, tags: bootstrap-os, when: reset_nodes|default(True)|bool }
- { role: remove-node/remove-etcd-node} - { role: remove-node/remove-etcd-node }
- { role: reset, tags: reset, when: reset_nodes|default(True) } - { role: reset, tags: reset, when: reset_nodes|default(True)|bool }
# Currently cannot remove first master or etcd # Currently cannot remove first master or etcd
- hosts: "{{ node | default('kube-master[1:]:etcd[1:]') }}" - hosts: "{{ node | default('kube-master[1:]:etcd[1:]') }}"
gather_facts: no gather_facts: no
roles: roles:
- { role: kubespray-defaults } - { role: kubespray-defaults, when: reset_nodes|default(True)|bool }
- { role: bootstrap-os, tags: bootstrap-os} - { role: bootstrap-os, tags: bootstrap-os, when: reset_nodes|default(True)|bool }
- { role: remove-node/post-remove, tags: post-remove } - { role: remove-node/post-remove, tags: post-remove }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment