tencent cloud

容器服务

动态与公告
产品动态
公告
产品发布记录
产品简介
产品概述
产品优势
产品架构
应用场景
产品功能
基本概念
原生 Kubernetes 名词对照
容器服务高危操作
地域和可用区
开源组件
购买指南
购买指引
购买 TKE 标准集群
购买原生节点
购买超级节点
快速入门
新手指引
快速创建一个标准集群
入门示例
容器应用部署 Check List
集群配置
标准集群概述
集群管理
网络管理
存储管理
节点管理
GPU 资源管理
远程终端
应用配置
工作负载管理
服务和配置管理
组件和应用管理
弹性伸缩
容器登录方式
可观测配置
运维可观测性
成本洞察和优化
调度配置
调度组件概述
资源利用率优化调度
业务优先级保障调度
Qos 感知调度
安全和稳定性
容器服务安全组设置
身份验证和授权
应用安全
多集群管理
计划升级
备份中心
云原生服务指南
云原生 etcd
Prometheus 监控服务
TKE Serverless 集群指南
TKE 注册集群指南
实践教程
集群
Serverless 集群
调度
安全
服务部署
网络
发布
日志
监控
运维
Terraform
DevOps
弹性伸缩
容器化
微服务
成本管理
混合云
AI
故障处理
节点磁盘爆满排障处理
节点高负载排障处理
节点内存碎片化排障处理
集群 DNS 解析异常排障处理
集群 Kube-Proxy 异常排障处理
集群 API Server 网络无法访问排障处理
Service&Ingress 网络无法访问排障处理
Service&Ingress 常见报错和处理
Nginx Ingress 偶现 Connection Refused
CLB Ingress 创建报错排障处理
Pod 网络无法访问排查处理
Pod 状态异常与处理措施
授权腾讯云售后运维排障
CLB 回环问题
API 文档
History
Introduction
API Category
Making API Requests
Elastic Cluster APIs
Resource Reserved Coupon APIs
Cluster APIs
Third-party Node APIs
Relevant APIs for Addon
Network APIs
Node APIs
Node Pool APIs
TKE Edge Cluster APIs
Cloud Native Monitoring APIs
Scaling group APIs
Super Node APIs
Other APIs
Data Types
Error Codes
TKE API 2022-05-01
常见问题
TKE 标准集群
TKE Serverless 集群
运维类
隐患处理
服务类
镜像仓库类
远程终端类
事件类
资源管理类
服务协议
TKE Service Level Agreement
TKE Serverless Service Level Agreement
联系我们
词汇表

CreateCluster

PDF
聚焦模式
字号
最后更新时间: 2025-10-30 22:04:56

1. API Description

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

This API is used to create 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: CreateCluster.
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.
ClusterType Yes String Cluster type. Managed cluster: MANAGED_CLUSTER; self-deployed cluster: INDEPENDENT_CLUSTER.
ClusterCIDRSettings Yes ClusterCIDRSettings Container networking configuration information for the 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 The configuration information for existing instances. All instances must be in the same VPC. Up to 100 instances are allowed in one VPC. Spot instances are not supported.
InstanceDataDiskMountSettings.N No Array of InstanceDataDiskMountSetting CVM type and the corresponding data disk mounting configuration information.
ExtensionAddons.N No Array of ExtensionAddon Information of the add-on to be installed
CdcId No String CDC Id

3. Output Parameters

Parameter Name Type Description
ClusterId String Cluster 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 Creating a managed cluster

This example shows you how to create a managed cluster.

Input Example

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

