[K8S] 특정 노드에 실행 중인 Pod를 비우고 더이상 Pod가 스케줄링되지 않도록 하는 방법

  • huaya
    (후아빠)
  • huaya's Avatar 이 글의 작성자
  • Offline
  • Junior
  • Junior
더보기
06 Dec 2022 13:53 - 12 Dec 2022 17:24 #31963 작성자: huaya
huaya 님의 글: [K8S] 특정 노드에 실행 중인 Pod를 비우고 더이상 Pod가 스케줄링되지 않도록 하는 방법
노드 이름이 node01이라고 할 때 아래과 같이 실행한다. (cordon도 함께 처리된다)

kubectl drain node01

단 데몬셋이 떠있으면 --ignore-daemonsets 옵션을 추가하여 데몬셋도 제거한다.

node/node01 cordoned
error: unable to drain node "node01" due to error:cannot delete DaemonSet-managed Pods (use --ignore-daemonsets to ignore): kube-system/kube-flannel-ds-nh7l4, kube-system/kube-proxy-spkdf, continuing command...
There are pending nodes to be drained:
 node01
cannot delete DaemonSet-managed Pods (use --ignore-daemonsets to ignore): kube-system/kube-flannel-ds-nh7l4, kube-system/kube-proxy-spkdf

만약 특정 노드에서 실행 중인 Pod는 유지하고 스케줄링만 막으려면 cordon을 사용한다.

kubectl cordon node01

Pod를 즉시 삭제하려면 아래 옵션을 추가한다

kubectl delete pod POD이름 --grace-period=0 --force
Time to create page: 0.068 seconds
Powered by Kunena Forum