You can call the AttachInstances operation to add existing Elastic Compute Service (ECS) instances to a specified Container Service for Kubernetes (ACK) cluster.
Debugging
Request syntax
POST /clusters/ClusterId/attach HTTP/1.1
Content-Type:application/json
{
"instances" : [ "String" ],
"key_pair" : "String",
"password" : "String",
"format_disk" : Boolean,
"keep_instance_name" : Boolean,
"is_edge_worker" : Boolean,
"nodepool_id" : "String",https://next.api.aliyun.com/api/CS/2015-12-15/DescribeAddons?lang=PHP¶ms={%22region%22:%22cn-beijing%22,%22cluster_type%22:%22kubernetes%22}&tab=DEBUG
"image_id" : "String",
"cpu_policy" : "String",
"user_data" : "String",
"rds_instances" : [ "String" ],
"runtime" : {
"name" : "String",
"version" : "String"
},
"tags" : [ {
"key" : "String",
"value" : "String"
} ]
}
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
ClusterId | String | Yes | c106f377e16f34eb1808d6b9362c9**** | The ID of the cluster. |
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
instances | Array of String | Yes | i-2zed0sswuau6o89b**** | The IDs of the existing ECS instances that you want to add. |
key_pair | String | No | security-key | The name of the key pair that is used to log on to the ECS instances. You must set key_pair or Note This parameter is not supported after you specify nodepool_id . |
password | String | No | Hello1234 | The SSH logon password that is used to log on to the ECS instances. You must set login_password or For security considerations, the password is encrypted during data transfer. |
format_disk | Boolean | No | false | Specifies whether to store container data and images on data disks. Valid values:
Default value: How to mount a data disk:
|
keep_instance_name | Boolean | No | true | Specifies whether to retain the instance name. Valid values:
Default value: |
is_edge_worker | Boolean | No | false | Specifies whether the nodes that you want to add are Edge Node Service (ENS) nodes. Valid values:
Default value: Note If the nodes you want to add are ENS nodes, you must set this parameter to true . This allows you to identify these nodes. |
nodepool_id | String | No | np615c0e0966124216a0412e10afe0**** | The ID of the created node pool. If you do not set this parameter, the nodes are added to the default node pool. |
image_id | String | No | aliyun_2_1903_x64_20G_alibase_20200529.vhd | The ID of the custom image. If you do not set this parameter, the default system image is used. Note
|
cpu_policy | String | No | none | The CPU management policy. The following policies are supported if the Kubernetes version of the cluster is 1.12.6 or later.
Default value: Note This parameter is not supported after you specify nodepool_id . |
user_data | String | No | IyEvdXNyL2Jpbi9iYXNoCmVjaG8gIkhlbGxvIEFDSyEi | The user-defined data. For more information, see Generate user-defined data. Note This parameter is not supported after you specify nodepool_id . |
rds_instances | Array of String | No | rm-67yawhau**** | The IDs of ApsaraDB RDS instances. Note This parameter is not supported after you specify nodepool_id . |
runtime | runtime | No | The container runtime. Note This parameter is not supported after you specify nodepool_id . | |
tags | Array of tag | No | The labels that you want to add to nodes. You must add labels based on the following rules:
|
Response syntax
HTTP/1.1 200
Content-Type:application/json
{
"list" : [ {
"code" : "String",
"instanceId" : "String",
"message" : "String"
} ],
"task_id" : "String"
}
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
list | Array of list | The details of the added nodes. | |
code | String | 200 | The code that indicates the task result. |
instanceId | String | i-2ze0lgm3y6iylcbt**** | The ID of the instance. |
message | String | successful | Indicates whether the ECS instances are successfully added to the ACK cluster. |
task_id | String | T-5a544aff80282e39ea000039 | The ID of the task. |
Examples
Sample requests
POST /clusters/c106f377e16f34eb1808d6b9362c9****/attach HTTP/1.1
Content-Type:application/json
{
"instances" : [ "i-2zed0sswuau6o89b****" ],
"key_pair" : "security-key",
"password" : "Hello1234",
"format_disk" : false,
"keep_instance_name" : true,
"is_edge_worker" : false,
"nodepool_id" : "np615c0e0966124216a0412e10afe0****",
"image_id" : "aliyun_2_1903_x64_20G_alibase_20200529.vhd",
"cpu_policy" : "none",
"user_data" : "IyEvdXNyL2Jpbi9iYXNoCmVjaG8gIkhlbGxvIEFDSyEi",
"rds_instances" : [ "rm-67yawhau****" ],
"runtime" : {
"name" : "docker",
"version" : "19.03.5"
},
"tags" : [ {
"key" : "env",
"value" : "prod"
} ]
}
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<list>
<code>200</code>
<instanceId>i-2ze0lgm3y6iylcbt****</instanceId>
<message>successful</message>
</list>
<task_id>T-5a544aff80282e39ea000039</task_id>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"list" : [ {
"code" : "200",
"instanceId" : "i-2ze0lgm3y6iylcbt****",
"message" : "successful"
} ],
"task_id" : "T-5a544aff80282e39ea000039"
}
Error codes
For a list of error codes, visit the API Error Center.