6.2. Working with nodes


As an administrator, you can perform several tasks to make your clusters more efficient.

6.2.1. Evacuating pods on nodes

You can remove, or evacuate, pods from a given node or nodes. Evacuating pods allows you to migrate all or selected pods to other nodes.

You can evacuate only pods that are backed by a replication controller. The replication controller creates new pods on other nodes and removes the existing pods from the specified node(s).

Bare pods, meaning those not backed by a replication controller, are unaffected by default. You can evacuate a subset of pods by specifying a pod selector. Because pod selectors are based on labels, all of the pods with the specified label are evacuated.

Procedure

  1. Mark the nodes as unschedulable before performing the pod evacuation.

    1. Mark the node as unschedulable by running the following command:

      $ oc adm cordon <node1>

      Example output

      node/<node1> cordoned

    2. Check that the node status is Ready,SchedulingDisabled by running the following command:

      $ oc get node <node1>

      Example output

      NAME        STATUS                     ROLES     AGE       VERSION
      <node1>     Ready,SchedulingDisabled   worker    1d        v1.34.2

  2. Evacuate the pods by using one of the following methods:

    • Evacuate all or selected pods on one or more nodes by running the oc adm drain command:

      $ oc adm drain <node1> <node2> [--pod-selector=<pod_selector>]
    • Force the deletion of bare pods by using the --force option with the oc adm drain command. When set to true, deletion continues even if there are pods not managed by a replication controller, replica set, job, daemon set, or stateful set.

      $ oc adm drain <node1> <node2> --force=true
    • Set a period of time in seconds for each pod to terminate gracefully by using the --grace-period option with the oc adm drain command. If negative, the default value specified in the pod will be used:

      $ oc adm drain <node1> <node2> --grace-period=-1
    • Ignore pods managed by daemon sets by using the --ignore-daemonsets=true option with the oc adm drain command:

      $ oc adm drain <node1> <node2> --ignore-daemonsets=true
    • Set the length of time to wait before giving up using the --timeout option with the oc adm drain command. A value of 0 sets an infinite length of time.

      $ oc adm drain <node1> <node2> --timeout=5s
    • Delete pods even if there are pods using emptyDir volumes by setting the --delete-emptydir-data=true option with the oc adm drain command. Local data is deleted when the node is drained.

      $ oc adm drain <node1> <node2> --delete-emptydir-data=true
    • List objects that would be migrated without actually performing the evacuation, by using the --dry-run=true option with the oc adm drain command:

      $ oc adm drain <node1> <node2>  --dry-run=true

      Instead of specifying specific node names (for example, <node1> <node2>), you can use the --selector=<node_selector> option with the oc adm drain command to evacuate pods on selected nodes.

  3. Mark the node as schedulable when done by using the following command.

    $ oc adm uncordon <node1>
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동