全部文档
当前文档

暂无内容

如果没有找到您期望的内容,请尝试其他搜索词

文档中心

创建集群

最近更新时间:2024-09-10 16:07:38

CreateCluster(创建集群)

接口描述

该接口适用于用户创建容器集群。

请求方式

POST

输入参数

参数

类型

是否必选

描述

ClusterName

String

集群名称
有效值:2-64个字符,支持中文,英文,数字,以及特殊字符-,.!$^*()%#&+/:;<=>[]_`{}~

ClusterDesc

String

集群描述

ClusterManageMode

String

master管理形态
有效值:ManagedCluster,DedicatedCluster
默认值:DedicatedCluster

VpcId

String

集群所在的vpcid

PodCidr

String

集群pod的网段,如:10.0.0.0/16
校验:容器集群pod的网段不能和Service网段和VPC的网段冲突;托管集群不支持33网段

ServiceCidr

String

集群Service的网段,如:10.1.0.0/16
校验:容器集群Service的网段不能和Pod网段和VPC的网段冲突

MaxPodPerNode

Integer

每个节点上运行的pod数量上限
默认值:128
可选值:16,32,64,128,256

NetworkType

String

集群的网络模型
有效值:Flannel、Canal

K8sVersion

String

容器服务支持的k8s的集群版本号
有效值:v1.21.3、v1.23.17、v1.25.12、v1.27.7

ReserveSubnetId

String

集群所在vpc终端子网id

ManagedClusterMultiMaster.N

Array of ManagedClusterMultiMaster

当集群类型为托管集群时生效,为托管集群控制面进行子网和安全组配置,支持配置多个

MasterEtcdSeparate

Boolean

该字段仅针对于独立部署集群生效,托管集群不生效。集群Master和Etcd组件部署方式,有效值:
True:Master和Etcd组件独享节点部署
False:Master和Etcd组件共享节点部署
默认值:False

PublicApiServer

String

是否将apiserver暴露到公网。若不需要暴露,则不填写此选项;若选择暴露,则会创建公网SLB和EIP用于开启集群的Api Server公网访问。需要用户传递弹性EIP创建透传参数,json化字符串格,详见创建弹性IP

InstanceForNode.N

Array of InstanceForNode

新建节点创建集群,定义节点角色和配置,支持云服务器机和专属云服务器。

ExistedInstanceForEpc.N

Array of ExistedInstanceForEpc

使用已有的云物理机创建集群,定义节点角色和配置

EncryptionProviderKey

String

指定KMS密钥ID,使用该密钥对数据盘进行加密

返回参数

参数

类型

描述

RequestId

String

请求id

ClusterId

String

集群id

调用示例1 创建普通云服务器集群

输入示例

http://kce.api.ksyun.com/?Action=CreateCluster&Version=2020-12-31
&ClusterName=openapi开机集群
&ClusterDesc=This is a test cluster
&ClusterManageMode=DedicatedCluster
&VpcId=31e21dca-c92e-4b06-a8ce-xxxxx
&PodCidr=10.66.0.0/16
&ServiceCidr=10.254.0.0/16
&NetworkType=Flannel
&K8sVersion=v1.12.3
&ReserveSubnetId=372bdbac-ea1d-4f99-9c30-xxxxxxx
&PublicApiServer={"LineId":"xxxxxxx","BandWidth":"5","ChargeType":"PostPaidByDay"}
&InstanceForNode.1.NodeRole=Master_Etcd
&InstanceForNode.1.NodeConfig.1.Para={"MaxCount":3,"MinCount":3,"ImageId":"5bbc21d6-c48c-4c8a-b057-fcbb164bcbf7","SubnetId":"7e23b980-11c2-4bb0-9388-xxxxxxx","InstancePassword":"xxxxxxx","SecurityGroupId":"d46c7672-7ca9-4f51-bbd9-0e28ccdf3fac","ChargeType":"Daily","SystemDisk.DiskType":"SSD3.0","SystemDisk.DiskSize":30,"DataDisk.1.Type":"SSD3.0","DataDisk.1.Size":50,"InstanceType":"N2.4B","PurchaseTime":0,"InstanceName":"master","InstanceNameSuffix":1,"DataDisk.1.DeleteWithInstance":"true"}
&InstanceForNode.1.NodeConfig.1.AdvancedSetting.DockerPath=/data1/docker
&InstanceForNode.1.NodeConfig.1.AdvancedSetting.Label.1.Key=createdby
&InstanceForNode.1.NodeConfig.1.AdvancedSetting.Label.1.Value=user
&InstanceForNode.1.NodeConfig.1.AdvancedSetting.DataDisk.FileSystem=ext3
&InstanceForNode.1.NodeConfig.1.AdvancedSetting.DataDisk.MountTarget=/data1
&InstanceForNode.2.NodeRole=Worker
&InstanceForNode.2.NodeConfig.1.Para={"MaxCount":1,"MinCount":1,"ImageId":"5bbc21d6-c48c-4c8a-b057-fcbb164bcbf7","SubnetId":"7e23b980-11c2-4bb0-9388-xxxxxxx","InstancePassword":"Root123123","SecurityGroupId":"d46c7672-7ca9-4f51-bbd9-0e28ccdf3fac","ChargeType":"Daily","SystemDisk.DiskType":"SSD3.0","SystemDisk.DiskSize":30,"DataDisk.1.Type":"SSD3.0","DataDisk.1.Size":50,"InstanceType":"N2.4B","PurchaseTime":0,"InstanceName":"worker","InstanceNameSuffix":1,"DataDisk.1.DeleteWithInstance":"true"}
&InstanceForNode.2.NodeConfig.1.AdvancedSetting.DockerPath=/data1/docker
&InstanceForNode.2.NodeConfig.1.AdvancedSetting.Label.1.Key=createby
&InstanceForNode.2.NodeConfig.1.AdvancedSetting.Label.1.Value=user
&InstanceForNode.2.NodeConfig.1.AdvancedSetting.DataDisk.FileSystem=ext4
&InstanceForNode.2.NodeConfig.1.AdvancedSetting.DataDisk.MountTarget=/data1

