k8s运维-04-重启node机器的过程

2019-03-20  本文已影响0人  当当一丢丢

重启node的情况

此处是直接reboot node节点


重启时间较短

重启时间较长-超过5minutes

结论

drain过程

一般在重启机器,或者对接点更新内核版本等时,可以首先执行优雅的关闭所有pod(gracefully terminate all pods),即drain node


drain前10.5.0.44节点

[root@k8smaster163075 ~]
$kubectl get pods -n test-kubeasy-k8s -o wide | grep 10.5.0.44
atlas-uat-deployment-5b65898567-7728f   1/1     Running   2          25h   10.5.44.108   10.5.0.44   <none>
atlas-uat-deployment-5b65898567-pgnkg   1/1     Running   2          25h   10.5.44.109   10.5.0.44   <none>
atlas-uat-deployment-5b65898567-w6xsz   1/1     Running   2          25h   10.5.44.107   10.5.0.44   <none>

drain 节点

[root@k8smaster163075 ~]
$kubectl drain 10.5.0.44
node/10.5.0.44 cordoned
pod/atlas-uat-deployment-5b65898567-w6xsz evicted
pod/atlas-uat-deployment-5b65898567-pgnkg evicted
pod/atlas-uat-deployment-5b65898567-7728f evicted

查看 drain后的节点pod状态

[root@k8smaster163075 ~]
$kubectl get pods -n test-kubeasy-k8s -o wide | grep 10.5.0.44

查看 nodes 状态

$kubectl get nodes
NAME        STATUS                     ROLES    AGE   VERSION
10.5.0.43   Ready                      <none>   25h   v1.11.3
10.5.0.44   Ready,SchedulingDisabled   <none>   25h   v1.11.3
10.5.0.45   Ready                      <none>   25h   v1.11.3
10.5.0.46   Ready                      <none>   25h   v1.11.3
10.5.0.47   Ready                      <none>   25h   v1.11.3
10.5.0.48   Ready                      <none>   25h   v1.11.3
10.5.0.49   Ready                      <none>   25h   v1.11.3

其他节点上新建了3个pod(replicaset实现)

image.png image.png

附-流程图

image.png

参考

上一篇 下一篇

猜你喜欢

热点阅读