创建一个新的集群实例,并新建指定数量的节点。具体的 API 描述,参见 容器服务 API 参考

适用范围

Swarm 集群和 Kubernetes 集群。

API请求响应

请求格式

aliyun cs  POST /clusters --header "Content-Type=application/json" --body "$(cat create.json)"

参数说明:

  • --header需要指定 Content-Typeapplication/json
  • --body 是要发送给服务端的 body 内容,可以从本地文件读取,需要是有效的 JSON 格式。create.json 的内容如下所示。
 swarm 集群
{
"password": "ECS机器SSH密码",
"region_id": "地域ID",
"instance_type": "实例规格",
"name": "集群名称",
"size": 节点数量,
"network_mode": "网络类型,目前仅支持vpc",
"vpc_id": "VPC示例ID",
"vswitch_id": "VPC下的交换机ID",
"subnet_cidr": "容器CIDR",
"data_disk_category": "数据盘类型",
"data_disk_size": 数据盘大小,
"need_slb": 是否默认创建SLB,
"io_optimized":"是否IO优化,VPC下目前默认为IO优化",
"ecs_image_id": "镜像ID",
"release_eip_flag": "是否需要在集群配置完成后释放EIP"
}
 Kubernetes集群(单可用区)
{
"disable_rollback": "失败是否回滚",
"name": "集群名称",
"timeout_mins": 集群创建超时时间,
"cluster_type": "Kubernetes",
"region_id": "地域",
"vpcid": "VPC ID",
"zoneid": "可用区",
"vswitchid": "交换机ID", 
"container_cidr": "容器POD CIDR",
"service_cidr": "服务CIDR",
"ssh_flags": "是否开放公网SSH登陆", 
"cloud_monitor_flags":"是否安装云监控插件",
"login_password": "节点SSH登陆密码,和key_pair二选一",
"key_pair":"keypair名称,和login_password 二选一",
"master_instance_charge_type":"Master实例付费类型,PostPaid|PrePaid",
"master_period_unit":"包年包月单位,Month,Year,只有在PrePaid下生效",
"master_period":"包年包月时长,只有在PrePaid下生效",
"master_auto_renew":"Master节点是否自动续费",
"master_auto_renew_period":"Master节点续费周期",
"master_instance_type": "Master实例规格",
"master_system_disk_category": "Master系统盘类型",
"master_system_disk_size":"Master节点系统盘大小",
"master_data_disk":"Master节点是否挂载数据盘",
"master_data_disk_category":"Master节点数据盘类型",
"master_data_disk_size":"Master节点数据盘大小",
"worker_instance_charge_type":"Worker节点付费类型PrePaid|PostPaid",
"worker_period_unit":"包年包月单位,Month,Year,只有在PrePaid下生效",
"worker_period":"包年包月时长,只有在PrePaid下生效",
"worker_auto_renew":"Worker节点自动续费true|false",
"worker_auto_renew_period":"Worker节点续费周期",
"worker_instance_type": "Worker实例规格",
"worker_system_disk_category": "Worker系统盘类型",
"worker_system_disk_size": "Worker节点系统盘大小",
"worker_data_disk":"Worker节点是否挂载数据盘",
"worker_data_disk_category":"Worker节点数据盘类型",
"worker_data_disk_size":"Worker节点数据盘大小",
"num_of_nodes": "Worker节点数",
"snat_entry": 是否配置SNATEntry,
"public_slb":"是否创建公网API Server对应的SLB"
} 
 Kubernetes集群(多可用区)
{
"disable_rollback":"失败是否回滚",
"name": "集群名称",
"timeout_mins": 集群创建超时时间,
"cluster_type": "Kubernetes",
"region_id": "地域"
"multi_az": true,
"vpcid": "VPC ID ",
"container_cidr": "容器 CIDR", 
"service_cidr": "服务 CIDR",
"vswitch_id_a": "第一个可用区交换机ID",
"vswitch_id_b": "第二个可用区交换机ID",
"vswitch_id_c": "第三个可用区交换机ID", 
"master_instance_type_a": "第一个可用区Master节点实例规格",
"master_instance_type_b": "第二个可用区Master节点实例规格",
"master_instance_type_c": "第三个可用区Master节点实例规格", 
"master_instance_charge_type":"Master实例付费类型,PostPaid|PrePaid",
"master_period_unit":"包年包月单位,Month,Year,只有在PrePaid下生效",
"master_period":"包年包月时长,只有在PrePaid下生效",
"master_auto_renew":"Master节点是否自动续费",
"master_auto_renew_period":"Master节点续费周期", 
"master_system_disk_category": "Master节点系统盘类型",
"master_system_disk_size": "Master节点系统盘大小", 
"master_data_disk":"Master节点是否挂载数据盘",
"master_data_disk_category":"Master节点数据盘类型",
"master_data_disk_size":"Master节点数据盘大小", 
"worker_instance_type_a": "第一个可用区Worker节点实例规格",
"worker_instance_type_b": "第二个可用区Worker节点实例规格",
"worker_instance_type_c": "第三个可用区Worker节点实例规格",
"worker_instance_charge_type":"Worker节点付费类型PrePaid|PostPaid",
"worker_period_unit":"包年包月单位,Month,Year,只有在PrePaid下生效",
"worker_period":"包年包月时长,只有在PrePaid下生效",
"worker_auto_renew":"Worker节点自动续费true|false",
"worker_auto_renew_period":"Worker节点续费周期", 
"worker_system_disk_category": "Worker节点系统盘类型",
"worker_system_disk_size": "Worker节点系统盘大小",
"worker_data_disk":"Worker节点是否挂载数据盘",
"worker_data_disk_category":"Worker节点数据盘类型",
"worker_data_disk_size":"Worker节点数据盘大小", 
"num_of_nodes_a": "第一个可用区Worker节点数",
"num_of_nodes_b": "第二个可用区Worker节点数",
"num_of_nodes_c": "第三个可用区Worker节点数",
"ssh_flags": "是否开放公网SSH 登陆",
"login_password": "SSH 登陆密码", 
"cloud_monitor_flags":"是否安装云监控插件",
"public_slb":"是否创建公网API Server对应的SLB"
}
 托管Kubernetes集群
{
"disable_rollback": "失败是否回滚",
"name": "集群名称",
"timeout_mins": 集群创建超时时间,
"cluster_type": "ManagedKubernetes",
"region_id": "地域,目前仅支持北京和杭州地域(cn-beijing,cn-hangzhou)",
"vpcid": "VPC ID",
"zoneid": "可用区",
"vswitchid": "交换机ID", 
"container_cidr": "容器POD CIDR",
"service_cidr": "服务CIDR",
"cloud_monitor_flags":"是否安装云监控插件",
"login_password": "节点SSH登陆密码,和key_pair二选一",
"key_pair":"keypair名称,和login_password 二选一",
"worker_instance_charge_type":"Worker节点付费类型PrePaid|PostPaid",
"worker_period_unit":"包年包月单位,Month,Year,只有在PrePaid下生效",
"worker_period":"包年包月时长,只有在PrePaid下生效",
"worker_auto_renew":"Worker节点自动续费true|false",
"worker_auto_renew_period":"Worker节点续费周期",
"worker_instance_type": "Worker实例规格",
"worker_system_disk_category": "Worker系统盘类型",
"worker_system_disk_size": "Worker节点系统盘大小",
"worker_data_disk":"是否挂载数据盘 true|false",
"worker_data_disk_category":"数据盘类型",
"worker_data_disk_size":"数据盘大小",
"num_of_nodes": "Worker节点数",
"snat_entry": 是否配置SNATEntry,
}ntry": 是否配置SNATEntry,
			}

响应结果

{
    "cluster_id": "c61cf530524474386a7ab5a1c192a0d57",
    "request_id": "348D4C9C-9105-4A1B-A86E-B58F0F875575",
    "task_id": "T-5ad724ab94a2b109e8000004"
}