Create a cluster with a specified number of new nodes. For more information about the API description, see Container Service API reference.

Scope

Swarm clusters and Kubernetes clusters.

API request and response

Request format

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

Parameter descriptions:

  • --header Specify Content-Type as application/json.
  • --body is the body to be sent to the server, which can be read from a local file and must be in the valid JSON format. The create.json contents are as follows:
Swarm clusters
{
"password": "password used to log on to the Elastic Compute Service (ECS) instance by using SSH",
"region_id": "region ID",
"instance_type": "ECS instance type",
"name": "cluster name",
"size": "number of nodes",
"network_mode": "network type, currently only supports Virtual Private Cloud (VPC)",
"vpc_id": "VPC_ID",
"vswitch_id": "VSwitch ID of the VPC instance",
"subnet_cidr": "container Classless Inter-Domain Routing (CIDR) block",
"data_disk_category": "data disk type",
"data_disk_size": "data disk size",
"need_slb": "whether or not to create the Server Load Balancer instance by default",
"io_optimized": "whether or not to be I/O optimized, which is yes by default in the VPC environment",
"ecs_image_id": "image ID",
"release_eip_flag": "whether to release Elastic IP (EIP) after configuring the cluster"
}
Kubernetes clusters (a single zone)
{
"disable_rollback": "whether or not to roll back if the cluster fails to be created",
"name": "cluster name",
"timeout_mins": "timeout for creating the cluster",
"cluster_type": "Kubernetes",
"region_id": "region",
"vpcid": "Virtual Private Cloud (VPC) ID",
"zoneid": "zone",
"vswitchid": "VSwitch ID", 
"container_cidr": "pod Classless Inter-Domain Routing (CIDR)",
"service_cidr": "service CIDR",
"ssh_flags": "whether or not to enable SSH access for Internet", 
"cloud_monitor_flags":"whether or not to install the cloud monitoring plug-in",
"login_password": "password used to log on to the node by using SSH. Use either this parameter or the key_pair.",
"key_pair":"key pair name. Use either this parameter or login_password.",
"master_instance_charge_type":"master instance payment type, which includes postpaid and prepaid",
"master_period_unit":"subscription unit, which includes month and year, and takes effect only for the prepaid type",
"master_period":"subscription period, which takes effect only for the prepaid type",
"master_auto_renew":"whether master nodes auto renew",
"master_auto_renew_period":"master node renew period",
"master_instance_type": "master instance type",
"master_system_disk_category": "system disk type of master nodes",
"master_system_disk_size":"system disk size of master nodes",
"master_data_disk":"Whether the master node has data disks mounted",
"master_data_disk_category":"data disk type of master nodes",
"master_data_disk_size":"data disk size of master nodes",
"worker_instance_charge_type":"worker node payment type, which includes prepaid and postpaid",
"worker_period_unit":"subscription unit, which includes month and year, and takes effect only for the prepaid type.
"worker_period":"subscription period, which takes effect only for the prepaid type",
"worker_auto_renew":"worker nodes auto renew, which can be true or false",
"worker_auto_renew_period":"worker node renew period",
"worker_instance_type": "worker instance type",
"worker_system_disk_category": "system disk type of worker nodes",
"worker_system_disk_size": "system disk size of worker node",
"worker_data_disk":"whether the worker node has data disks mounted",
"worker_data_disk_category":"data disk type of worker nodes",
"worker_data_disk_size":"data disk size of worker nodes",
"num_of_nodes": "number of worker nodes",
"snat_entry": "whether or not to configure the SNATEntry",
"public_slb":"whether to create the SLB corresponding to the public network API server"
} 
Kubernetes clusters (multiple zones)
{
"disable_rollback": "whether or not to roll back if the cluster fails to be created",
"name": "cluster name",
"timeout_mins": "timeout for creating the cluster",
"cluster_type": "Kubernetes",
"region_id": "region",
"multi_az": true,
"vpcid": "VPC ID ",
"container_cidr": "container Classless Inter-Domain Routing (CIDR)", 
"service_cidr": "service CIDR",
"vswitch_id_a": "switch ID of the first zone",
"vswitch_id_b": "switch ID of the second zone",
"vswitch_id_c": "switch ID of the third zone", 
"master_instance_type_a": "instance type of master nodes in the first zone",
"master_instance_type_b": "instance type of master nodes in the second zone",
"master_instance_type_c": "instance type of master nodes in the third zone", 
"master_instance_charge_type":"master instance payment type, which includes prepaid and postpaid",
"master_period_unit":"subscription unit, which includes month and year, and takes effect only for the prepaid type",
"master_period":"subscription period, which takes effect only for the prepaid type",
"master_auto_renew":"whether master nodes auto renew",
"master_auto_renew_period":"master node renew period", 
"master_system_disk_category": "system disk type of master nodes",
"master_system_disk_size": "system disk size of master nodes", 
"master_data_disk":"Whether the master node has data disks mounted",
"master_data_disk_category":"data disk type of master nodes",
"master_data_disk_size":"data disk size of master nodes", 
"worker_instance_type_a": "instance type of worker nodes in the first zone",
"worker_instance_type_b": "instance type of worker nodes in the second zone",
"worker_instance_type_c": "instance type of worker nodes in the third zone",
"worker_instance_charge_type":"worker node payment type, which includes postpaid and prepaid",
"worker_period_unit":"subscription unit, which includes month and year, and takes effect only for the prepaid type.
"worker_period":"subscription period, which takes effect only for the prepaid type",
"worker_auto_renew":"worker nodes auto renew, which can be true or false",
"worker_auto_renew_period":"worker node renew period", 
"worker_system_disk_category": "system disk type of worker nodes",
"worker_system_disk_size": "system disk size of worker nodes",
"worker_data_disk":"whether the worker node has data disks mounted",
"worker_data_disk_category":"data disk type of worker nodes",
"worker_data_disk_size":"data disk size of worker nodes", 
"num_of_nodes_a": "number of worker nodes in the first zone",
"num_of_nodes_b": "number of worker nodes in the second zone",
"num_of_nodes_c": "number of worker nodes in the third zone",
"ssh_flags": "whether or not to enable SSH access for Internet",
"login_password": "password used to log on to the node by using SSH", 
"cloud_monitor_flags":"whether or not to install the cloud monitoring plug-in",
"public_slb":"whether to create the SLB corresponding to the public network API server"
}
Managed Kubernetes clusters
{
"disable_rollback": "whether or not to roll back if the cluster fails to be created",
"name": "cluster name",
"timeout_mins": "timeout for creating the cluster",
"cluster_type": "ManagedKubernetes",
"region_id": "region. Currently, only cn-beijing and cn-hangzhou are supported",
"vpcid": "VPC ID ",
"zoneid": "zone",
"vswitchid": "VSwitch ID", 
"container_cidr": "pod Classless Inter-Domain Routing (CIDR)",
"service_cidr": "service CIDR",
"cloud_monitor_flags":"whether or not to install the cloud monitoring plug-in",
"login_password": "password used to log on to the node by using SSH. Use either this parameter or the key_pair.",
"key_pair":"key pair name. Use either this parameter or login_password.",
"worker_instance_charge_type":"worker node payment type, which includes prepaid and postpaid",
"worker_period_unit":"subscription unit, which includes month and year, and takes effect only for the prepaid type.
"worker_period":"subscription period, which takes effect only for the prepaid type",
"worker_auto_renew":"worker nodes auto renew, which can be true or false",
"worker_auto_renew_period":"worker node renew period",
"worker_instance_type": "worker instance type",
"worker_system_disk_category": "system disk type of worker nodes",
"worker_system_disk_size": "system disk size of worker nodes",
"worker_data_disk":"use  true or false to determine whether or not to mount data disks",
"worker_data_disk_category":"data disk type",
"worker_data_disk_size":"data disk size",
"num_of_nodes": "number of worker nodes",
"snat_entry": "whether or not to configure the SNATEntry",
}ntry": whether or not to configure the SNATEntry,
			}

Response results

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