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": "password used to log on to the ECS instance by using SSH",
        "instances": "ECS instance array",
        "ecs_image_id": "image ID",
        "release_eip_flag": "whether to release Elastic IP (EIP) after you configure the cluster"
}

Response result

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