CreateCluster

Last updated: 2020-06-24 11:17:39

1. API Description

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

This API is used to create 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: CreateCluster.
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.
ClusterCIDRSettings Yes ClusterCIDRSettings Container networking configuration information for the cluster
ClusterType Yes String Cluster type. Managed cluster: MANAGED_CLUSTER; self-deployed cluster: INDEPENDENT_CLUSTER.
RunInstancesForNode.N No Array of RunInstancesForNode Pass-through parameter for CVM creation in the format of a JSON string. For more information, see the API for creating a CVM instance.
ClusterBasicSettings No ClusterBasicSettings Basic configuration information of the cluster
ClusterAdvancedSettings No ClusterAdvancedSettings Advanced configuration information of the cluster
InstanceAdvancedSettings No InstanceAdvancedSettings Advanced configuration information of the node
ExistedInstancesForNode.N No Array of ExistedInstancesForNode Configuration information of an existing instance
InstanceDataDiskMountSettings.N No Array of InstanceDataDiskMountSetting CVM type and the corresponding data disk mounting configuration information.

3. Output Parameters

Parameter Name Type Description
ClusterId String Cluster ID
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Example of creating managed cluster

This example shows you how to create a managed cluster.

Input Example

https://tke.tencentcloudapi.com/?Action=CreateCluster
&ClusterType=MANAGED_CLUSTER
&ClusterCIDRSettings.ClusterCIDR=10.4.0.0/14
&RunInstancesForNode.0.NodeRole=WORKER
&RunInstancesForNode.0.RunInstancesPara.0={"VirtualPrivateCloud":{"SubnetId":"subnet-xxx","VpcId":"vpc-xxx"},"Placement":{"Zone":"ap-region-1","ProjectId":1032509},"InstanceType":"S3.LARGE8","SystemDisk":{"DiskType":"CLOUD_PREMIUM"},"DataDisks":[{"DiskType":"CLOUD_PREMIUM","DiskSize":50}],"InstanceCount":1,"InternetAccessible":{"PublicIpAssigned":true,"InternetMaxBandwidthOut":1},"LoginSettings":{"Password":"YourPassword"},"UserData":"IyEvYmluL3NoCgplY2hvIGFhYQo="}
&<common request parameters>

Output Example

{
  "Response": {
    "ClusterId": "cls-xxx",
    "RequestId": "eac6b301-a322-493a-8e36-83b295459397"
  }
}

Example2 Example of creating self-deployed cluster

This example shows you how to create a self-deployed cluster.

Input Example

https://tke.tencentcloudapi.com/?Action=CreateCluster
&ClusterType=INDEPENDENT_CLUSTER
&ClusterCIDRSettings.ClusterCIDR=10.4.0.0/14
&RunInstancesForNode.0.NodeRole=MASTER_ETCD
&RunInstancesForNode.0.RunInstancesPara.0={"VirtualPrivateCloud":{"SubnetId":"subnet-xxx","VpcId":"vpc-xxx"},"Placement":{"Zone":"ap-region-1","ProjectId":1032509},"InstanceType":"S3.LARGE8","SystemDisk":{"DiskType":"CLOUD_PREMIUM"},"DataDisks":[{"DiskType":"CLOUD_PREMIUM","DiskSize":50}],"InstanceCount":3,"InternetAccessible":{"PublicIpAssigned":true,"InternetMaxBandwidthOut":1},"LoginSettings":{"Password":"YourPassword"},"UserData":"IyEvYmluL3NoCgplY2hvIGFhYQo="}
&RunInstancesForNode.1.NodeRole=WORKER
&RunInstancesForNode.1.RunInstancesPara.0={"VirtualPrivateCloud":{"SubnetId":"subnet-xxx","VpcId":"vpc-xxx"},"Placement":{"Zone":"ap-region-1","ProjectId":1032509},"InstanceType":"S3.LARGE8","SystemDisk":{"DiskType":"CLOUD_PREMIUM"},"DataDisks":[{"DiskType":"CLOUD_PREMIUM","DiskSize":50}],"InstanceCount":1,"InternetAccessible":{"PublicIpAssigned":true,"InternetMaxBandwidthOut":1},"LoginSettings":{"Password":"YourPassword"},"UserData":"IyEvYmluL3NoCgplY2hvIGFhYQo="}
&<common request parameters>

Output Example

{
  "Response": {
    "ClusterId": "cls-xxx",
    "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
InternalError Internal error
InternalError.AccountUserNotAuthenticated Account not verified.
InternalError.AsCommon Error creating scaling group resource.
InternalError.CidrConflictWithOtherCluster CIDR conflicts with the CIDR of another cluster.
InternalError.CidrConflictWithOtherRoute CIDR conflicts with another route.
InternalError.CidrConflictWithVpcCidr CIDR conflicts with VPC.
InternalError.CidrConflictWithVpcGlobalRoute CIDR conflicts with global route.
InternalError.CidrInvali Invalid CIDR.
InternalError.CidrMaskSizeOutOfRange Invalid CIDR mask.
InternalError.CreateMasterFailed Failed to create cluster.
InternalError.CvmCommon Error in node creation.
InternalError.Db DB error.
InternalError.DbAffectivedRows DB error
InternalError.DfwGetUSGCount Failed to obtain total number of current security groups.
InternalError.DfwGetUSGQuota Failed to obtain security group quota.
InternalError.InitMasterFailed Failed to initialize Master.
InternalError.InvalidPrivateNetworkCidr Invalid CIDR.
InternalError.Param Parameter error.
InternalError.PublicClusterOpNotSupport Cluster does not support the current operation.
InternalError.QuotaMaxClsLimit Quota limit exceeded.
InternalError.QuotaMaxNodLimit Quota limit exceeded.
InternalError.QuotaUSGLimit Insufficient security group quota.
InternalError.UnexceptedInternal Internal error
InternalError.VpcCommon VPC error
InternalError.VpcRecodrNotFound VPC record not found
InvalidParameter Parameter error
LimitExceeded Quota limit exceeded

Was this page helpful?

Was this page helpful?

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