tencent cloud

masukan

Draining or Cordoning a Node

Terakhir diperbarui:2022-04-22 11:55:50

    Overview

    This document explains how to drain or cordon a node.

    Directions

    Cordoning a Node

    After cordoning a node, new Pods cannot be scheduled to it. If you want to schedule a Pod to the node, you need to uncordon the node manually. If a node has been bound as backend target node, it will be removed from the target node list after it is condoned. You can cordon a node with one of the following two methods:

    • When adding a node, on the CVM Configuration page, click Advanced Settings and select Cordon this node.

    Uncordoning a Node

    After a node is uncordoned, new Pods can be scheduled to it. You can uncordon a node with one of the following two methods:

    When you create a node by running a script, you can uncordon it by adding a command for uncordoning the node in the script. Below is an example:

    #!/bin/sh
    # your initialization script
    echo "hello world!"
    # If you set unschedulable when you create a node, 
    # after executing your initialization script, 
    # use the following command to make the node schedulable.
    node=`ps -ef|grep kubelet|grep -oE 'hostname-override=\S+'|cut -d"=" -f2`
    #echo ${node}
    kubectl uncordon ${node} --kubeconfig=/root/.kube/config
    

    The kubectl uncordon command indicates uncordoning the node.

    Draining a Node

    Overview

    Before performing maintenance on a node, you can safely drain a Pod from a node by draining the node. After the node is drained, all Pods (excluding those managed by DaemonSet) in the node will be automatically drained to other nodes in the cluster, and the drained node will be set to cordoned status.

    Note:

    For locally stored Pods, data will be lost after they are drained. Please be cautious when doing so.

    Directions

    1. Log in to the TKE console.
    2. In the left sidebar, click Clusters to go to the cluster management page.
    3. Click the ID/name of the cluster where to drain the node to go to the management page of the cluster. See the figure below:
    4. In the left sidebar, select Node Management > Nodes to go to the Node List page.
    5. Click More > Drain in the row of the node to be drained. See the figure below:
    6. In the pop-up dialog box, click OK to complete the draining.
    Hubungi Kami

    Hubungi tim penjualan atau penasihat bisnis kami untuk membantu bisnis Anda.

    Dukungan Teknis

    Buka tiket jika Anda mencari bantuan lebih lanjut. Tiket kami tersedia 7x24.

    Dukungan Telepon 7x24