Can we reboot the actual nodes using kubectl remotely?


#1

Background:
We have a small cluster setup using kubeadm on 3 linux systems. Due to the amount of load we put in using scripts we run on nodes, there are some memory leaks and often need a reboot.

To schedule an automated reboot, I have setup a script to use kubectl and prepare cluster for shutdown using drain and cordon operations.

Now for the core part, i.e. to reboot the node, I was looking for options and just had this thought. Can’t we leverage kubernetes communication channel to reboot a node remotely? It would be much better than setting up the ssh keys and separate config to make a remote reboot operation.

I would appreciate any information related to the topic.

Thanks,
Krupal


#2

I really don’t know :-/

I’d have a look at plugins https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/. But not sure if they provide the functionality you need. There might be a road map somewhere, maybe :slight_smile:


#3

The short answer is no. There are very few imperative commands in the API. You can run a pod that riggers reboots, if that helps.


#4

Ok, thanks for the pointers, will look at the plugins. :slight_smile:


#5

Got it! That’s a great input, something local in the machine triggers the input based on some external event (i.e. pod spin up in this case). Thanks!