본문 바로가기
IT 기술/Infra

[k8s] 노드 상태 다루기 [drain/cordon/uncordon]

by Geunny 2024. 4. 25.
반응형

https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/

 

Safely Drain a Node

This page shows how to safely drain a node, optionally respecting the PodDisruptionBudget you have defined. Before you begin This task assumes that you have met the following prerequisites: You do not require your applications to be highly available during

kubernetes.io

https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cordon/

 

kubectl cordon

Production-Grade Container Orchestration

kubernetes.io

 

 

drain : 특정 노드의 pod 를 다른 노드로 옮기는 동작.

$ kubectl drain <node-name> --ignore-daemonsets ## 데몬셋으로 떠있는 pod를 무시하기 위해 옵션 추가

 

 

- drain 동작시 해당 노드의 파드들을 종료시킨후 다른 노드로 실행 시키게 된다.

 

cordon : 특정 노드에 더이상 스케쥴링이 되지 않도록 설정한다.

 

$ kubectl cordon <node-name>

 

uncordon : drain 또는 cordon 작업을 진행한 노드는 SchedulingDisabled 상태로 존재한다.

[root@k8s-master ~]# k get nodes
NAME		STATUS  	 				ROLES			AGE		VERSION
k8s-master  Ready           			control-plane   81d     v1.27.2
k8s-worker1 NotReady,SchedulingDisabled <node>          62d     v1.27.2

 

uncordon 명령어를 사용하여 해당 노드를 활성화 시킬수 있다.

 

$ kubectl uncordon <node-name>

'IT 기술 > Infra' 카테고리의 다른 글

[k8s] kubeadm token 생성하기.  (0) 2024.05.15
[k8s] etcd 백업 / 복원 하기  (0) 2024.05.09
[k8s] InitContainer  (0) 2024.04.23
[k8s] Secret 정보 암호화하기.  (0) 2024.04.22
[CKA] k8s - 공부요약  (0) 2024.02.09

댓글