创建集群

最近更新时间:2020-02-08 22:00:36

CreateCluster(创建集群)

接口描述

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

请求方式

POST

输入参数

参数 类型 是否必选 描述
ClusterName String 集群名称
有效值:2-64个字符,支持中文,英文,数字,以及特殊字符-,.!$^*()%#&+/:;<=>[]_`{}~
ClusterDesc String 集群描述
ClusterManageMode String master管理形态
有效值:DedicatedCluster
默认值:DedicatedCluster
ClusterType String 集群类型
有效值:VirtualMachine(虚拟机集群), BareMetal(物理机集群)
默认值:VirtualMachine
VpcId String 集群所在的vpcid
PodCidr String 集群pod的网段,如:10.0.0.0/16
校验:容器集群pod的网段不能和Service网段和VPC的网段冲突
ServiceCidr String 集群Service的网段,如:10.1.0.0/16
校验:容器集群Service的网段不能和Pod网段和VPC的网段冲突
NetworkType String 集群的网络模型
有效值:Flannel、Canal
K8sVersion String 容器服务支持的k8s的集群版本号
有效值:v1.12.3、v1.13.4、v1.15.5
备注:物理机集群暂不支持v1.13.4版本
ReserveSubnetId String 集群所在vpc终端子网id
InstanceSet.N InstanceSet.N数据类型 定义集群中的节点角色和配置,支持普通云主机和专属云主机.
节点配置信息使用云主机/专属云主机创建透传参数,json化字符串格式,详见云主机创建实例接口专属云主机创建示例接口
PublicApiServer String 默认创建公网SLB和EIP用于开启集群的Api Server公网访问。弹性EIP创建透传参数,json化字符串格,详见创建弹性IP。如不填写,则EIP带宽默认1M,计费方式默认按日月结。

返回参数

参数 类型 描述
RequestId String 请求id
ClusterId String 集群id

调用示例

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

输入示例

http://kce.api.ksyun.com/?Action=CreateCluster&Version=2019-08-06
&ClusterName=openapi开机集群
&ClusterDesc=This is a test cluster
&ClusterType=VirtualMachine
&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"}
&InstanceSet.0.NodeRole=Master_Etcd
&InstanceSet.0.NodePara.0={"MaxCount":3,"MinCount":3,"ImageId":"5bbc21d6-c48c-4c8a-b057-fcbb164bcbf7","SubnetId":"7e23b980-11c2-4bb0-9388-xxxxxxxx","InstancePassword":"Root23123","SecurityGroupId":"d46c7672-7ca9-4f51-bbd9-xxxxxxxx","DataDiskGb":50,"ChargeType":"Daily","InstanceType":"I3.4B","PurchaseTime":0,"InstanceName":"openapi-master","InstanceNameSuffix":1}
&InstanceSet.1.NodeRole=Worker
&InstanceSet.1.NodePara.0={"MaxCount":3,"MinCount":3,"ImageId":"5bbc21d6-c48c-4c8a-b057-fcbb164bcbf7","SubnetId":"7e23b980-11c2-4bb0-9388-xxxxxxxx","InstancePassword":"Root23123","SecurityGroupId":"d46c7672-7ca9-4f51-bbd9-xxxxxxxx","DataDiskGb":50,"ChargeType":"Daily","InstanceType":"I3.4B","PurchaseTime":0,"InstanceName":"openapi-worker","InstanceNameSuffix":1}

返回示例

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

示例2 创建专属云服务器集群

支持使用专属云服务器创建容器集群

输入示例

http://kce.api.ksyun.com/?Action=CreateCluster&Version=2019-08-06
&ClusterType=VirtualMachine
&ClusterManageMode=DedicatedCluster
&VpcId=31e21dca-c92e-4b06-a8ce-xxxxxx
&PodCidr=10.67.0.0/16
&ServiceCidr=10.254.0.0/16
&NetworkType=Flannel
&K8sVersion=v1.12.3
&ReserveSubnetId=372bdbac-ea1d-4f99-9c30-xxxxxx
&InstanceSet.0.NodeRole=Master_Etcd
&InstanceSet.0.NodePara.0={"DedicatedHostId":"33b44f3e-a037-423e-a850-xxxxxx","InstanceConfigure.VCPU":4,"InstanceConfigure.MemoryGb":8,"MaxCount":3,"MinCount":3,"ImageId":"5bbc21d6-c48c-4c8a-b057-fcbb164bcbf7","SubnetId":"f2ac1919-0e34-4812-8290-xxxxxx","InstancePassword":"Root23123","SecurityGroupId":"d46c7672-7ca9-4f51-bbd9-xxxxxx","DataDiskGb":50,"ChargeType":"Daily","PurchaseTime":0,"InstanceName":"k8s-kdc-master","InstanceNameSuffix":1,"InstanceType":"DVM1.NONE"}
&InstanceSet.1.NodeRole=Worker
&InstanceSet.1.NodePara.0={"DedicatedHostId":"33b44f3e-a037-423e-a850-xxxxxx","InstanceConfigure.VCPU":4,"InstanceConfigure.MemoryGb":8,"MaxCount":3,"MinCount":3,"ImageId":"5bbc21d6-c48c-4c8a-b057-fcbb164bcbf7","SubnetId":"f2ac1919-0e34-4812-8290-xxxxxx","InstancePassword":"Root23123","SecurityGroupId":"d46c7672-7ca9-4f51-bbd9-xxxxxxx","DataDiskGb":50,"ChargeType":"Daily","PurchaseTime":0,"InstanceName":"k8s-kdc-worker","InstanceNameSuffix":1,"InstanceType":"DVM1.NONE"}
&ClusterName=专属云服务器集群
&ClusterDesc=This is a kdc cluster

返回示例

{
    "RequestId": "308b6948-9c74-41b6-8356-7bcced1da043",
    "ClusterId": "52286a83-f317-416d-820e-xxxxxxx"
}

示例3 创建物理机集群

支持创建物理机集群

输入示例

http://kce.api.ksyun.com/?Action=CreateCluster&Version=2019-08-06
&ClusterName=物理机集群
&ClusterDesc=This is a epc cluster
&ClusterType=BareMetal
&ClusterManageMode=DedicatedCluster
&VpcId=31e21dca-c92e-4b06-a8ce-xxxxx
&PodCidr=10.77.0.0/16
&ServiceCidr=10.254.0.0/16
&NetworkType=Flannel
&K8sVersion=v1.12.3
&ReserveSubnetId=372bdbac-ea1d-4f99-9c30-xxxxxxx
&InstanceSet.0.NodeRole=Master_Etcd
&InstanceSet.0.NodePara.0={"MaxCount":3,"MinCount":3,"ImageId":"5bbc21d6-c48c-4c8a-b057-fcbb164bcbf7","SubnetId":"7e23b980-11c2-4bb0-9388-xxxxxxxx","InstancePassword":"Root23123","SecurityGroupId":"d46c7672-7ca9-4f51-bbd9-xxxxxxxx","DataDiskGb":50,"ChargeType":"Daily","InstanceType":"I3.4B","PurchaseTime":0,"InstanceName":"openapi-master","InstanceNameSuffix":1}

返回示例

{
    "RequestId": "3b938ed4-e85b-4cc0-8163-e761bf544362",
    "ClusterId": "12d776f8-bb96-4556-9be6-xxxxxxx"
}

金山云,开启您的云计算之旅

注册有礼