c12s-kubespray/roles/remove-node/post-remove/tasks/main.yml
Max Gautier 6c1ab24981
Limit kubectl delete node to k8s nodes (#8101)
* Limit kubectl delete node to k8s nodes

This avoids the use of `kubectl delete node` when removing etcd nodes
which are not part of the cluser (separate etcd)

* Take errors into account when deleting node

There should not be error now that we're limiting the deletion to nodes
actually in the cluster

* Retrying on error
2021-11-08 02:22:58 -08:00

10 lines
413 B
YAML

---
- name: Delete node
command: "{{ bin_dir }}/kubectl delete node {{ kube_override_hostname|default(inventory_hostname) }}"
delegate_to: "{{ groups['kube_control_plane']|first }}"
when: inventory_hostname in groups['k8s_cluster']
retries: 10
# Sometimes the api-server can have a short window of indisponibility when we delete a master node
delay: 3
register: result
until: result is not failed