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

具体的 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_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_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_disk_category":"Worker节点数据盘类型",
    "worker_data_disk_size":"Worker节点数据盘大小",
    "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",
    "taint": "给节点添加taint, 数组格式对象"
}
托管Kubernetes集群
{
"disable_rollback": "失败是否回滚",
"name": "集群名称",
"timeout_mins": "集群创建超时时间",
"cluster_type": "集群类型,ManagedKubernetes",
"region_id": "地域",
"vpcid": "VPC ID",
"vswitch_ids": "一台或多台虚拟交换机 ID,N 的取值范围为 [1, 5]",
"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_disk_category":"数据盘类型",
"worker_data_disk_size":"数据盘大小",
"num_of_nodes": "Worker节点数",
"snat_entry": 是否配置SNATEntry,
"endpoint_public_access":"是否公网暴露集群endpoint",
"proxy_mode": "网络模式, 可选值iptables|ipvs",
"addons": "选装addon, 数组格式对象", 
"terway": "日志插件, logtail-ds",
"tags": "给集群打tag标签, 数组格式对象",
"security_group_id": "安全组ID",
"taint": "给节点添加taint, 数组格式对象"
}

Serverless Kubernetes集群

{
"cluster_type": "Ask", 
"name": "集群名称",
"region_id": "地域",
"nat_gateway": "true", //是否创建NAT网关
"private_zone": "true", //是否开启privateZone用于服务发现
"vpc_id": "VPC ID", //不填则自动创建专有网络VPC
"vswitch_id": "交换机ID"
}

响应结果

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