CreateClusterInstances

Last updated: 2020-11-16 11:33:39

1. API Description

Domain name for API request: tke.tencentcloudapi.com.

This API is used to create one or more nodes in a cluster.

A maximum of 20 requests can be initiated per second for this API.

Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: tke.ap-shanghai-fsi.tencentcloudapi.com

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: CreateClusterInstances.
Version Yes String Common parameter. The value used for this API: 2018-05-25.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
ClusterId Yes String Cluster ID. Enter the ClusterId field returned by the DescribeClusters API
RunInstancePara Yes String Pass-through parameter for CVM creation in the format of a JSON string. To ensure the idempotence of requests for adding cluster nodes, you need to add the ClientToken field in this parameter. For more information, see the documentation for RunInstances API.
InstanceAdvancedSettings No InstanceAdvancedSettings Additional parameter to be set for the instance

3. Output Parameters

Parameter Name Type Description
InstanceIdSet Array of String Instance ID
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Extending cluster nodes

Input Example

https://tke.tencentcloudapi.com/?Action=CreateClusterInstances
&ClusterId=cls-xxxxxxxx
&RunInstancePara={"Placement":{"Zone":"ap-guangzhou-4"},"InstanceType":"S3.SMALL1"}
&<Common request parameters>

Output Example

{
  "Response": {
    "InstanceIdSet": [
      "ins-xxxxxxxx"
    ],
    "RequestId": "eac6b301-a322-493a-8e36-83b295459397"
  }
}

Example2 Adding cluster nodes (multiple data disks)

This example shows you how to add a node with multiple data disks to a cluster.
Note 1: set DataDisks in InstanceAdvancedSettings to set the mounting information for multiple data disks. The backend will match data disks with data disk IDs based on their types and sizes and mount them to the corresponding paths.
Note 2: set DataDisks in RunInstancePara. This parameter will be passed through to the CVM to indicate the purchase of multiple data disks.
Note 3: MountTarget in InstanceAdvancedSettings initially supported single-disk configuration but is discarded in multi-disk scenarios, so it does not need to be entered here.

Input Example

POST / HTTP/1.1
Host: tke.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateClusterInstances
<Common request parameters>

{"Action":"CreateClusterInstances","ApiModule":"tke","AppId":123,"ClientIp":"127.0.0.1","ClusterId":"cls-qxxxxxx","InstanceAdvancedSettings":{"DataDisks":[{"AutoFormatAndMount":true,"DiskSize":50,"DiskType":"CLOUD_PREMIUM","FileSystem":"ext4","MountTarget":"/data2"},{"AutoFormatAndMount":true,"DiskSize":120,"DiskType":"CLOUD_PREMIUM","FileSystem":"ext4","MountTarget":"/data4"},{"AutoFormatAndMount":true,"DiskSize":100,"DiskType":"CLOUD_PREMIUM","FileSystem":"ext4","MountTarget":"/data3"},{"AutoFormatAndMount":true,"DiskSize":50,"DiskType":"CLOUD_PREMIUM","FileSystem":"ext4","MountTarget":"/data5"}],"DockerGraphPath":"/var/lib/docker","MountTarget":"/var/lib/docker","Unschedulable":0,"UserScript":""},"Language":"zh-CN","Region":"ap-chongqing","RequestId":"76a8bf8c-c039-4f52-ab31-5be5cafc53e3","RequestSource":"MC","RunInstancePara":"{\"InstanceChargeType\":\"POSTPAID_BY_HOUR\",\"Placement\":{\"Zone\":\"ap-chongqing-1\",\"ProjectId\":0},\"InstanceType\":\"S3.SMALL1\",\"SystemDisk\":{\"DiskType\":\"CLOUD_PREMIUM\",\"DiskSize\":50},\"DataDisks\":[{\"DiskType\":\"CLOUD_PREMIUM\",\"DiskSize\":50},{\"DiskType\":\"CLOUD_PREMIUM\",\"DiskSize\":120},{\"DiskType\":\"CLOUD_PREMIUM\",\"DiskSize\":100},{\"DiskType\":\"CLOUD_PREMIUM\",\"DiskSize\":50}],\"VirtualPrivateCloud\":{\"VpcId\":\"vpc-d5ivotej\",\"SubnetId\":\"subnet-qh3ax3mo\",\"AsVpcGateway\":false},\"InternetAccessible\":{\"InternetChargeType\":\"TRAFFIC_POSTPAID_BY_HOUR\",\"InternetMaxBandwidthOut\":1,\"PublicIpAssigned\":true},\"InstanceCount\":1,\"ImageId\":\"img-xxxxxx\",\"InstanceName\":\"tke_cls-xxx_worker\",\"LoginSettings\":{\"KeyIds\":[\"skey-cxxxx\"]},\"SecurityGroupIds\":[\"sg-nxxxxxx\"],\"EnhancedService\":{\"SecurityService\":{\"Enabled\":true},\"MonitorService\":{\"Enabled\":true}}}","SubAccountUin":"123","Timestamp":"1574854507","Token":"","Uin":"12345678","Version":"2018-05-25"}

Output Example

{
  "Response": {
    "InstanceIdSet": [
      "ins-xxxxxxxx"
    ],
    "RequestId": "eac6b301-a322-493a-8e36-83b295459397"
  }
}

5. Developer Resources

API Explorer

This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
InternalError Internal error.
InternalError.ClusterNotFound Cluster not found.
InternalError.ClusterState Cluster status error.
InternalError.CvmCommon Error in node creation.
InternalError.CvmNotFound CVM does not exist.
InternalError.Db DB error.
InternalError.DbAffectivedRows Database error.
InternalError.DbRecordNotFound Record not found.
InternalError.ImageIdNotFound Image not found.
InternalError.OsNotSupport Image OS not supported.
InternalError.Param Parameter error.
InternalError.QuotaMaxClsLimit Quota limit exceeded.
InternalError.QuotaMaxNodLimit Quota limit exceeded.
InternalError.QuotaMaxRtLimit Quota limit exceeded.
InternalError.UnexceptedInternal Internal error.
InternalError.VpcCommon VPC error
InternalError.VpcPeerNotFound Peering connection does not exist
InternalError.VpcRecodrNotFound VPC record not found
InvalidParameter Parameter error.
MissingParameter Missing parameter.
ResourceInUse The resource is occupied.
ResourceNotFound The resource does not exist.
ResourceUnavailable Resource is unavailable
UnauthorizedOperation Unauthorized operation.
UnknownParameter Unknown parameter.
UnsupportedOperation Unsupported operation.

Was this page helpful?

Was this page helpful?

  • Not at all
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful
Send Feedback
Help