10.2.3. NodeMaintenance 사용자 정의 리소스를 사용하여 노드를 유지관리 모드로 설정
NodeMaintenance
CR(사용자 정의 리소스)을 사용하여 노드를 유지관리 모드에 배치할 수 있습니다. NodeMaintenance
CR을 적용하면 허용되는 모든 Pod가 제거되고 노드가 종료됩니다. 제거된 Pod는 클러스터의 다른 노드로 이동하기 위해 대기열에 있습니다.
사전 요구 사항
-
OpenShift Container Platform CLI
oc
를 설치합니다. -
cluster-admin
권한이 있는 사용자로 클러스터에 로그인합니다.
절차
다음 노드 유지관리 CR을 생성하고 파일을
nodemaintenance-cr.yaml
로 저장합니다.apiVersion: nodemaintenance.kubevirt.io/v1beta1 kind: NodeMaintenance metadata: name: maintenance-example 1 spec: nodeName: node-1.example.com 2 reason: "Node maintenance" 3
다음 명령을 실행하여 노드 유지관리 일정을 적용합니다.
$ oc apply -f nodemaintenance-cr.yaml
다음 명령을 실행하여 유지관리 작업의 진행 상황을 확인하고
<node-name>
을 노드 이름으로 교체합니다.$ oc describe node <node-name>
출력 예
Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal NodeNotSchedulable 61m kubelet Node node-1.example.com status is now: NodeNotSchedulable
10.2.3.1. 현재 NodeMaintenance CR 작업의 상태 확인
현재 NodeMaintenance
CR 작업의 상태를 확인할 수 있습니다.
사전 요구 사항
-
OpenShift Container Platform CLI
oc
를 설치합니다. -
cluster-admin
권한이 있는 사용자로 로그인합니다.
절차
다음 명령을 실행하여 현재 노드 유지관리 작업의 상태를 확인합니다.
$ oc get NodeMaintenance -o yaml
출력 예
apiVersion: v1 items: - apiVersion: nodemaintenance.kubevirt.io/v1beta1 kind: NodeMaintenance metadata: ... spec: nodeName: node-1.example.com reason: Node maintenance status: evictionPods: 3 1 pendingPods: - pod-example-workload-0 - httpd - httpd-manual phase: Running lastError: "Last failure message" 2 totalpods: 5 ...