k8s node節(jié)點(diǎn)重新加入master集群的實(shí)現(xiàn)
1、刪除node節(jié)點(diǎn)
執(zhí)行kubectl delete node node01
2、這時(shí)如果直接執(zhí)行加入,會(huì)報(bào)錯(cuò)。如下:
[root@k8s-node02 pki]# kubeadm join 192.168.140.128:6443 --token abcdef.0123456789abcdef --discovery-token-ca-cert-hash sha256:a3d9827be411208258aea7f3ee9aa396956c0a77c8b570503dd677aa3b6eb6d8 [preflight] Running pre-flight checks [WARNING SystemVerification]: this Docker version is not on the list of validated versions: 19.03.12. Latest validated version: 18.09 error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf already exists [ERROR FileAvailable--etc-kubernetes-bootstrap-kubelet.conf]: /etc/kubernetes/bootstrap-kubelet.conf already exists [ERROR Port-10250]: Port 10250 is in use [ERROR FileAvailable--etc-kubernetes-pki-ca.crt]: /etc/kubernetes/pki/ca.crt already exists [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
解決方案:
根據(jù)報(bào)錯(cuò)可以看到端口被占用,配置文件可ca證書(shū)已經(jīng)生成,所以需要?jiǎng)h除這些配置文件和證書(shū),并且kill掉占用的端口。建議刪除之前先備份。
[root@k8s-node02 pki]# lsof -i:10250 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME kubelet 694 root 30u IPv6 26021 0t0 TCP *:10250 (LISTEN) [root@k8s-node02 pki]# kill -9 694 [root@k8s-node02 pki]# cd /etc/kubernetes/ [root@k8s-node02 kubernetes]# ls bootstrap-kubelet.conf kubelet.conf manifests pki [root@k8s-node02 kubernetes]# mv bootstrap-kubelet.conf bootstrap-kubelet.conf_bk [root@k8s-node02 kubernetes]# mv kubelet.conf kubelet.conf_bk [root@k8s-node02 kubernetes]# cd pki/ [root@k8s-node02 pki]# ls ca.crt [root@k8s-node02 pki]# rm -rf ca.crt
3、再次執(zhí)行加入,又出現(xiàn)報(bào)錯(cuò)。
[root@k8s-node02 ~]# kubeadm join 192.168.140.128:6443 --token abcdef.0123456789abcdef --discovery-token-ca-cert-hash sha256:a3d9827be411208258aea7f3ee9aa396956c0a77c8b570503dd677aa3b6eb6d8 [preflight] Running pre-flight checks [WARNING SystemVerification]: this Docker version is not on the list of validated versions: 19.03.12. Latest validated version: 18.09 [preflight] Reading configuration from the cluster... [preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml' [kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.15" ConfigMap in the kube-system namespace [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml" [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env" [kubelet-start] Activating the kubelet service [kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap... [kubelet-check] Initial timeout of 40s passed. error execution phase kubelet-start: error uploading crisocket: timed out waiting for the condition
解決方案:
執(zhí)行kubeadm reset子節(jié)點(diǎn)重置
[root@k8s-node02 ~]# kubeadm reset [reset] WARNING: Changes made to this host by 'kubeadm init' or 'kubeadm join' will be reverted. [reset] Are you sure you want to proceed? [y/N]: y [preflight] Running pre-flight checks W0710 10:22:57.487306 31093 removeetcdmember.go:79] [reset] No kubeadm config, using etcd pod spec to get data directory [reset] No etcd config found. Assuming external etcd [reset] Please, manually reset etcd to prevent further issues [reset] Stopping the kubelet service [reset] Unmounting mounted directories in "/var/lib/kubelet" [reset] Deleting contents of config directories: [/etc/kubernetes/manifests /etc/kubernetes/pki] [reset] Deleting files: [/etc/kubernetes/admin.conf /etc/kubernetes/kubelet.conf /etc/kubernetes/bootstrap-kubelet.conf /etc/kubernetes/controller-manager.conf /etc/kubernetes/scheduler.conf] [reset] Deleting contents of stateful directories: [/var/lib/kubelet /etc/cni/net.d /var/lib/dockershim /var/run/kubernetes] The reset process does not reset or clean up iptables rules or IPVS tables. If you wish to reset iptables, you must do so manually. For example: iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X If your cluster was setup to utilize IPVS, run ipvsadm --clear (or similar) to reset your system's IPVS tables. The reset process does not clean your kubeconfig files and you must remove them manually. Please, check the contents of the $HOME/.kube/config file.
4、最后執(zhí)行加入,問(wèn)題解決。
[root@k8s-node02 ~]# kubeadm join 192.168.140.128:6443 --token abcdef.0123456789abcdef --discovery-token-ca-cert-hash sha256:a3d9827be411208258aea7f3ee9aa396956c0a77c8b570503dd677aa3b6eb6d8 [preflight] Running pre-flight checks [WARNING SystemVerification]: this Docker version is not on the list of validated versions: 19.03.12. Latest validated version: 18.09 [preflight] Reading configuration from the cluster... [preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml' [kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.15" ConfigMap in the kube-system namespace [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml" [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env" [kubelet-start] Activating the kubelet service [kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap... This node has joined the cluster: * Certificate signing request was sent to apiserver and a response was received. * The Kubelet was informed of the new secure connection details. Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
5、查看master節(jié)點(diǎn),加入成功。
[root@k8s-master01 ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION k8s-master01 Ready master 120m v1.15.1 k8s-node01 Ready <none> 100m v1.15.1 k8s-node02 Ready <none> 83m v1.15.1
到此這篇關(guān)于k8s node節(jié)點(diǎn)重新加入master集群的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)k8s node master集群內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Nodejs 構(gòu)建Cluster集群多線(xiàn)程Worker threads
這篇文章主要為大家介紹了Nodejs 構(gòu)建Cluster集群多線(xiàn)程Worker threads示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-10-10node.js中的console.warn方法使用說(shuō)明
這篇文章主要介紹了node.js中的console.warn方法使用說(shuō)明,本文介紹了console.warn的方法說(shuō)明、語(yǔ)法、接收參數(shù)、使用實(shí)例和實(shí)現(xiàn)源碼,需要的朋友可以參考下2014-12-12初學(xué)者如何快速搭建Express開(kāi)發(fā)系統(tǒng)步驟詳解
這篇文章主要介紹了初學(xué)者如何快速搭建Express開(kāi)發(fā)系統(tǒng),結(jié)合實(shí)例形式詳細(xì)分析了express框架搭建的具體步驟與相關(guān)注意事項(xiàng),需要的朋友可以參考下2023-05-05Node.js巧妙實(shí)現(xiàn)Web應(yīng)用代碼熱更新
本文給大家講解的是Node.js的代碼熱更新的問(wèn)題,其主要實(shí)現(xiàn)原理 是怎么對(duì) module 對(duì)象做處理,也就是手工監(jiān)聽(tīng)文件修改, 然后清楚模塊緩存, 重新掛載模塊,思路清晰考慮細(xì)致, 雖然有點(diǎn)冗余代碼,但還是推薦給大家2015-10-10Mac下通過(guò)brew安裝指定版本的nodejs教程
今天小編就為大家分享一篇Mac下通過(guò)brew安裝指定版本的nodejs教程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-05-05如何自定義node版本,實(shí)現(xiàn)node多版本控制方式
這篇文章主要介紹了如何自定義node版本,實(shí)現(xiàn)node多版本控制方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-04-04node.js中的fs.lstatSync方法使用說(shuō)明
這篇文章主要介紹了node.js中的fs.lstatSync方法使用說(shuō)明,本文介紹了fs.lstatSync的方法說(shuō)明、語(yǔ)法、接收參數(shù)、使用實(shí)例和實(shí)現(xiàn)源碼,需要的朋友可以參考下2014-12-12