红联Linux门户
Linux帮助

kubenetes 1.4的Master节点克隆并改造为node节点以及node查询

发布时间:2016-11-01 11:10:14来源:linux网站作者:wiborgite
背景信息
Kubernetes 是在Vmare中的虚拟机中安装的,因此先安装了master节点,服务验证OK好,将master节点克隆一套,并将其改造为node节点,在join到master节点。
 
操作步骤:
1.停止原有kube模块
kubectl delete -f /etc/kubernetes/manifests  
systemctl stop kubelet;  
docker rm -f -v $(docker ps -q);  
find /var/lib/kubelet | xargs -n 1 findmnt -n -t tmpfs -o TARGET -T | uniq | xargs -r umount -v;
rm -r -f /etc/kubernetes /var/lib/kubelet /var/lib/etcd;  
 
2.启动为Node节点
systemctl start kubelet  
kubeadm join    
 
3.join到master节点
root@ubuntu:/etc/kubernetes# kubeadm join --token c54bcd.35a9ea8872b99b35 192.168.170.132  
<util/tokens> validating provided token  
<node/discovery> created cluster info discovery client, requesting info from "http://192.168.170.132:9898/cluster-info/v1/?token-id=c54bcd"  
<node/discovery> cluster info object received, verifying signature using given token  
<node/discovery> cluster info signature and contents are valid, will use API endpoints [https://192.168.170.132:443]  
<node/csr> created API client to obtain unique certificate for this node, generating keys and certificate signing request  
<node/csr> received signed certificate from the API server, generating kubelet configuration  
<util/kubeconfig> created "/etc/kubernetes/kubelet.conf"  
Node join complete:  
* Certificate signing request sent to master and response received.  
* Kubelet informed of new secure connection details.  
Run 'kubectl get nodes' on the master to see this machine join.  
 
4.在master节点通过kubectl get nodes查看却只能查询到master节点的node。
考虑了下,由于是克隆的,因此两个节点的主机名一样,可能会是这个问题,因此修改了node节点的主机名并重启了机器。
 
5.在master节点重新查询nodes,可以得到全部信息,如下所示:
root@ubuntu:/etc/kubernetes/manifests# kubectl get nodes  
NAME      STATUS    AGE  
ubuntu    Ready     1d  
ubuntu2   Ready     1h
 
本文永久更新地址:http://www.linuxdiyf.com/linux/25626.html