This topic describes how to add existing ECS instances to a cluster. For API descriptions, see Add existing ECS instances to a Kubernetes cluster.

API request and response

Request format

aliyun cs  POST /clusters/<cluster_id>/attach --header "Content-Type=application/json" --body "$(cat attach.json)"

Parameter description:

  • --header: Specify Content-Type as application/json.
  • --body: This is the body content to be sent to the server. The content can be read from a local file and must be in JSON format. The content of attach.json is as follows:
{
    "password": "the password used by the root account to log on to an ECS instance",
    "instances": "the IDs of the ECS instances that you want to add to the target cluster.",
    "format_disk": "whether to format disks. Value: true|false",
    "key_pair": "the key pair",
    "tags": "the tag added to the node. This is an object of the array format."
}

Response result

{
    "list": [
        {
            "code": "200",
            "instanceId": "i-2zee3oiwcyoz7kwd****",
            "message": "successful"
        },
        {
            "code": "200",
            "instanceId": "i-2ze0lgm3y6iylcbt****",
            "message": "successful"
        }
    ],
    "task_id": "T-5a544aff80282e39ea000039"
}