본문 바로가기

리눅스

[kubernetes] 커든 및 드레인

728x90

커든 및 드레인

커든(cordon)

kubectl get nodes
$ kubectl get nodes
NAME                                                STATUS   ROLES    AGE   VERSION
ip-192-168-27-248.ap-northeast-2.compute.internal   Ready    <none>   17h   v1.22.12-eks-ba74326
ip-192-168-42-8.ap-northeast-2.compute.internal     Ready    <none>   17h   v1.22.12-eks-ba74326
ip-192-168-67-156.ap-northeast-2.compute.internal   Ready    <none>   17h   v1.22.12-eks-ba74326
kubectl cordon ip-192-168-67-156.ap-northeast-2.compute.internal
$ kubectl cordon ip-192-168-67-156.ap-northeast-2.compute.internal
node/ip-192-168-67-156.ap-northeast-2.compute.internal cordoned
$ kubectl get nodes
NAME                                                STATUS                     ROLES    AGE   VERSION
ip-192-168-27-248.ap-northeast-2.compute.internal   Ready                      <none>   17h   v1.22.12-eks-ba74326
ip-192-168-42-8.ap-northeast-2.compute.internal     Ready                      <none>   17h   v1.22.12-eks-ba74326
ip-192-168-67-156.ap-northeast-2.compute.internal   Ready,SchedulingDisabled   <none>   17h   v1.22.12-eks-ba74326
kubectl uncordon ip-192-168-67-156.ap-northeast-2.compute.internal
$ kubectl uncordon ip-192-168-67-156.ap-northeast-2.compute.internal
node/ip-192-168-67-156.ap-northeast-2.compute.internal uncordoned
$ kubectl get nodes
NAME                                                STATUS   ROLES    AGE   VERSION
ip-192-168-27-248.ap-northeast-2.compute.internal   Ready    <none>   17h   v1.22.12-eks-ba74326
ip-192-168-42-8.ap-northeast-2.compute.internal     Ready    <none>   17h   v1.22.12-eks-ba74326
ip-192-168-67-156.ap-northeast-2.compute.internal   Ready    <none>   17h   v1.22.12-eks-ba74326

드레인(drain)

드레인 설정

kubectl drain ip-192-168-67-156.ap-northeast-2.compute.internal
$ kubectl drain ip-192-168-67-156.ap-northeast-2.compute.internal
node/ip-192-168-67-156.ap-northeast-2.compute.internal cordoned
DEPRECATED WARNING: Aborting the drain command in a list of nodes will be deprecated in v1.23.
The new behavior will make the drain command go through all nodes even if one or more nodes failed during the drain.
For now, users can try such experience via: --ignore-errors
error: unable to drain node "ip-192-168-67-156.ap-northeast-2.compute.internal", aborting command...

There are pending nodes to be drained:
 ip-192-168-67-156.ap-northeast-2.compute.internal
error: cannot delete DaemonSet-managed Pods (use --ignore-daemonsets to ignore): kube-system/aws-node-ct6lv, kube-system/kube-proxy-dsfgs
kubectl drain ip-192-168-67-156.ap-northeast-2.compute.internal --ignore-daemonsets
$ kubectl drain ip-192-168-67-156.ap-northeast-2.compute.internal --ignore-daemonsets
node/ip-192-168-67-156.ap-northeast-2.compute.internal already cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/aws-node-ct6lv, kube-system/kube-proxy-dsfgs
node/ip-192-168-67-156.ap-northeast-2.compute.internal drained
$ kubectl get nodes
NAME                                                STATUS                     ROLES    AGE   VERSION
ip-192-168-27-248.ap-northeast-2.compute.internal   Ready                      <none>   17h   v1.22.12-eks-ba74326
ip-192-168-42-8.ap-northeast-2.compute.internal     Ready                      <none>   17h   v1.22.12-eks-ba74326
ip-192-168-67-156.ap-northeast-2.compute.internal   Ready,SchedulingDisabled   <none>   17h   v1.22.12-eks-ba74326

커든 해제

kubectl uncordon ip-192-168-67-156.ap-northeast-2.compute.internal
$ kubectl uncordon ip-192-168-67-156.ap-northeast-2.compute.internal
node/ip-192-168-67-156.ap-northeast-2.compute.internal uncordoned
$ kubectl get nodes
NAME                                                STATUS   ROLES    AGE   VERSION
ip-192-168-27-248.ap-northeast-2.compute.internal   Ready    <none>   17h   v1.22.12-eks-ba74326
ip-192-168-42-8.ap-northeast-2.compute.internal     Ready    <none>   17h   v1.22.12-eks-ba74326
ip-192-168-67-156.ap-northeast-2.compute.internal   Ready    <none>   17h   v1.22.12-eks-ba74326
728x90