This topic describes how to call the CreateCluster operation to create a Container Service for Kubernetes (ACK) dedicated cluster. You can create one or more node pools when you create an ACK dedicated cluster.
Container Service for Kubernetes (ACK) discontinues the creation of ACK dedicated clusters since 00:00:00 on August 21, 2024 (GMT+8). We recommend that you use ACK Pro clusters in production environments for higher reliability, security, and scheduling efficiency.
For more information about how to create an ACK Pro cluster, see Create an ACK managed cluster by calling an API operation.
For more information about how to migrate from an ACK dedicated cluster to an ACK Pro cluster, see Hot migration from ACK dedicated clusters to ACK Pro clusters.
If you want to create an ACK dedicated cluster, submit a ticket.
Debugging
Request syntax
POST /clusters HTTP/1.1
Content-Type:application/json
{
"name" : "String",
"region_id" : "String",
"cluster_type" : "String",
"kubernetes_version" : "String",
"runtime" : {
"name" : "String",
"version" : "String",
},
"resource_group_id" : "String",
"vpcid" : "String",
"pod_vswitch_ids" : [ "String" ],
"container_cidr" : "String",
"service_cidr" : "String",
"node_cidr_mask" : "String",
"security_group_id" : "String",
"is_enterprise_security_group" : Boolean,
"snat_entry" : Boolean,
"endpoint_public_access" : Boolean,
"load_balancer_spec" : "String",
"ssh_flags" : Boolean,
"timezone" : "String",
"proxy_mode" : "String",
"enable_rrsa" : Boolean,
"tags" : [ {
"key" : "String",
"value" : "String"
} ],
"cluster_domain" : "String",
"custom_san" : "String",
"service_account_issuer" : "String",
"api_audiences" : "String",
"disable_rollback" : Boolean,
"timeout_mins" : Long,
"deletion_protection" : Boolean,
"node_name_mode" : "String",
"keep_instance_name" : Boolean,
"rds_instances" : [ "String" ],
"master_count" : Long,
"image_type" : "String",
"image_id" : "String",
"os_type" : "String",
"master_vswitch_ids" : [ "String" ],
"master_instance_types" : [ "String" ],
"master_system_disk_category" : "String",
"master_system_disk_size" : Long,
"master_system_disk_performance_level" : "String",
"master_system_disk_snapshot_policy_id" : "String",
"master_instance_charge_type" : "String",
"master_period_unit" : "String",
"master_period" : Long,
"master_auto_renew" : Boolean,
"master_auto_renew_period" : Long,
"key_pair" : "String",
"login_password" : "String",
"addons" : [ {
"name" : "String",
"config" : "String",
"disabled" : Boolean
} ],
"cloud_monitor_flags" : Boolean,
"nodepools" : [ {
"auto_scaling" : {
"enable" : Boolean,
"max_instances" : Long,
"min_instances" : Long,
"type" : "String",
"is_bond_eip" : Boolean,
"eip_internet_charge_type" : "String",
"eip_bandwidth" : Long
},
"kubernetes_config" : {
"cms_enabled" : Boolean,
"cpu_policy" : "String",
"labels" : [ {
"key" : "String",
"value" : "String"
} ],
"runtime" : "String",
"runtime_version" : "String",
"taints" : [ {
"key" : "String",
"value" : "String",
"effect" : "String"
} ],
"user_data" : "String"
},
"nodepool_info" : {
"name" : "String",
"resource_group_id" : "String"
},
"scaling_group" : {
"auto_renew" : Boolean,
"auto_renew_period" : Long,
"data_disks" : [ {
"category" : "String",
"size" : Long,
"encrypted" : "String",
"auto_snapshot_policy_id" : "String"
} ],
"image_id" : "String",
"instance_charge_type" : "String",
"instance_types" : [ "String" ],
"key_pair" : "String",
"login_password" : "String",
"period" : Long,
"period_unit" : "String",
"platform" : "String",
"rds_instances" : [ "String" ],
"spot_strategy" : "String",
"spot_price_limit" : [ {
"instance_type" : "String",
"price_limit" : "String"
} ],
"scaling_policy" : "String",
"security_group_id" : "String",
"security_group_ids" : [ "String" ],
"system_disk_category" : "String",
"system_disk_size" : Long,
"tags" : [ {
"key" : "String",
"value" : "String"
} ],
"vswitch_ids" : [ "String" ],
"multi_az_policy" : "String",
"on_demand_base_capacity" : Long,
"on_demand_percentage_above_base_capacity" : Long,
"spot_instance_pools" : Long,
"spot_instance_remedy" : Boolean,
"compensate_with_on_demand" : Boolean,
"internet_charge_type" : "String",
"internet_max_bandwidth_out" : Long
},
"tee_config" : {
"tee_enable" : Boolean
},
"management" : {
"enable" : Boolean,
"auto_repair" : Boolean,
"upgrade_config" : {
"auto_upgrade" : Boolean,
"surge" : Long,
"surge_percentage" : Long,
"max_unavailable" : Long
}
},
"count" : Long
} ]
}
Request parameters
Request body parameters for basic configurations
Table 1. Request body parameters
Category | Parameter | Type | Required | Example | Description |
Basic configurations | name | String | Yes | cluster-demo | The cluster name. The name must be 1 to 63 characters in length, and can contain digits, letters, hyphens (-), and underscores (_). It cannot start with an underscore (_). |
region_id | String | Yes | cn-beijing | The ID of the region in which you want to deploy the cluster. | |
cluster_type | String | Yes | Kubernetes | The cluster type is
| |
kubernetes_version | String | No | 1.16.9-aliyun.1 | The Kubernetes version of the cluster. The Kubernetes versions supported by ACK are the same as the versions of open source Kubernetes. We recommend that you specify the latest Kubernetes version. If you do not specify this parameter, the latest Kubernetes version is used. You can create clusters of the latest two Kubernetes versions in the ACK console. If you want to create clusters of earlier Kubernetes versions, use the API. For more information about the Kubernetes versions supported by ACK, see Support for Kubernetes versions. | |
runtime | Array of runtime | No | {"name": "containerd", "version": "1.6.20"} | The name of the container runtime. The following types of runtime are supported by ACK:
Default value: | |
resource_group_id | String | No | rg-acfm3mkrure**** | The ID of the resource group to which the cluster belongs. You can use resource groups to isolate clusters. | |
Network parameters | vpcid | String | Yes | vpc-2zeik9h3ahvv2zz95**** | The VPC in which you want to deploy the cluster. You must specify this parameter during cluster creation. |
pod_vswitch_ids | Array of String | No | ["vsw-2ze97jwri7cei0mpw****"] | If you select Terway as the network plug-in, you must allocate vSwitches to pods. Each pod vSwitch corresponds to a vSwitch on the worker node. Both the pod vSwitch and its corresponding vSwitch on the worker node must be in the same zone. Important We recommend that you use a pod vSwitch with a CIDR block mask of no more than 19 bits. If this is not feasible, the maximum length should not exceed 25 bits. Exceeding this limit may restrict the number of assignable pod IP addresses in the cluster, which can impact the operation of the cluster. | |
container_cidr | String | No | 172.20.0.0/16 | The CIDR block of pods. This CIDR block cannot overlap with the CIDR block of the VPC in which you want to deploy the cluster. If the VPC is automatically created by the system, the default CIDR block of pods is 172.16.0.0/16. Important
| |
service_cidr | String | Yes | 172.21.0.0/20 | The CIDR block of Services. Valid values: 10.0.0.0/16-24, 172.16-31.0.0/16-24, and 192.168.0.0/16-24. The CIDR block of Services cannot overlap with the CIDR block of the VPC (10.1.0.0/21) or the CIDR blocks of existing clusters in the VPC. You cannot modify the CIDR block of Services after the cluster is created. By default, the CIDR block of Services is set to 172.19.0.0/20. | |
node_cidr_mask | String | No | 25 | The maximum number of IP addresses that can be assigned to each node. This number is determined by the specified pod CIDR block. This parameter takes effect only if the cluster uses Flannel as the network plug-in. Default value: | |
security_group_id | String | No | sg-bp1bdue0qc1g7k**** | The ID of an existing security group. You need to choose between this parameter and the | |
is_enterprise_security_group | Boolean | No | true | Specifies whether to create an advanced security group. This parameter takes effect only if Note To use a basic security group, make sure that the sum of the number of nodes in the cluster and the number of pods that use Terway does not exceed 2,000. Therefore, if the cluster uses Terway as the network plug-in, we recommend that you use an advanced security group.
Default value: | |
snat_entry | Boolean | No | true | Specifies whether to configure SNAT rules for the VPC where your cluster is deployed. Valid values:
Note If this feature is disabled when you create the cluster, you can manually enable this feature after the cluster is created. For more information, see Enable an existing ACK cluster to access the Internet. Default value: true. | |
endpoint_public_access | Boolean | No | true | Specifies whether to enable Internet access for the cluster. You can use an elastic IP address (EIP) to expose the API server. This way, you can access the cluster over the Internet. Valid values:
Default value: | |
load_balancer_spec | String | No | slb.s2.small | The specification of the Server Load Balancer (SLB) instance. Valid values:
Default value: | |
Advanced settings | ssh_flags | Boolean | No | true | Specifies whether to enable SSH logon over the Internet. If this parameter is set to true, you can log on to master nodes in an ACK dedicated cluster over the Internet. This parameter does not take effect in ACK managed clusters. Valid values:
Default value: |
timezone | String | No | Asia/Shanghai | The time zone of the cluster. For more information, see Time zones. | |
proxy_mode | String | No | ipvs | The kube-proxy mode. Valid values:
Default value: | |
enable_rrsa | Boolean | No | true | Specifies whether to enable the RAM Roles for Service Accounts (RRSA) feature. | |
tags | Array of tag | No |
| ||
cluster_domain | String | No | cluster.local | The domain name of the cluster. The domain name can contain one or more parts that are separated by periods (.). Each part cannot exceed 63 characters in length, and can contain lowercase letters, digits, and hyphens (-). Each part must start and end with a lowercase letter or digit. | |
custom_san | String | No | cs.aliyun.com | Specifies custom subject alternative names (SANs) for the API server certificate to accept requests from specified IP addresses or domain names. Multiple IP addresses and domain names are separated by commas (,). | |
service_account_issuer | String | No | kubernetes.default.svc | Service accounts provide identities for pods when pods communicate with the For more information about | |
api_audiences | String | No | kubernetes.default.svc | Service accounts provide identities for pods when pods communicate with the For more information about | |
disable_rollback | Boolean | No | true | Specifies whether to perform a rollback if the cluster fails to be created. Valid values:
Default value: | |
timeout_mins | Long | No | 60 | Specifies the timeout period of cluster creation. Unit: minutes. Default value: | |
deletion_protection | Boolean | No | true | Specifies whether to enable deletion protection for the cluster. If deletion protection is enabled, the cluster cannot be deleted in the ACK console or by calling API operations. Valid values:
Default value: | |
node_name_mode | String | No | aliyun.com192.168.0.55test | Specifies a custom node name. A custom node name consists of a prefix, a node IP address, and a suffix.
For example, if the node IP address is 192.168.0.55, the prefix is aliyun.com, and the suffix is test, the custom node name is aliyun.com192.168.0.55test. | |
keep_instance_name | Boolean | No | true | Specifies whether to retain the names of existing ECS instances that are used in the cluster. Valid values:
Default value: | |
rds_instances | Array of String | No | ["rm-2zev748xi27xc****"] | The names of the ApsaraDB RDS instances. | |
Master node configurations | master_count | Long | No | 3 | The number of master nodes that you want to create. Valid values: Default value: |
image_type | String | No | CentOS | The type of OS distribution that you want to use. Valid values:
Default value: | |
image_id | String | No | m-bp16z7xko3vvv8gt**** | Specifies a custom image for nodes. By default, the image provided by ACK is used. You can select a custom image to replace the default image. For more information, see Use a custom image to create an ACK cluster. | |
os_type | String | No | Linux | The type of node OS. Valid values:
Default value: | |
master_vswitch_ids | Array of String | No | ["vsw-2ze3ds0mdip0hdz8i****"] | The IDs of vSwitches. | |
master_instance_types | Array of String | No | ["ecs.n4.xlarge"] | The Elastic Compute Service (ECS) instance types of master nodes. For more information about ECS instance types, see Overview of instance families. | |
master_system_disk_category | Long | Yes | cloud_ssd | The type of system disk that you want to use for master nodes. Valid values:
Default value: | |
master_system_disk_size | Long | Yes | 120 | The size of the system disk that you want to use for master nodes. Valid values: 40 to 500. Unit: GiB. Default value: | |
master_system_disk_performance_level | String | No | PL1 | The performance level (PL) of the system disk that you want to use for master nodes. This parameter takes effect only for enhanced SSDs. You can specify a higher PL if you increase the size of the system disk. For more information, see Enhanced SSDs. | |
master_system_disk_snapshot_policy_id | String | No | sp-2zej1nogjvovnz4z**** | The ID of the automatic snapshot policy that you want to use for the system disks of master nodes. | |
master_instance_charge_type | String | No | PrePaid | The billing method of master nodes. Valid values:
Default value: | |
master_period_unit | String | No | Month | The billing cycle of master nodes. This parameter is required if master_instance_charge_type is set to Set the value to | |
master_period | Long | No | 1 | The subscription duration of master nodes. This parameter takes effect and is required only if Valid values: 1, 2, 3, 6, 12, 24, 36, 48, and 60. Default value: 1. | |
master_auto_renew | Boolean | No | true | Specifies whether to enable auto-renewal. This parameter takes effect only if
Default value: | |
master_auto_renew_period | Long | No | 1 | The auto-renewal period for master nodes after the subscriptions of master nodes expire. Unit: months. This parameter takes effect and is required only if the subscription billing method is selected for master nodes. Valid values: 1, 2, 3, 6, and 12. Default value: 1. | |
key_pair | String | Yes | security-key | The name of the key pair that is used to log on to master nodes. You must set this parameter or the | |
login_password | String | Yes | Hello@1234 | The password that is used to log on to master nodes over SSH. You must set this parameter or the | |
Component configurations | addons | Array of addon | No | The components that you want to install in the cluster. When you create a cluster, you can set the Network plug-in: required. Supported network plug-ins are Flannel and Terway. Select one of the plug-ins for the cluster.
Volume plug-in: optional. Supported volume plug-ins is Specify the Simple Log Service component: optional. We recommend that you enable Simple Log Service. If Simple Log Service is disabled, you cannot use the cluster auditing feature.
Ingress controller: optional. By default, the
Event center: optional. By default, the event center feature is enabled. The event center feature allows you to log Kubernetes events, query events, and generate alerts. You can use the Logstores that are associated with Kubernetes event centers for free within 90 days. For more information, see Create and use an event center. To enable the Kubernetes event center, specify the component in the following format: [{"name":"ack-node-problem-detector","config":"{\"sls_project_name\":\"your_sls_project_name\"}"}]. | |
cloud_monitor_flags | Boolean | No | true | Specifies whether to install the CloudMonitor agent. Valid values:
Default value: | |
Node pool configurations | nodepools | Array of nodepool | No | The parameters of node pools. |
Response syntax
HTTP/1.1 200
Content-Type:application/json
{
"cluster_id" : "String",
"request_id" : "String",
"task_id" : "String"
}
Response parameters
Table 2. Response body parameters
Parameter | Type | Example | Description |
cluster_id | String | cb95aa626a47740afbf6aa099b650**** | The cluster ID. |
request_id | String | 687C5BAA-D103-4993-884B-C35E4314A1E1 | The request ID. |
task_id | String | T-5a54309c80282e39ea00002f | The task ID. |
Examples
Sample requests
POST /clusters
{
"name":"ACK dedicated cluster",
"region_id":"cn-zhangjiakou",
"cluster_type":"Kubernetes",
"kubernetes_version":"1.28.9-aliyun.1",
"runtime":{
"name":"containerd",
"version":"1.6.20"
},
"resource_group_id":"rg-acfm3mkrure****",
"vpcid":"vpc-8vbh3b9a2f38urhls****",
"pod_vswitch_ids":[
"vsw-8vbo5fwyqiw0bbtlq0mc9"
],
"container_cidr":"172.20.0.0/16",
"service_cidr":"172.21.0.0/20",
"node_cidr_mask":"26",
"security_group_id":"sg-8vb7grbyvlb10j0i****",
"is_enterprise_security_group":true,
"snat_entry":true,
"endpoint_public_access":true,
"load_balancer_spec":"slb.s2.small",
"ssh_flags":true, // Specifies whether master nodes in the cluster can be accessed by using SSH.
"timezone":"Asia/Shanghai",
"proxy_mode":"ipvs",
"enable_rrsa":true,
"tags":[
{
"key":"tag-k",
"value":"tag-v"
}
],
"cluster_domain":"cluster.local",
"custom_san":"cs.aliyuncs.com",
"service_account_issuer":"kubernetes.default.svc",
"api_audiences":"kubernetes.default.svc",
"disable_rollback":true,
"timeout_mins":60,
"deletion_protection":true,
"node_name_mode":"customized,aliyun,5,test",
"keep_instance_name": true
"rds_instances": ["rm-xx","rm-xx"],
"master_count":3, // The number of master nodes. Valid values: 3 and 5.
"image_type":"CentOS",
"image_id":"m-bp16z7xko3vvv8gt****",
"os_type":"Linux",
"master_vswitch_ids":[ // The IDs of the vSwitches that you want to use for master nodes.
"vsw-8vbmoffowsztjaawjtyzo",
"vsw-8vbmoffowsztjaawjtyzo",
"vsw-8vbmoffowsztjaawjtyzo"
],
"master_instance_types":[ // The ECS instance types of master nodes.
"ecs.c6.large",
"ecs.c6.large",
"ecs.c6.large"
],
"master_system_disk_category":"cloud_essd", // The type of system disk that you want to use for master nodes.
"master_system_disk_size":120, // The size of the system disk that you want to use for master nodes. Valid values: 40 to 500.
"master_system_disk_performance_level":"PL1",
"master_system_disk_snapshot_policy_id":"sp-2zej1nogjvovnz4z****",
"master_instance_charge_type":"PrePaid", // The billing method of master nodes.
"master_period_unit":"Month", // The billing cycle of master nodes.
"master_period":1, // The subscription duration of master nodes.
"master_auto_renew":true, // Specifies whether to enable auto-renewal for master nodes.
"master_auto_renew_period":1, // The auto-renewal period for master nodes after the subscriptions of master nodes expire.
"key_pair": "sin-name",
"login_password":"Hello1234",
"addons":[
{
"name":"flannel"
},
{
"name":"arms-prometheus"
},
{
"name":"csi-plugin"
},
{
"name":"csi-provisioner"
},
{
"name":"logtail-ds",
"config":"{\"IngressDashboardEnabled\":\"true\"}"
},
{
"name":"ack-node-problem-detector",
"config":"{\"sls_project_name\":\"\"}"
},
{
"name":"nginx-ingress-controller",
"config":"{\"IngressSlbNetworkType\":\"internet\"}"
}
],
"cloud_monitor_flags":true,
"nodepools" : [ {
"auto_scaling" : {
"enable" : true,
"max_instances" : 10,
"min_instances" : 1,
"type" : "cpu"
},
"kubernetes_config" : {
"cms_enabled" : true,
"cpu_policy" : "none",
"labels" : [ {
"key" : "env",
"value" : "prod"
} ],
"runtime" : "docker",
"runtime_version" : "19.03.5",
"taints" : [ {
"key" : "key",
"value" : "value",
"effect" : "NoSchedule"
} ],
"user_data" : "dGhpcyBpcyBhIGV4YW1wbGU=",
"node_name_mode" : "aliyun.com00055test"
},
"nodepool_info" : {
"name" : "cluster-demo",
"resource_group_id" : "rg-acfmyvw3wjmb****",
"type" : "ess"
},
"scaling_group" : {
"auto_renew" : true,
"auto_renew_period" : 1,
"data_disks" : [ {
"category" : "cloud_ssd",
"size" : 40,
"encrypted" : "true",
"auto_snapshot_policy_id" : "sp-2zej1nogjvovnz4z****",
"performance_level" : "PL1"
} ],
"image_id" : "aliyun_2_1903_x64_20G_alibase_20200529.vhd",
"instance_charge_type" : "PrePaid",
"instance_types" : [ "ecs.d1ne.2xlarge" ],
"key_pair" : "np-key-name",
"login_password" : "Hello1234",
"period" : 1,
"period_unit" : "Month",
"platform" : "AliyunLinux",
"rds_instances" : [ "rds-****" ],
"spot_strategy" : "NoSpot",
"spot_price_limit" : [ {
"instance_type" : "ecs.c6.large",
"price_limit" : "0.39"
} ],
"scaling_policy" : "release",
"security_group_id" : "sg-wz9a8g2mt6x5llu0****",
"security_group_ids" : [ "sg-wz9a8g2mt6x5llu0****" ],
"system_disk_category" : "cloud_efficiency",
"system_disk_size" : 120,
"system_disk_performance_level" : "PL1",
"tags" : [ {
"key" : "node-k-1",
"value" : "node-v-1"
} ],
"vswitch_ids" : [ "vsw-wz9mfnhmssud6eicu****" ],
"multi_az_policy" : "COST_OPTIMIZED",
"on_demand_base_capacity" : 0,
"on_demand_percentage_above_base_capacity" : 20,
"spot_instance_pools" : 5,
"spot_instance_remedy" : false,
"compensate_with_on_demand" : true,
"internet_charge_type" : "PayByTraffic",
"internet_max_bandwidth_out" : 5,
"image_type" : "AliyunLinux",
"deploymentset_id" : "ds-bp1d19mmbsv3jf6xxxxx",
"desired_size" : 0
},
"tee_config" : {
"tee_enable" : true
},
"management" : {
"enable" : false,
"auto_repair" : false,
"upgrade_config" : {
"auto_upgrade" : false,
"surge" : 0,
"surge_percentage" : 0,
"max_unavailable" : 1
}
},
"count" : 1,
"interconnect_mode" : "basic",
"interconnect_config" : {
"cen_id" : "cen-ey9k9nfhz0f*******",
"ccn_id" : "ccn-qm5i0i0q9yi*******",
"ccn_region_id" : "cn-shanghai",
"bandwidth" : 10,
"improved_period" : "1"
},
"max_nodes" : 10
} ]
}
Sample success responses
XML
format
<cluster_id>cb95aa626a47740afbf6aa099b650****</cluster_id>
<task_id>T-5a54309c80282e39ea00002f</task_id>
<request_id>687C5BAA-D103-4993-884B-C35E4314A1E1</request_id>
JSON
format
{
"cluster_id": "cb95aa626a47740afbf6aa099b650****",
"task_id": "T-5a54309c80282e39ea00002f",
"request_id": "687C5BAA-D103-4993-884B-C35E4314A1E1"
}
Error codes
For a list of error codes, see Service error codes.