This topic describes how to remove worker nodes from a Kubernetes cluster.

Note
  • Removing nodes causes pod migration. This may affect the services provided by the pods running on the nodes. Therefore, we recommend that you remove nodes only when fewer services are in demand.
  • Removing nodes may cause unintended risks. We recommend that you back up your data in advance and exercise caution when performing this action.
  • When you start to remove nodes, the nodes are set to the unschedulable state.
  • Only Worker nodes can be removed.

Request information

Request line (RequestLine)

POST /clusters/{cluster_id}/nodes HTTP/1.1

Request line parameter (URI Param)

Parameter Type Required Description
cluster_id String Yes The ID of the cluster from which you want to remove nodes.

Special request headers

None. For more information, see Public request headers.

Request body (RequestBody)

{
    "nodes": "The nodes that you want to remove",
    "release_node": "Specifies whether to release the Elastic Compute Service (ECS) instances at the same time."
}

Request body explanation

Parameter Type Required Description
Nodes Array Yes The nodes that you want to remove.
release_node Boolean No Specifies whether to release the ECS instances at the same time. By default, the ECS instances are not released.

Return information

Response line (ResponseLine)

HTTP/1.1 202 OK

Special response headers (ResponseHead)

None. For more information, see Public response headers.

Examples

Request example

POST /clusters/Cccfd68c474454665ace07efce924****/attach HTTP/1.1
<Public request header>
{
    "password": "Hello1234",
    "nodes": [
        "i-xxxx",
        "i-yyyy"
    ]
}

Response example

HTTP/1.1 202 Accepted
<Public response header>