向Kubernetes集羣添加/移除Nodenode
#關閉防火牆 systemctl stop firewalld #禁止防火牆開機啓動 systemctl disable firewalld #檢查selinux getenforce Disabled #端口檢查 #關閉防火牆 systemctl disable firewalld systemctl stop firewalld systemctl status firewalld
kubeadm join 10.0.0.39:6443 --token 4g0p8w.w5p29ukwvitim2ti --discovery-token-ca-cert-hash sha256:21d0adbfcb409dca97e655641573b2ee51c 77a212f194e20a307cb459e5f77c8
說明:這條命令必定保存好,由於後期無法重現的!!
在swarm1(Minion Node)上操做:linux
kubeadm join 10.0.0.39:6443 --token 4g0p8w.w5p29ukwvitim2ti --discovery-token-ca-cert-hash sha256:21d0adbfcb409dca97e655641573b2ee51c 77a212f194e20a307cb459e5f77c8
在swarm2(Master)上操做:git
kubectl get nodes NAME STATUS ROLES AGE VERSION swarm1 Ready <none> 3h v1.10.0 swarm2 Ready master 3h v1.10.0
swarm1加入集羣非常順利!github
kubectl drain swarm1 --delete-local-data --force --ignore-daemonsets kubectl delete node swarm1
在node2上執行:docker
kubeadm reset
添加Node出現的問題
#Minion Node一直處於notReady狀態,如:安全
kubectl get nodes NAME STATUS ROLES AGE VERSION swarm1 NotReady <none> 3h v1.10.0 swarm2 Ready master 3h v1.10.0
#緣由
(1)啓動kubelet的時候,會pull如下兩個鏡像(gcr.io/**),由於天朝網絡通常翻不了牆,不能成功pull,因此要本身找到這兩個docker鏡像。點擊images自行下載使用!網絡
k8s.gcr.io/kube-proxy-amd64 v1.10.0 6e6237849607 3 weeks ago 97.1 MB k8s.gcr.io/pause-amd64 3.1 da86e6ba6ca1 4 months ago 742 kB
(2)使用Kubeadm工具搭建的Kubernetes集羣,已經默認集成了安全策略,因此要將Master Node節點/etc/kubernetes/pki下的全部文件複製到Minion Node相同目錄下一份。因此在Master Node上執行:ide
scp /etc/kubernetes/pki/* root@{minion-ip}:/etc/kubernetes/pki