tencent cloud

Feedback

CreateClusterInstances

Last updated: 2024-11-14 14:50:08

    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.

    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 Params. The value used for this API: CreateClusterInstances.
    Version Yes String Common Params. The value used for this API: 2018-05-25.
    Region Yes String Common Params. 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
    SkipValidateOptions.N No Array of String Skips the specified verification. Valid values: GlobalRouteCIDRCheck, VpcCniCIDRCheck

    3. Output Parameters

    Parameter Name Type Description
    InstanceIdSet Array of String Instance ID
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Expanding cluster nodes

    This example shows you how to expand cluster nodes.

    Input Example

    POST / HTTP/1.1
    Host: tke.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateClusterInstances
    <Common request parameters>
    
    {
        "RunInstancePara": "{\"Placement\":{\"Zone\":\"ap-guangzhou-4\"},\"InstanceType\":\"S3.SMALL1\"}",
        "ClusterId": "cls-xxxxxxxx"
    }
    

    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 nodes with multiple data disks to the cluster.
    Note 1: Set DataDisks in InstanceAdvancedSettings. The mount information for multiple data disks in the backend will match Data Disk IDs based on the types and sizes of the disks and mount them to the corresponding paths.
    Note 2: Set DataDisks in RunInstancePara. This parameter is passed through to CVM to purchase multiple data disks.
    Note 3: The MountTarget in InstanceAdvancedSettings initially supported single disks. It is deprecated for multi-disk scenarios and no longer needs to be specified.

    Input Example

    POST / HTTP/1.1
    Host: tke.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateClusterInstances
    <Common request parameters>
    
    {
        "ClusterId": "abc",
        "InstanceAdvancedSettings": {
            "MountTarget": "abc",
            "DockerGraphPath": "abc",
            "UserScript": "abc",
            "Unschedulable": 0,
            "Labels": [
                {
                    "Name": "abc",
                    "Value": "abc"
                }
            ],
            "DataDisks": [
                {
                    "DiskType": "abc",
                    "FileSystem": "abc",
                    "DiskSize": 0,
                    "AutoFormatAndMount": true,
                    "MountTarget": "abc",
                    "DiskPartition": "abc"
                }
            ],
            "ExtraArgs": {
                "Kubelet": [
                    "abc"
                ]
            },
            "DesiredPodNumber": 0,
            "GPUArgs": {
                "MIGEnable": true,
                "Driver": {
                    "Version": "abc",
                    "Name": "abc"
                },
                "CUDA": {
                    "Version": "abc",
                    "Name": "abc"
                },
                "CUDNN": {
                    "Version": "abc",
                    "Name": "abc",
                    "DocName": "abc",
                    "DevName": "abc"
                },
                "CustomDriver": {
                    "Address": "abc"
                }
            },
            "PreStartUserScript": "abc",
            "Taints": [
                {
                    "Key": "abc",
                    "Value": "abc",
                    "Effect": "abc"
                }
            ]
        },
        "RunInstancePara": "abc",
        "SkipValidateOptions": [
            "abc"
        ]
    }
    

    Output Example

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

    5. Developer Resources

    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.
    FailedOperation.AccountCommon Failed to obtain user authentication information.
    FailedOperation.ClusterNotFound The cluster is not found.
    FailedOperation.ClusterState Cluster status error.
    FailedOperation.CvmCommon Failed to create the node due to a CVM error
    FailedOperation.Db Database error.
    FailedOperation.NetworkScaleError Network extension error.
    FailedOperation.Param Invalid parameter.
    FailedOperation.QuotaMaxNodLimit Reached the quota limit.
    InternalError Internal error.
    InternalError.AccountCommon Failed to obtain the user authentication information
    InternalError.AccountUserNotAuthenticated Account not verified.
    InternalError.ClusterNotFound Cluster not found.
    InternalError.ClusterState Cluster status error.
    InternalError.ComponentClinetHttp Error while requesting (HTTP) other Tencent Cloud services
    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.UnexpectedInternal Unknown internal error.
    InternalError.VpcCommon VPC error
    InternalError.VpcPeerNotFound Peering connection does not exist
    InternalError.VpcRecodrNotFound VPC record not found
    InvalidParameter Parameter error.
    InvalidParameter.VersionNotSupportCgroupV2 In customer creation parameters, k8s version, runtime version, or tke-eni-agent version do not support the chosen operating system's CgroupV2.
    MissingParameter Missing parameter.
    ResourceInUse The resource is occupied.
    ResourceInsufficient.SpecifiedInstanceType Insufficient CVM resources.
    ResourceNotFound The resource does not exist.
    ResourceUnavailable Resource is unavailable
    UnauthorizedOperation Unauthorized operation.
    UnknownParameter Unknown parameter.
    UnsupportedOperation Unsupported operation.