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

Cordon, drain and remove a node from the cluster when running kubeadm reset #42

Closed
mikedanese opened this issue Nov 22, 2016 · 18 comments
Closed
Assignees
Labels
priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. state/PR-pending
Milestone

Comments

@mikedanese
Copy link
Member

From @bruceauyeung on October 9, 2016 2:32

currently kubeadm command provides a command join to join a cluster. but there isn't a command to leave that cluster. maybe kubeadm leave is suitable for this circumstance

kubeadm version

version.Info{Major:"1", Minor:"5+", GitVersion:"v1.5.0-alpha.0.1534+cf7301f16c0363-dirty", GitCommit:"cf7301f16c036363c4fdcb5d4d0c867720214598", GitTreeState:"dirty", BuildDate:"2016-09-27T18:10:39Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}

Copied from original issue: kubernetes/kubernetes#34404

@mikedanese
Copy link
Member Author

From @errordeveloper on October 13, 2016 9:18

This makes sense to add. Are you envisioning re-joining another cluster or simplify clean-up and recycle nodes? Right now you can just throw away a node and run kubectl delete node <name> to deregister it.

@mikedanese
Copy link
Member Author

From @pires on October 14, 2016 20:0

@luxas please assign this to me.

@mikedanese
Copy link
Member Author

From @pires on October 14, 2016 20:55

I'll add this behavior after #34807 lands, such that both
kubeadm reset and kubeadm leave result in the node been marked as unschedulable to the cluster.

Thoughts @luxas @errordeveloper?

@mikedanese
Copy link
Member Author

From @pires on November 8, 2016 9:22

This is a list of potential execution steps:

  • Mark current node as unshedulable aka cordon the node
  • Drain the node
  • Restart the kubelet with empty or default values, e.g. crash-loop until an API server is provided

1 - Existing kubectl code living in pkg/kubectl/cmd/drain.go should be either re-used or adapted.
2 - kubeadm reset should execute similarly, differing only in the last step where instead of restarting, it should stop the kubelet.

Thoughts?

@pires
Copy link
Contributor

pires commented Nov 23, 2016

Restart the kubelet with empty or default values, e.g. crash-loop until an API server is provided

I raised discussion about how to change kubelet flags in #64.

Really need thoughts before proceeding.

@luxas
Copy link
Member

luxas commented Nov 23, 2016

We need to discuss what the semantics would be regarding leave vs reset.
Could we just fix reset to actually remove the node from the cluster as well (right now the node will be left in kubectl get no with status NotReady)

What would the use-case for leave be that reset wouldn't do?

@pires
Copy link
Contributor

pires commented Nov 23, 2016

@luxas leaving a cluster is different than resetting everything, including stopping the kubelet. But I agree both should perform node cordon and drain.

@luxas
Copy link
Member

luxas commented Nov 23, 2016

@pires so when would you leave but not reset?
That's what I want to know...

Are you thinking about something like a node restart? But that can be fixed with a plain kubectl command...
I just want to figure out the use case for leave

@pires
Copy link
Contributor

pires commented Nov 23, 2016

@luxas i joined master 1. now i want my node to join a different master. Leave is just reset but with keeping the system ready to re-run kubeadm join. More importantly to me, reset needs to cordon and drain.

@luxas
Copy link
Member

luxas commented Nov 23, 2016

To me it sounds like you want:

  • reset to do cordon and drain (which I'm a huge +1 on, I just haven't had that extra time)
  • leave to just run reset and systemctl start kubelet

And it sounds like leave then is unnecessary (unless we decide to rename reset to leave indeed)
We could consider reset to run systemctl start kubelet as well, but I think we should prefer to have as little interaction with systemd as possible. In fact, I would be more in favor for automatically trying to start the kubelet in that case.

@errordeveloper
Copy link
Member

I agree that 'leave' doesn't seem necessary. I would rather contemplate
'join --reset'.

On Wed, 23 Nov 2016, 17:43 Lucas Käldström, notifications@github.com
wrote:

To me it sounds like you want:

  • reset to do cordon and drain (which I'm a huge +1 on, I just haven't
    had that extra time)
  • leave to just run reset and systemctl start kubelet

And it sounds like leave then is unnecessary (unless we decide to rename
reset to leave indeed)
We could consider reset to run systemctl start kubelet as well, but I
think we should prefer to have as little interaction with systemd as
possible. In fact, I would be more in favor for automatically trying to
start the kubelet in that case.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#42 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPWS727rwkOLFI2pxH-z8bEu-AKJBQdks5rBHs2gaJpZM4K5xyN
.

@luxas
Copy link
Member

luxas commented Nov 23, 2016

@errordeveloper I still want the top-level command, but I think we can just do fine with reset (or leave if we want to call it that)

@pires
Copy link
Contributor

pires commented Nov 23, 2016

Feel free to reassign this to anyone else.

@luxas luxas changed the title there should be a way to leave cluster in kubeadm Cordon, drain and remove a node from the cluster when running kubeadm reset Nov 23, 2016
@luxas luxas assigned luxas and unassigned pires Nov 23, 2016
@kad
Copy link
Member

kad commented Nov 23, 2016

reset is applicable for both master and slave nodes, where leave mostly for non-master nodes (where graceful shutdown and removing from cluster is needed)

@luxas luxas added kind/enhancement priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Nov 25, 2016
@luxas luxas added this to the v1.6 milestone Nov 25, 2016
@luxas
Copy link
Member

luxas commented Dec 6, 2016

The PR is here: kubernetes/kubernetes#37831

@luxas
Copy link
Member

luxas commented Dec 11, 2016

Fixed with kubernetes/kubernetes#37568

@cheburakshu
Copy link

@luxas kubeadm reset does not delete the network interfaces. It does delete the /etc/cni/net.d though. Should it not do a complete reset? I did raise an issue with weavenet here, but it is more of a kubeadm cleanup issue.

@luxas
Copy link
Member

luxas commented Apr 28, 2017

@cheburakshu Cleaning up the network is hard; you're free to install whatever networking solution you want, so therefore kubeadm can't know how to cleanup something it hasn't installed.

Unfortunately this is out of scope for kubeadm, we can't build in cleanup solutions for every single network provider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. state/PR-pending
Projects
None yet
Development

No branches or pull requests

6 participants