简体   繁体   English

如何将新的Kubernetes minion添加到当前集群

[英]How to add new Kubernetes minion to current cluster

I have a Kubernetes cluster running on 3 servers, a master and 2 minions. 我有一个在3台服务器上运行的Kubernetes集群,一个主服务器和2个服务器。 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. 到目前为止,在搜索指南时,我只能找到有关整个群集的优秀指南。

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. 我在数字海洋vps中运行,使用coreos(稳定)和cloud-config来调出fleet + flanneld + k8s。 On the master I have: 在主人身上我有:

  • etcd ETCD
  • fleet 舰队
  • flanneld flanneld
  • docker 搬运工人
  • kube-apiserver KUBE-API服务器
  • kube-controller-manager KUBE-控制器经理
  • kube-scheduler KUBE-调度
  • kube-register KUBE-寄存器

The important process here is kube-register. 这里重要的过程是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 flanneld
  • docker 搬运工人
  • kube-proxy KUBE-代理
  • kube-kubelet KUBE-kubelet

I think the kube-kubelet is the thing that registers with the master, but I could be wrong. 我认为kube-kubelet是向主人注册的东西,但我可能是错的。 I do know that the master constantly queries the kubelet for healthz, so it knows if a minion is ready for work. 我知道大师经常在kubelet上查询healthz,所以它知道一个小兵是否准备好工作了。 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. 我刚刚修改了该脚本以“跳过”主云配置并且只进行了minion配置。 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. 因此,长篇故事甚至更长,是的,可以将minion添加到现有节点集群。 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. 我不知道你是如何进行发现的,但是,无论你以前用什么方法将你的小兵“介绍”给主人都会有效。

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. 如果您已经拥有一个主人,请按照它们出现的顺序在未连接的minion上启动以下过程。 (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. 如果有疑问,只需查看一个连接的minon进程,看看每个进程运行的标志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM