首先,所有服务器k8s、docker都是正常运行
1.kubernetes添加节点:(在node节点上执行)
kubeadm join --token {k8s生成的token} {k8s-master-ip-port} --discovery-token-ca-cert-hash {ca证书sha256编码hash值}
例子:
kubeadm join --token cc01d7.70c869455091964e 172.16.13.160:6443 --discovery-token-ca-cert-hash sha256:347b49a28d5394140676c6010cc457044567347943a6542a23c9364a58039015
2.重新生成kubernetes token:
kubeadm token create
3.查看新生成的token:
kubeadm token list
4.获取ca证书的sha256编码hash值:
openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'
5.查看kubernetes添加的节点:
kubectl get nodes
6.kubernetes删除节点:
kubectl delete node {nodename}