返回示例

{
    "RequestId": "c9afa2b9-be8a-49d4-bebf-xxxxxxx"
    "ClusterId": "b12d7079-1e59-4626-90eb-xxxxxxx"
}

调用示例2 使用云物理主机创建集群

支持使用已有的云物理主机创建容器集群。

输入示例

http://kce.api.ksyun.com/?Action=CreateCluster&Version=2020-12-31
&MaxPodPerNode=256
&ClusterManageMode=DedicatedCluster
&VpcId=31e21dca-c92e-4b06-a8ce-xxxxxx
&PodCidr=10.78.0.0/16
&ServiceCidr=10.254.0.0/16
&NetworkType=Flannel
&K8sVersion=v1.15.5
&ReserveSubnetId=372bdbac-ea1d-4f99-9c30-xxxxxx
&ClusterName=test-cluster
&ClusterDesc=测试
&ExistedInstanceForEpc.1.NodeRole=Master_Etcd
&ExistedInstanceForEpc.1.EpcConfig.1.Para:{"InstanceId":"082ecbfc-b84e-49a1-a3b9-xxxxxx"}
&ExistedInstanceForEpc.1.EpcConfig.1.AdvancedSetting.DockerPath=/data1/data/docker
&ExistedInstanceForEpc.1.EpcConfig.1.AdvancedSetting.Label.1.Key=createby
&ExistedInstanceForEpc.1.EpcConfig.1.AdvancedSetting.Label.1.Value=user
&ExistedInstanceForEpc.1.EpcConfig.2.Para={"InstanceId":"1016c2ef-9a34-42a5-a2c4-xxxxxx"}
&ExistedInstanceForEpc.1.EpcConfig.2.AdvancedSetting.DockerPath=/data1/data/docker
&ExistedInstanceForEpc.1.EpcConfig.2.AdvancedSetting.Label.1.Key=createby
&ExistedInstanceForEpc.1.EpcConfig.2.AdvancedSetting.Label.1.Value=user
&ExistedInstanceForEpc.1.EpcConfig.3.Para={"InstanceId":"824cc7ad-bbb7-4dd3-9ccd-xxxxxx"}
&ExistedInstanceForEpc.1.EpcConfig.3.AdvancedSetting.DockerPath=/data1/data/docker
&ExistedInstanceForEpc.2.NodeRole=Worker
&ExistedInstanceForEpc.2.EpcConfig.1.Para={"InstanceId":"f8574c10-620d-4264-8b2b-xxxxxx"}
&ExistedInstanceForEpc.2.EpcConfig.1.AdvancedSetting.DockerPath=/data1/data/docker
&ExistedInstanceForEpc.2.EpcConfig.1.AdvancedSetting.UserScript=dG91Y2ggL3Jvb3QvMTExMQo=
&ExistedInstanceForEpc.2.EpcConfig.1.AdvancedSetting.Schedulable=false

返回示例

{
    "RequestId": "c79283f6-49c5-4c18-ba74-xxxxxx",
    "ClusterId": "be502bb4-49e2-4572-ba63-xxxxxx"
}

文档导读
纯净模式常规模式

纯净模式

点击可全屏预览文档内容
文档反馈