k8s叢集刪除和新增node節點
在已有k8s雲平臺中誤刪除node節點,然後將誤刪除的節點新增進叢集中。如果是一臺新伺服器必須還要安裝docker和k8s基礎元件。
1.檢視節點數和刪除node節點(master節點)
[root@k8s01 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s01 Ready master 40d v1.15.3
k8s02 Ready <none> 40d v1.15.3
k8s03 Ready <none> 40d v1.15.3
[root@k8s01 ~]# kubectl delete nodes k8s03
node "k8s03" deleted
[root@k8s01 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s01 Ready master 40d v1.15.3
k8s02 Ready <none> 40d v1.15.3
[root@k8s01 ~]#
2.在被刪除的node節點清空叢集資訊
[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
W1017 15:43:41.491522 3010 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]
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
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.
[root@k8s03 ~]#
3.在master節點檢視叢集的token值
[root@k8s01 ~]# kubeadm token create --print-join-command
kubeadm join 192.168.54.128:6443 --token mg4o13.4ilr1oi605tj850w --discovery-token-ca-cert-hash sha256:363b5b8525ddb86f4dc157f059e40c864223add26ef53d0cfc9becc3cbae8ad3
[root@k8s01 ~]#
4.將node節點重新新增到k8s叢集中
[preflight] Running pre-flight checks
[WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at
[WARNING SystemVerification]: this Docker version is not on the list of validated versions: 19.03.2. 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...
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.
[root@k8s03 ~]#
5.檢視整個叢集狀態
[root@k8s01 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s01 Ready master 40d v1.15.3
k8s02 Ready <none> 40d v1.15.3
k8s03 Ready <none> 41s v1.15.3
[root@k8s01 ~]#
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25854343/viewspace-2660392/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle叢集軟體管理-新增和刪除叢集節點Oracle
- 新增和刪除hadoop叢集中的節點Hadoop
- 刪除k8s叢集K8S
- 【Mongodb】 replica set 新增和刪除節點。MongoDB
- Oracle RAC 10g叢集節點刪除[zt]Oracle
- 【RAC】刪除RAC資料庫節點(六)——刪除Oracle叢集服務資料庫Oracle
- 【RAC】刪除RAC資料庫節點(七)——刪除Oracle叢集軟體資料庫Oracle
- k8s系列--node(k8s節點介紹,新增節點,移除節點)K8S
- Hyperledger Fabric節點的動態新增和刪除
- redis cluster節點/新增刪除操作Redis
- mongodb副本集新增刪除節點MongoDB
- 記一次K8S叢集Node節點CPU消耗高故障K8S
- networkx基礎用法:新增節點、新增邊、刪除節點、刪除邊、計算度、賦權重
- MongoDB副本集新增和刪除仲裁節點一例MongoDB
- oracle11g_RAC新增刪除節點Oracle
- 節點加入k8s 叢集的步驟K8S
- 二進位制安裝k8s高可用叢集(六):Node節點配置K8S
- oracle 10g rac,刪除故障節點並新增新節點Oracle 10g
- oracle 10g rac 新增節點與刪除節點步驟Oracle 10g
- TiUP線上佈署TIDB分散式資料庫叢集節點刪除TiDB分散式資料庫
- K8S線上叢集排查,實測排查Node節點NotReady異常狀態K8S
- Hadoop增加和刪除節點Hadoop
- 11G R2 RAC新增刪除節點
- rancher新增k8s節點時顯示節點已新增K8S
- [Kubernetes]node節點pod無法啟動/節點刪除網路重置
- 【K8S】基於單Master節點安裝K8S叢集K8SAST
- 二進位制部署1.23.4版本k8s叢集-6-部署Node節點服務K8S
- DKHhadoop叢集新增節點管理功能的操作步驟Hadoop
- JavaScript刪除節點自身JavaScript
- Oracle Rac 刪除節點Oracle
- consul 多節點/單節點叢集搭建
- 4.2 叢集節點初步搭建
- 使用kubeadm搭建一單節點k8s測試叢集K8S
- 使用Kubeadm建立k8s叢集之節點部署(三十一)K8S
- 極簡的配置單節點Kubernetes(k8s)叢集K8S
- 在K8S中,Worker節點加入叢集的全過程?K8S
- 【RAC】Oracle10g rac新增刪除節點命令參考Oracle
- 怎樣新增、刪除、移動、複製、建立、查詢節點