k8s 手動重裝系統(因各類緣由)

K8s 節點 重裝系統:

準備工做:

1. 備份配置和服務啓動文件:

a. 既是k8s 節點,同時也是 etcd 節點

tar zcvf k8s3.tgz  /etc/ssl/etcd /etc/kubernetes /etc/systemd/system/etcd.service /etc/systemd/system/kubelet.service /etc/etcd.env  /etc/nginx/nginx.conf  /etc/cni/  /etc/calico/ /opt/cni /usr/local/bin/ 

            b. 只是單純的k8s 節點,不是etcd 節點:

tar zcvf k8s13.tgz  /etc/ssl/etcd /etc/kubernetes  /etc/systemd/system/kubelet.service  /etc/nginx/nginx.conf  /etc/cni/  /etc/calico/ /opt/cni /usr/local/bin/

2. 重裝系統:

tencent-server —reinstall  ins-q5113a3n

3. 還原備份文件

4. 此時由於etcd 集羣中 已經存在了etcd3,而系統又重裝過了,因此須要把原來的 etcd3 刪除,而後 在從新加入

a.  查看 etcd3 節點的 Id:

etcdctl   --ca-file /etc/ssl/etcd/ssl/ca.pem --cert-file /etc/ssl/etcd/ssl/node-k8s1.pem --key-file /etc/ssl/etcd/ssl/node-k8s1-key.pem --endpoints 'https://172.17.0.8:2379' member list

            b. 刪除 etcd3 節點:

etcdctl   --ca-file /etc/ssl/etcd/ssl/ca.pem --cert-file /etc/ssl/etcd/ssl/node-k8s1.pem --key-file /etc/ssl/etcd/ssl/node-k8s1-key.pem --endpoints 'https://172.17.0.8:2379' member remove e1045a04cac35523

            c. 添加 etcd3 節點:

etcdctl   --ca-file /etc/ssl/etcd/ssl/ca.pem --cert-file /etc/ssl/etcd/ssl/node-k8s1.pem --key-file /etc/ssl/etcd/ssl/node-k8s1-key.pem --endpoints 'https://172.17.0.8:2379' member add etcd3 https://172.17.0.6:2380 

            d. 清空etcd3 節點數據
                rm -rf /var/lib/etcd/*
相關文章
相關標籤/搜索