c12s-kubespray/roles/remove-node/pre-remove/tasks/main.yml
bobahspb a3fff1e438 cordon all deleted nodes before drain (#4756)
Kubespray waits exit of every drain before run other one.
Running drain every after each other seems better than parallel, because we should check resources availability every time.
But, this way, we have one additional problem: possible restart pods on the nodes that are killed little bit later.
Fast cordon before heavy drain seems like an easy solution.
2019-05-21 23:36:05 -07:00

25 lines
805 B
YAML

---
- name: cordon-node | Mark all nodes as unschedulable before drain
command: >-
{{ bin_dir }}/kubectl cordon {{ item }}
with_items:
- "{{ node.split(',') | default(groups['kube-node']) }}"
failed_when: false
delegate_to: "{{ groups['kube-master']|first }}"
run_once: true
ignore_errors: yes
- name: remove-node | Drain node except daemonsets resource
command: >-
{{ bin_dir }}/kubectl --kubeconfig /etc/kubernetes/admin.conf drain
--force
--ignore-daemonsets
--grace-period {{ drain_grace_period }}
--timeout {{ drain_timeout }}
--delete-local-data {{ item }}
with_items:
- "{{ node.split(',') | default(groups['kube-node']) }}"
failed_when: false
delegate_to: "{{ groups['kube-master']|first }}"
run_once: true
ignore_errors: yes