创建一个新的集群实例,并新建指定数量的节点。

具体的 API 描述,参见创建Kubernetes集群创建Managed Kubernetes集群

API请求响应

请求格式

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

参数说明:

  • --header需要指定 Content-Typeapplication/json
  • --body 是要发送给服务端的 body 内容,可以从本地文件读取,需要是有效的 JSON 格式。create.json 的内容如下所示。
Kubernetes集群
{
    "disable_rollback": "失败是否回滚",
    "name": "集群名称",
    "timeout_mins": "集群创建超时时间",
    "cluster_type": "集群类型,Kubernetes",
    "region_id": "地域",
    "vpcid": "VPC ID",
    "master_vswitch_ids": "master节点交换机ID。填写3个vswitchid, 尽量是分别在3个不同az, 保证高可用",
    "master_instance_types": "master节点实例类型。填写3个实例规格",
    "master_count": "master实例个数,支持3|5",
    "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_system_disk_category": "Master系统盘类型",
    "master_system_disk_size": "Master节点系统盘大小",
    "master_data_disk(已弃用)": "Master节点是否挂载数据盘",
    "master_data_disks": "Master节点数据盘配置",
    "master_system_disk_snapshot_policy_id": "Master节点系统盘快照策略ID",
    "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_types": "Worker实例规格多实例规格参数",
    "worker_vswitch_ids": "一台或多台虚拟交换机 ID,N 的取值范围为 [1, 5]",
    "worker_system_disk_category": "Worker系统盘类型",
    "worker_system_disk_size": "Worker节点系统盘大小",
    "worker_data_disk(已弃用)": "Worker节点是否挂载数据盘",
    "worker_data_disks": "Worker节点数据盘配置",
    "worker_system_disk_snapshot_policy_id": "Worker节点系统盘快照策略ID",
    "num_of_nodes": "Worker节点数",
    "snat_entry": "是否配置SNATEntry",
    "endpoint_public_access": "是否公网暴露集群endpoint",
    "cpu_policy": "static|none",
    "node_port_range": "节点端口范围,默认30000-65535",
    "proxy_mode": "网络模式, 可选值iptables|ipvs",
    "addons": "选装addon, 数组格式对象", 
    "tags": "给集群打tag标签, 数组格式对象",
    "security_group_id": "安全组ID",
    "auto_snapshot_policy_id": "自动快照策略ID",
    "taints": "给节点添加taint, 数组格式对象",
    "deletion_protection":"是否开启集群删除保护,防止通过控制台或api误删除集群",
    "os_type":"运行pod的主机的操作系统类型,例如:linux,Windows等",
    "platform":"运行pod的主机的平台架构",
    "runtime":"容器运行时,默认为docker",
}
托管Kubernetes集群
{
"disable_rollback": "失败是否回滚",
"name": "集群名称",
"timeout_mins": "集群创建超时时间",
"cluster_type": "集群类型,ManagedKubernetes",
"region_id": "地域",
"vpcid": "VPC ID",
"vswitch_ids": "一台或多台虚拟交换机 ID,N 的取值范围为 [1,3]",
"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_types": "Worker实例规格多实例规格参数 ",
"worker_system_disk_category": "Worker系统盘类型",
"worker_system_disk_size": "Worker节点系统盘大小",
"worker_data_disk":"是否挂载数据盘 true|false",
"worker_data_disks":"Worker节点数据盘配置",
"num_of_nodes": "Worker节点数",
"snat_entry": "是否配置SNATEntry",
"endpoint_public_access":"是否公网暴露集群endpoint",
"proxy_mode": "网络模式, 可选值iptables|ipvs",
"addons": "选装addon, 数组格式对象", 
"tags": "给集群打tag标签, 数组格式对象",
"security_group_id": "安全组ID",
"taints": "给节点添加taint, 数组格式对象",
"cpu_policy":"cpu的策略,static|none",
"runtime":"容器的运行时环境,一般为docker",
"platform":"运行pod的主机的平台架构",
"os_type":"运行pod的主机的操作系统类型,例如:linux,Windows...",
"node_cidr_mask":"节点网络的网络ID的位数",
"kubernetes_version":"kubernetes集群的版本,默认最新版本",
"deletion_protection":"是否开启集群删除保护,防止通过控制台或api误删除集群"
}

Serverless Kubernetes集群

{
"cluster_type": "Ask", 
"name": "集群名称",
"region_id": "地域",
"zoneid": "可用区",
"nat_gateway": "true", //是否创建NAT网关
"private_zone": "true", //是否开启privateZone用于服务发现
"vpc_id": "VPC ID", //不填则自动创建专有网络VPC
"tags": "给集群打tag标签, 数组格式对象",
"vswitch_id": "交换机ID"
}

响应结果

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