{
    "ClusterType": "MANAGED_CLUSTER",
    "ClusterBasicSettings": {
        "ClusterOs": "centos8.0x86_64",
        "OsCustomizeType": "GENERAL",
        "ClusterVersion": "1.26.1",
        "ClusterName": "test",
        "ClusterDescription": "Test Cluster",
        "VpcId": "vpc-135qxjgs",
        "ProjectId": 0,
        "NeedWorkSecurityGroup": false,
        "TagSpecification": [
            {
                "ResourceType": "cluster",
                "Tags": [
                    {
                        "Key": "aa",
                        "Value": "cc"
                                        }

                ]
                        }

        ],
        "ClusterLevel": "L5",
        "AutoUpgradeClusterLevel": {
            "IsAutoUpgrade": true
                }

    },
    "ClusterCIDRSettings": {
        "ClusterCIDR": "172.24.0.0/16",
        "IgnoreClusterCIDRConflict": false,
        "MaxNodePodNum": 64,
        "MaxClusterServiceNum": 1024
    },
    "ClusterAdvancedSettings": {
        "AsEnabled": false,
        "IPVS": true,
        "ContainerRuntime": "containerd",
        "RuntimeVersion": "1.6.9",
        "NodeNameType": "lan-ip",
        "ExtraArgs": {
            "KubeAPIServer": [],
            "KubeControllerManager": [],
            "KubeScheduler": []
        },
        "NetworkType": "GR",
        "DeletionProtection": true,
        "AuditEnabled": true,
        "AuditLogsetId": "",
        "AuditLogTopicId": "",
        "EnableCustomizedPodCIDR": false,
        "IsDualStack": false,
        "QGPUShareEnable": true
    },
    "InstanceAdvancedSettings": {
        "DataDisks": [],
        "DockerGraphPath": "/var/lib/containerd",
        "Unschedulable": 0,
        "PreStartUserScript": "",
        "UserScript": "",
        "Labels": [],
        "Taints": [],
        "GPUArgs": {},
        "DesiredPodNumber": 0
    },
    "ExtensionAddons": [
        {
            "AddonName": "CBS",
            "AddonParam": "{\"kind\":\"App\",\"spec\":{\"chart\":{\"chartName\":\"cbs\",\"chartVersion\":\"1.1.3\"},\"values\":{\"values\":[],\"rawValues\":\"e30=\",\"rawValuesType\":\"json\"}}}"
        },
        {
            "AddonName": "APP",
            "AddonParam": "{\"kind\":\"App\",\"spec\":{\"chart\":{\"chartName\":\"user-group-access-control\",\"chartVersion\":\"1.0.0\"}}}"
        },
        {
            "AddonName": "QGPU",
            "AddonParam": "{\"kind\":\"App\",\"spec\":{\"chart\":{\"chartName\":\"qgpu\",\"chartVersion\":\"1.0.19\"},\"values\":{\"values\":[\"config.priority=binpack\",\"config.nodepriority=spread\",\"config.rootdir=/var/lib/kubelet\"]}}}"
        },
        {
            "AddonName": "KMS",
            "AddonParam": "{\"kind\":\"App\",\"spec\":{\"chart\":{\"chartName\":\"tke-kms-plugin\",\"chartVersion\":\"1.0.0\"},\"name\":\"tke-kms-plugin\",\"values\":{\"values\":[\"keyId=7d90e454-8458-11ee-b601-525400741137\",\"region=ap-guangzhou\",\"resource=secrets\"]}}}"
                }

    ],
    "RunInstancesForNode": [
        {
            "NodeRole": "WORKER",
            "RunInstancesPara": [
                "{\"Version\":\"2017-03-12\",\"InstanceChargeType\":\"POSTPAID_BY_HOUR\",\"Placement\":{\"Zone\":\"ap-shanghai-1\",\"ProjectId\":0},\"TagSpecification\":[{\"ResourceType\":\"instance\",\"Tags\":[{\"Key\":\"aa\",\"Value\":\"cc\"}]}],\"InstanceType\":\"S2.MEDIUM2\",\"ImageId\":\"img-25szkc8t\",\"SystemDisk\":{\"DiskType\":\"CLOUD_BSSD\",\"DiskSize\":50},\"VirtualPrivateCloud\":{\"VpcId\":\"vpc-135qxjgs\",\"SubnetId\":\"subnet-rtp4p7q3\",\"Ipv6AddressCount\":0},\"InternetAccessible\":{\"InternetChargeType\":\"TRAFFIC_POSTPAID_BY_HOUR\",\"InternetMaxBandwidthOut\":1,\"PublicIpAssigned\":true},\"InstanceCount\":1,\"InstanceName\":\"\",\"LoginSettings\":{\"KeyIds\":[\"skey-4h43fuxj\"]},\"SecurityGroupIds\":[\"sg-hjsb4ai4\"],\"EnhancedService\":{\"SecurityService\":{\"Enabled\":true},\"MonitorService\":{\"Enabled\":true}},\"PurchaseSource\":\"docker_dashboard\",\"UserData\":\"\"}"
            ],
            "InstanceAdvancedSettingsOverrides": [
                {
                    "DataDisks": [],
                    "MountTarget": "",
                    "DockerGraphPath": "/var/lib/containerd",
                    "Unschedulable": 0,
                    "PreStartUserScript": "",
                    "UserScript": "",
                    "DesiredPodNumber": 0,
                    "Labels": [],
                    "Taints": [],
                    "ExtraArgs": {
                        "Kubelet": []
                    },
                    "GPUArgs": {
                        "MIGEnable": false,
                        "Driver": {
                            "Version": "",
                            "Name": ""
                        },
                        "CUDA": {
                            "Version": "",
                            "Name": ""
                        },
                        "CUDNN": {
                            "Version": "",
                            "Name": "",
                            "DocName": "",
                            "DevName": ""
                                                }

                                        }

                                }

            ]
                }

    ],
    "InstanceDataDiskMountSettings": []
}

