본문 바로가기
Kubernetes

kubernetes 노드 변경

by freesunny 2019. 8. 5.

한대의 노드가 정상적이지 않은 것 같아서 새로운 노드를 추가하고 문제있는 노드를 제거 하였다.

 

AWS를 사용하고 있고, 오토스케일링 그룹에 속해있는 노드라서, 

오토스케일링 그룹에 신규 인스턴스가 추가 되도록 Desired Capacity 를 추가한다.

 

<추가된 인스턴스 상태 >

$ kubectl get nodes
ip-172-31-16-133.ap-northeast-2.compute.internal   Ready    <none>   16m   v1.12.7
ip-172-31-24-205.ap-northeast-2.compute.internal   Ready    <none>   82d   v1.12.7
ip-172-31-33-98.ap-northeast-2.compute.internal    Ready    <none>   27s   v1.12.7
ip-172-31-42-90.ap-northeast-2.compute.internal    Ready    <none>   82d   v1.12.7
ip-172-31-47-233.ap-northeast-2.compute.internal   Ready    <none>   16m   v1.12.7

 

 

문제 있는 노드(ip-172-31-42-90.ap-northeast-2.compute.internal)가 스케쥴링 되지 않도록 설정

$ kubectl cordon ip-172-31-42-90.ap-northeast-2.compute.internal
node/ip-172-31-42-90.ap-northeast-2.compute.internal cordoned

$ kubcectl get nodes                                           
NAME                                               STATUS                     ROLES    AGE     VERSION
ip-172-31-16-133.ap-northeast-2.compute.internal   Ready                      <none>   24m     v1.12.7
ip-172-31-24-205.ap-northeast-2.compute.internal   Ready                      <none>   82d     v1.12.7
ip-172-31-33-98.ap-northeast-2.compute.internal    Ready                      <none>   8m24s   v1.12.7
ip-172-31-42-90.ap-northeast-2.compute.internal    Ready,SchedulingDisabled   <none>   82d     v1.12.7
ip-172-31-47-233.ap-northeast-2.compute.internal   Ready                      <none>   24m     v1.12.7

 

 

문제 있는 노드 제거

$ kubectl drain ip-172-31-42-90.ap-northeast-2.compute.internal --ignore-daemonsets --delete-local-data
node/ip-172-31-42-90.ap-northeast-2.compute.internal already cordoned
WARNING: Ignoring DaemonSet-managed pods: aws-node-bjrrv, kube-proxy-stgz4, prometheus-node-exporter-lt9ls; 
Deleting pods with local storage: metrics-server-7fbd9b8589-qjkvg, monitoring-influxdb-5c5bf4949d-fshbn

 

오토스케링링 그룹에서 문제 있는 노드(인스턴스)를 제거 (인스턴스가 제거 되고, 새로운 인스턴스가 추가됨)

 

인스턴스 삭제

 

오토 스케일링 Desired Capacity 원래대로 축소