You can call ScaleOutCluster to add worker nodes to a cluster. Worker nodes in a cluster can be deployed in multiple zones.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation uses the common request header only. For more information, see Common parameters.

Request syntax

POST /api/v2/clusters/[ClusterId] HTTPS|HTTP

Request parameters

Parameter Type Required Example Description
ClusterId String Yes c82e6987e2961451182edacd74faf****

The ID of the cluster.

count Integer Yes 1

The number of worker nodes that you want to add.

key_pair String Yes key-pair-xxxxx

The name of the key pair. You must set key_pair or login_password.

login_password String Yes Hello1234

The SSH logon password. The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. You must set login_password or key_pair.

worker_data_disk Boolean Yes true

Specifies whether to mount data disks to worker nodes. Valid values:

  • true: mounts data disks to worker nodes.
  • false: does not mount data disks to worker nodes.
worker_instance_types List<String> Yes ["ecs.i1.2xlarge"]

The ECS instance types of worker nodes. For more information, see Instance families.

worker_instance_charge_type String No PrePaid

The billing method of worker nodes. Valid values:

  • PrePaid: subscription.
  • PostPaid: pay-as-you-go.

Default value: PostPaid.

worker_period Integer No 1

The subscription duration of worker nodes. This parameter takes effect and is required only if worker_instance_charge_type is set to PrePaid. If worker_period_unit is set to Month, valid values of worker_period include 1, 2, 3, 6, and 12.

worker_period_unit String No Month

The unit of the subscription duration. This parameter is required if worker_instance_charge_type is set to PrePaid. A value of Month indicates that the subscription duration is measured in months.

worker_auto_renew Boolean No true

Specifies whether to enable auto renewal for worker nodes. Valid values:

  • true: enables auto renewal.
  • false: disables auto renewal.
worker_auto_renew_period Integer No 6

The auto renewal period for worker nodes. This parameter takes effect and is required only if worker_instance_charge_type is set to PrePaid and worker_auto_renew is set to true. If worker_period_unit is set to Month, valid values of worker_auto_renew_period include 1, 2, 3, 6, and 12.

worker_system_disk_category String No cloud_efficiency

The system disk type of worker nodes.

worker_system_disk_size Integer No 120

The system disk size of a worker node. Unit: GiB.

cloud_monitor_flags Boolean No true

Specifies whether to install the CloudMonitor agent. Valid values:

  • true: installs the CloudMonitor agent.
  • false: does not install the CloudMonitor agent.
cpu_policy String No none

The CPU policy. For Kubernetes 1.12.6 and later, valid values of cpu_policy include static and none. Default value: none.

disable_rollback Boolean No true

Specifies whether to retain all resources if the operation fails. Valid values:

  • true: retains the resources.
  • false: releases the resources.

Default value: true. We recommend that you use the default value.

vswitch_ids List<String> No ["vsw-2ze4jvvvade1yk899****"]

The VSwitch IDs of worker nodes. Specify one to three VSwitch IDs. We recommend that you specify three VSwitches in different zones to ensure high availability.

worker_data_disks Array No [{"category":"cloud","size":"40","encrypted":"false"}]

The data disk configurations of worker nodes, such as the disk type and disk size. This parameter takes effect only if worker_data_disk is set to true.

  • category: the type of the data disks. Valid values:
    • cloud: basic disks.
    • cloud_efficiency: ultra disks.
    • cloud_ssd: SSDs.
  • size: the size of a data disk. Unit: GiB.
  • encrypted: specifies whether to encrypt data disks. Valid values: true and false.
tags Array No [{"key":"tier","value":"backend"}]

The tags of the cluster.

  • key: the name of the tag.
  • value: the value of the tag.
taints Array No []

The taints that are added to nodes to ensure appropriate scheduling of pods. If a pod has a toleration that matches the taint on a node, this pod can be scheduled to the node.

Response parameters

Parameter Type Example Description
cluster_id String c82e6987e2961451182edacd74faf****

The ID of the cluster.

instanceId String Cccfd68c474454665ace07efce924****

The ID of the worker node.

request_id String 687C5BAA-D103-4993-884B-C35E4314A1E1

The ID of the request.

task_id String T-5a54309c80282e39ea00002f

The ID of the task. The task ID is automatically assigned by the system and can be used to query task status.

Examples

Sample requests

POST /api/v2/clusters/[ClusterId] HTTP/1.1
Common request header
{
    "ClusterId": "c82e6987e2961451182edacd74faf", 
    "key_pair":"common",
    "vswitch_ids":["vsw-uf684tfrpwup8gcsw****"],
    "worker_instance_types":["ecs.c5.xlarge"],
    "worker_system_disk_category":"cloud_efficiency",
    "worker_system_disk_size":120,
    "worker_data_disk":false,
    "worker_data_disks": [{"category": "cloud_ssd", "size": 500}],
    "tags":[],
    "count":1
}

Sample request description

 {
     "key_pair":"The name of the key pair. You must set key_pair or login_password.",
    "worker_vswitch_ids":"The IDs of VSwitches. Specify one to three VSwitch IDs.",
    "worker_instance_types":"The ECS instance types of worker nodes.",
    "worker_system_disk_category":"The system disk type of worker nodes.",
    "worker_system_disk_size":"The system disk size of a worker node.",
    "worker_data_disk":"Specifies whether to mount data disks to worker nodes. Valid values: true and false.",
    "tags":"The tags of the cluster. The value must be an array.",
    "count":"The number of worker nodes that you want to add."
    "worker_data_disks":"The data disk configurations of worker nodes.",
}

Sample success responses

XML format

<cluster_id>c82e6987e2961451182edacd74faf****</cluster_id>
<instanceId>Cccfd68c474454665ace07efce924****</instanceId>
<task_id>T-5a54309c80282e39ea00002f</task_id>
<request_id>687C5BAA-D103-4993-884B-C35E4314A1E1</request_id>

JSON format

{
    "cluster_id":"c82e6987e2961451182edacd74faf****",
    "instanceId":"Cccfd68c474454665ace07efce924****",
    "task_id":"T-5a54309c80282e39ea00002f",
    "request_id":"687C5BAA-D103-4993-884B-C35E4314A1E1"
}

Error codes

For a list of error codes, visit the API Error Center.