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

Enable the ability to cordon/uncordon/drain nodes #4006

Closed
deviantony opened this issue Jul 5, 2020 · 0 comments · Fixed by #4723
Closed

Enable the ability to cordon/uncordon/drain nodes #4006

deviantony opened this issue Jul 5, 2020 · 0 comments · Fixed by #4723
Assignees
Labels
area/kubernetes kind/enhancement Applied to Feature Requests layer/frontend Required changes impact the client/frontend

Comments

@deviantony
Copy link
Member

deviantony commented Jul 5, 2020

Requirements

Allow an administrator user to execute the following node operations: Drain, Cordon and Uncordon.

Required changes

Node details view

Add a new Availability property under status with a dropdown allowing the administrator user to change the Availability of the node.

The availability dropdown should contain the following options:

  • Active (uncordon)
  • Pause (cordon)
  • Drain (drain)

Once the user has selected a new Availability for the node, the update node and cancel button should be enabled.

Portainer - 2020-10-19T132635 347

Using the Cordon action should prompt the user with a confirmation modal with the following message: "Marking this node as unschedulable will effectively cordon the node and prevent any new workload from being scheduled on that node. Are you sure?"

Using the Drain action should prompt the user with a confirmation modal with the following message: "Draining this node will cause all workloads to be evicted from that node. This might lead to some service interruption. Are you sure?".

We should prevent any drain operation on a node if a drain operation is already in progress on another node. If a node is currently being drained, the Drain action should be disabled and a tooltip with the following message should be visible when hovering the Drain action: "Cannot use this action while another node is currently being drained."

Quoted from the kubernetes documentation:
"The kubectl drain command should only be issued to a single node at a time."

We should investigate and replicate the behavior of kubectl regarding the drain action (investigate what happens if kubectl fails during a drain action for example).

References

Based on this https://stackoverflow.com/a/57190700/1127536 Stackoverflow post it seems that it is possible to cordon/uncordon a node by changing the spec.unschedulable property of that node.

It also gives more details about the drain action which might require the following orchestration:

  1. cordon the node using the process above
  2. get the list of all the pods running on that node
  3. trigger an eviction of each pod in the list retrieved previously

The Eviction API can be used to programmatically evict pod: https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/#eviction-api

@deviantony deviantony added kind/enhancement Applied to Feature Requests priority/normal Core team priority layer/frontend Required changes impact the client/frontend area/kubernetes labels Jul 5, 2020
@deviantony deviantony added this to the 2.0 milestone Jul 5, 2020
@deviantony deviantony modified the milestones: 2.0, 2.1 Aug 9, 2020
@deviantony deviantony removed the priority/normal Core team priority label Aug 9, 2020
@deviantony deviantony removed this from the 2.1 milestone Oct 15, 2020
@MaximeBajeux MaximeBajeux self-assigned this Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes kind/enhancement Applied to Feature Requests layer/frontend Required changes impact the client/frontend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants