All Products
Search
Document Center

Container Service for Kubernetes:AttachInstances

Last Updated:Oct 27, 2026

If you purchase an ECS instance and need to add the cloud server to an ACK cluster as a worker node, or if you remove a worker node and need to re-add the node instance to a node pool, you can invoke the AttachInstances operation to add existing ECS instances to the ACK cluster.

Operation description

Before calling this operation, carefully read Limits to ensure that the ECS instances to be added meet the requirements.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

cs:AttachInstances

update

*Cluster

acs:cs:{#regionId}:{#accountId}:cluster/{#ClusterId}

None None

Request syntax

POST /clusters/{ClusterId}/attach HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

ClusterId

string

Yes

The cluster ID.

c106f377e16f34eb1808d6b9362c9****

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body parameters.

instances

array

Yes

The list of ECS instances to be added.

string

No

The instance ID of the ECS instance to be added.

i-2zed0sswuau6o89b****

key_pair

string

No

The name of the key pair for the instances to be added. You only need to specify one of the key_pair and password parameters, or leave both empty.

Note

This parameter is not supported if nodepool_id is specified.

security-key

password

string

No

The SSH logon password for the instances to be added. You only need to specify one of the key_pair and password parameters, or leave both empty.

The password must meet the following requirements:

  • The password must be 8 to 30 characters in length.

  • The password must contain uppercase letters, lowercase letters, digits, and special characters.

  • The password cannot contain backslashes () or double quotation marks (").

For security purposes, the password is encrypted during transmission.

Hello1234

format_disk

boolean

No

Specifies whether to store container data and images on data cloud disks. Valid values:

  • true: stores container data and images on data cloud disks.

  • false: does not store container data and images on data cloud disks.

Default value: false.

Rules for mounting data cloud disks:

  • If the ECS instance has data cloud disks attached and the file system of the last data cloud disk is not initialized, the system automatically formats the data cloud disk to EXT4 and uses it to store the /var/lib/docker and /var/lib/kubelet directories, which are the default data directories for the Docker container runtime and kubelet component.

  • If the ECS instance does not have data cloud disks attached, no new data cloud disk is attached.

Note

If you choose to store data on data cloud disks and the ECS instance already has data cloud disks attached, the existing data on the data cloud disks will be lost. Back up your data in advance.

false

keep_instance_name

boolean

No

Specifies whether to retain the original instance name. Valid values:

  • true: retains the instance name.

  • false: does not retain the instance name.

Default value: false.

false

is_edge_worker

boolean

No

Specifies whether the node to be added is an edge node, which is an Edge Node Service (ENS) node. Valid values:

  • true: The node to be added is an edge node.

  • false: The node to be added is not an edge node.

Default value: false.

Note

If the node is an edge node, you must set this parameter to true to identify the node as an ENS node.

false

nodepool_id

string

No

The node pool ID. If you do not specify this parameter, the node is added to the default node pool.

np615c0e0966124216a0412e10afe0****

image_id

string

No

The custom image ID.

  • If you specify a custom image ID, the image on the system cloud disk of the instance is replaced with the custom image.

  • If you do not specify this parameter, the default system image is used.

Note

This parameter is not supported if nodepool_id is specified.

aliyun_2_1903_x64_20G_alibase_20200529.vhd

cpu_policy

string

No

The CPU management policy for the node. The following two policies are supported when the cluster version is 1.12.6 or later:

  • static: allows you to enhance CPU affinity and exclusivity for pods with specific resource characteristics on the node.

  • none: uses the existing default CPU affinity policy.

Default value: none.

Note

This parameter is not supported if nodepool_id is specified.

none

user_data

string

No

The custom data for the node. For more information, see Generate instance user data.

Note

This parameter is not supported if nodepool_id is specified.

IyEvdXNyL2Jpbi9iYXNoCmVjaG8gIkhlbGxvIEFDSyEi

rds_instances

array

No

The list of ApsaraDB RDS instances.

string

No

The instance ID of the ApsaraDB RDS instance.

Note

This parameter is not supported if nodepool_id is specified.

rm-67yawhau****

runtime runtime

No

The container runtime.

Note

This parameter is not supported if nodepool_id is specified.

name: the name of the container runtime. ACK supports the following three container runtimes:

  • containerd: recommended. Supported by all cluster versions.

  • Sandboxed-Container.runv: sandboxed container. Provides higher isolation. Supported by clusters runtime version 1.24 and earlier.

  • docker: supported by clusters runtime version 1.22 and earlier.

Default value: containerd.

containerd: the version of the container runtime. The default value is the latest version.

For more information about the changes to the sandboxed container runtime, see Release notes for sandboxed container runtime.

tags

array

No

The node labels. Rules for defining labels:

  • A label is a case-sensitive key-value pair. You can configure up to 20 labels.

  • Label keys must be unique and can be up to 64 characters in length.

  • Label values can be empty and can be up to 128 characters in length.

  • Label keys and values cannot start with aliyun, acs:, https://, or http://.

For more information, see Labels and Selectors.

Note

This parameter is not supported if nodepool_id is specified.

tag

No

The node label.

Response elements

Element

Type

Description

Example

object

The response body parameters.

list

array<object>

The list of node addition information.

object

The details of the node addition result.

code

string

The status code of the node addition result.

200

instanceId

string

The ECS instance ID.

i-2ze0lgm3y6iylcbt****

message

string

The description of the node addition result.

successful

task_id

string

The task ID.

T-5a544aff80282e39ea00****

Examples

Success response

JSON format

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

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.