Output Example

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

Example2 Creating an independent cluster

This example shows you how to create an independent cluster.

Input Example

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

{
    "ClusterCIDRSettings": {
        "ClusterCIDR": "10.4.0.0/14"
    },
    "ExtensionAddons": [
        {
            "AddonName": "GameApp",
            "AddonParam": "{\"kind\":\"GameApp\",\"apiVersion\":\"platform.tke/v1\",\"metadata\":{\"generateName\":\"ga\"},\"spec\":{\"clusterName\":\"xxx\"}}"
        }
    ],
    "ClusterType": "INDEPENDENT_CLUSTER",
    "RunInstancesForNode": [
        {
            "NodeRole": "WORKER",
            "RunInstancesPara": [
                "{\"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=\"}"
            ]
        },
        {
            "NodeRole": "MASTER_ETCD",
            "RunInstancesPara": [
                "{\"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=\"}"
            ]
        }
    ]
}

Output Example

{
    "Response": {
        "ClusterId": "cls-xxx",
        "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.AccountCommon Failed to obtain user authentication information.
FailedOperation.AccountUserNotAuthenticated The account is not verified.
FailedOperation.CamNoAuth Not authorized to access this API
FailedOperation.ComponentClientHttp Internal HTTP client error.
FailedOperation.CvmCommon Failed to create the node due to a CVM error
FailedOperation.CvmNumberNotMatch Some of the specified CVMs are not found.
FailedOperation.CvmVpcidNotMatch The CVM does not match the VPC ID.
FailedOperation.DbRecordNotFound Record not found.
FailedOperation.DfwGetUSGQuota Failed to obtain security group quota.
FailedOperation.NodeExistsSecondaryNetworkInterface The node has a secondary ENI.
FailedOperation.OsNotSupport The image OS is not supported.
FailedOperation.Param Invalid parameter.
FailedOperation.QuotaMaxClsLimit Reached the quota limit.
FailedOperation.QuotaMaxNodLimit Reached the quota limit.
FailedOperation.QuotaUSGLimit Insufficient security group quota.
FailedOperation.TradeCommon Query failed.
FailedOperation.VpcCommon VPC error.
FailedOperation.VpcRecodrNotFound VPC record not found.
FailedOperation.WhitelistUnexpectedError Allowlist error.
InternalError Internal error.
InternalError.AccountCommon Failed to obtain the user authentication information
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.ComponentClinetHttp Error while requesting (HTTP) other Tencent Cloud services
InternalError.CreateMasterFailed Failed to create cluster.
InternalError.CvmCommon Error in node creation.
InternalError.CvmNumberNotMatch Some of the CVMs cannot be found
InternalError.CvmStatus Exceptional CVM status.
InternalError.Db DB error.
InternalError.DbAffectivedRows Database error.
InternalError.DbRecordNotFound Record not found.
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.OsNotSupport Image OS not supported.
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.TaskCreateFailed Failed to create the task.
InternalError.TradeCommon Billing error.
InternalError.UnexceptedInternal Internal error.
InternalError.UnexpectedInternal Unknown internal error.
InternalError.VpcCommon VPC error
InternalError.VpcRecodrNotFound VPC record not found
InvalidParameter Parameter error.
InvalidParameter.CIDRInvalid Invalid CIDR block.
InvalidParameter.CIDRMaskSizeOutOfRange Invalid CIDR block mask (valid range: 10 to 24).
InvalidParameter.CidrConflictWithOtherCluster The CIDR block conflicts with the CIDR blocks of other clusters.
InvalidParameter.CidrConflictWithOtherRoute The route to create conflicts with existing routes.
InvalidParameter.CidrConflictWithVpcCidr The CIDR block conflicts with the VPC’s CIDR block.
InvalidParameter.CidrConflictWithVpcGlobalRoute The created route conflicts with the existing global route under the VPC.
InvalidParameter.CidrInvali Invalid CIDR block.
InvalidParameter.CidrInvalid Parameter error. The CIDR block does not meet the specification.
InvalidParameter.InvalidPrivateNetworkCIDR Invalid private CIDR block.
LimitExceeded Quota limit is exceeded.
ResourceInsufficient.SpecifiedInstanceType Insufficient CVM resources.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