Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add new Kubernetes minion to current cluster

I have a Kubernetes cluster running on 3 servers, a master and 2 minions. I would like to add another minion. Is it possible to add a minion without having to do the complete installation again? So far when searching for guides to do this, I can only find excellent guides on getting the whole cluster up.

like image 492
Ms.D Avatar asked Apr 15 '15 15:04

Ms.D


2 Answers

For me the difference between a master and a minion are the processes that get started and the orchestration (the master signals the minions that it is done and they can now come up, the minions wait for the signal). To bring up a minion after things are up would not be any different, except the signaling is already done, so the minion will just come up. This looked like a reasonable experiment to me, so I thought I'd try it! I am running in the digital ocean vps, using coreos (stable) and cloud-config to bring up fleet + flanneld + k8s. On the master I have:

  • etcd
  • fleet
  • flanneld
  • docker
  • kube-apiserver
  • kube-controller-manager
  • kube-scheduler
  • kube-register

The important process here is kube-register. I look at its output with :

journalctl -u kube-register

to see when minions register. To see all the minions that I currently have :

core@pa1 ~/tmp $ kubectl get minions
NAME              LABELS    STATUS
104.236.214.244   <none>    Ready
104.236.31.77     <none>    Ready

On the minion for processes I have:

  • fleet
  • flanneld
  • docker
  • kube-proxy
  • kube-kubelet

I think the kube-kubelet is the thing that registers with the master, but I could be wrong. I do know that the master constantly queries the kubelet for healthz, so it knows if a minion is ready for work. Anyway, I have a script that creates my cloud config for the master and for the minions. I just modified that script to 'skip' the master cloud config and just do the minion config. I run it and here is my minions now:

core@pa1 / $ kubectl get minions
NAME              LABELS    STATUS
104.236.214.244   <none>    Ready
104.236.31.77     <none>    Ready
45.55.164.39      <none>    Ready

So, long story even longer, yes, it is possible to add a minion to an existing node cluster. I don't know how you are doing discovery, but, whatever method you used to 'introduce' your minion to the master in the first place will work.

like image 152
Greg Avatar answered Nov 18 '22 13:11

Greg


I was stuck on this for awhile too. I found the solution was surprisingly simple.

If you already have a master up, start the following processes on an unconnected minion in the order they appear. (I imagine you can start a similiar network overlay first if you're using a different one).

/opt/bin/flanneld --etcd-endpoints=http://<masterip>:4001
/opt/bin/kubelet --address=0.0.0.0 --port=10250 --hostname-override=<localhostip> --api-servers=http://<masterip>:8080 --logtostderr=true --cluster-domain=cluster.local --cluster-dns=192.168.3.10
/opt/bin/kube-proxy --master=http://<masterip> --logtostderr=true

If in doubt, just look at one of your connected minon's processes to see what flags that each process is running with.

like image 22
Carlin Avatar answered Nov 18 '22 14:11

Carlin