Here we list a series of instructions to add or remove nodes from the cluster (for more info go here).
Remove nodes
You may want to remove master, worker, or etcd nodes from your existing cluster. This can be done by running the remove-node.yml playbook. First, all specified nodes will be drained, then stop some kubernetes services and delete some certificates, and finally execute the kubectl command to delete these nodes. Use --extra-vars flag to select the node(s) you want to delete
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
# If you don't remember them, find the node names in the inventory/mycluster/hosts.yml file $ ansible-playbook -i inventory/mycluster/hosts.yaml -b remove-node.yml --extra-vars "node=<node1>,<node2>" |
If the node you want to remove is not online, you should add reset_nodes=false and allow_ungraceful_removal=true to your extra-vars. Once the deletion process is finished, remember to delete the node from the inventory file.
...
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
# Use this playbook to add a worker node to the cluster $ ansible-playbook -i inventory/mycluster/hosts.yaml -b scale.yml [--limit=<node_name>name1>,<node_name2>] |
To save further processing time, you can use --limit=<node_name> flag to limit KS to avoid disturbing other nodes in the cluster. Before launching the playbook with this flag, it is advisable to launch the facts.yml playbook to refresh facts cache for all nodes.
Add master
Append the new host to the inventory and run cluster.yml (you can NOT use scale.yml for that).