I have a machine running as a Kubernetes master. It's also a node in its cluster. I want to stop all the masterish stuff and leave it as a node I can join elsewhere. I also have the following constraints on it:
- No internet access (so I can't load software from repos onto it).
- The "master" is currently configured for a subnet it is not on so I can't actually talk to it (as is) with
kubectl
.
I'm hoping I can just systemctl stop
some services (e.g., etcd
, kube-{apiserver,controller-manager,scheduler}
and/or some docker containers and that's it. (Plus then kubeadm reset
and run the new join script of course.) But at this stage I don't even know whether systemctl stop
on the services keeps the docker containers from running, or vice versa.
(Of course if more is necessary in order to fully 'reset' this to be a plain node than just kubeadm reset
– like deleting configuration files – please explain that too.)
[Kubernetes v1.11.10, Ubuntu 16.04]
(If, to answer the question, you need to know how I got wedged this way I can edit this answer to add that but at this time it seems to me to be not needed to answer and it's tedious.)
(Also please don't suggest starting over including getting the internet connection back – e.g. to load software – because that can't happen.)
Best Answer
I've tested this scenario on Kubernetes v1.15.3.
I've done
kubeadm reset
on master node.As recommended I've flushed iptables and removed
$HOME/.kube/
directory.After that I've joined the server to another cluster as worker node using
kubeadm join
:This seems to work just fine and as explained in the docs kubeadm reset.
If you upgraded your k8s to v1.15.0 you could use
kubeadm reset phase
.