因为想要重新安装docker,所以先将22这个节点宕掉

命令如下

[root@hdss7-21 docker]# kubectl drain hdss7-22.host.com --ignore-daemonsets
node/hdss7-22.host.com already cordoned
WARNING: ignoring DaemonSet-managed Pods: default/nginx-ds-m987l, kube-system/traefik-ingress-2jb8z
evicting pod "heapster-b5b9f794-24g5q"
evicting pod "dubbo-demo-consumer-7f57887dd4-76njz"
evicting pod "jenkins-b56cf89cc-hlvwp"
pod/dubbo-demo-consumer-7f57887dd4-76njz evicted
pod/jenkins-b56cf89cc-hlvwp evicted
pod/heapster-b5b9f794-24g5q evicted
node/hdss7-22.host.com evicted
[root@hdss7-21 docker]# kubectl get pod -A -owide    ##这个时候查看应该有pod在一个一个的被驱逐
[root@hdss7-21 docker]# kubectl get node        #查看状态
NAME                STATUS                     ROLES         AGE    VERSION
hdss7-21.host.com   Ready                      master,node   6d2h   v1.15.2
hdss7-22.host.com   Ready,SchedulingDisabled   master,node   6d2h   v1.15.2

修复好后开启节点

[root@hdss7-21 docker]# kubectl uncordon hdss7-22.host.com
node/hdss7-22.host.com uncordoned
[root@hdss7-21 docker]# kubectl get nodes
NAME                STATUS   ROLES         AGE    VERSION
hdss7-21.host.com   Ready    master,node   6d2h   v1.15.2
hdss7-22.host.com   Ready    master,node   6d2h   v1.15.2

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