Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodes are Deleted after Unsuccessful Drain #7137

Closed
dlouks opened this issue Jan 12, 2021 · 2 comments · Fixed by #7151
Closed

Nodes are Deleted after Unsuccessful Drain #7137

dlouks opened this issue Jan 12, 2021 · 2 comments · Fixed by #7151
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@dlouks
Copy link
Contributor

dlouks commented Jan 12, 2021

Environment:

  • Cloud provider or hardware configuration: vsphere

  • OS (printf "$(uname -srm)\n$(cat /etc/os-release)\n"): CentoOS 7

  • Version of Ansible (ansible --version): 2.9.16

  • Version of Python (python --version): 2.7.5

Kubespray version (commit) (git rev-parse --short HEAD): 5517e62

Network plugin used: Calico

Command: ansible-playbook remove-node.yml -i hosts.ini -e node=NODE_NAME -e reset_nodes=false

Task with Bug

- name: remove-node | Drain node except daemonsets resource # noqa 301

When Draining nodes from a Kubespray cluster, it is possible to hit a scenario where the drain does not complete and the drain_grace_period and drain_timeout are hit and the task fails. Since ignore_errors is set to true, things move on as if no error occurred and ultimately the role remove-node/post-remove which runs deletes the node prior to being drained.

In my case the pod being drained was waiting for a another pod to come up to satisfy a disruption budget, and ideally the drain would have failed and the node would not have been deleted. To further complicate the issue, the pod that had the node deleted from under it had a persistent volume, so the pod fails to start up on another node because the volume can't be mounted twice.

I'd like to propose the following improvements to handle node draining with more care

  • Add retries to the drain task to give more than one chance to connect and drain.
  • Remove ignore_errors from drain tasks
@dlouks dlouks added the kind/bug Categorizes issue or PR as related to a bug. label Jan 12, 2021
@dlouks
Copy link
Contributor Author

dlouks commented Jan 12, 2021

/assign

@dlouks dlouks changed the title Nodes are Deleted after Drain Failures or When Draining Failures Nodes are Deleted after Drain Failure or Connection Failure on Drain Task Jan 12, 2021
@dlouks dlouks changed the title Nodes are Deleted after Drain Failure or Connection Failure on Drain Task Nodes are Deleted after Unsuccessful Drain Jan 12, 2021
@dlouks
Copy link
Contributor Author

dlouks commented Jan 12, 2021

I don't see the need for the extra cordon step since draining does that already. Removing it.

- name: cordon-node | Mark all nodes as unschedulable before drain # noqa 301

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant