You can call the CreateCluster operation to create a Container Service for Kubernetes (ACK) Serverless cluster.
Request syntax
POST /clusters HTTP/1.1
Content-Type:application/json
{
"cluster_type" : "String",
"profile": "String",
"cluster_spec" : "String",
"name" : "String",
"kubernetes_version" : "String",
"private_zone" : Boolean,
"region_id" : "String",
"endpoint_public_access" : Boolean,
"service_discovery_types" : [ "String" ],
"zoneid" : "String",
"logging_type" : "String",
"tags" : [ {
"key" : "String",
"value" : "String"
} ],
"deletion_protection" : Boolean,
"service_cidr" : "String",
"timezone" : "String",
"addons" : [ {
"name" : "String",
"config" : "String",
"disabled" : Boolean
} ],
"snat_entry" : Boolean,
"vpcid" : "String",
"vswitch_ids" : [ "String" ],
"security_group_id" : "String"
}
Request parameters
Table 1. Request parameters
Parameter | Type | Required | Example | Description |
cluster_type | String | Yes | ManagedKubernetes | The type of the cluster. Set the value to ManagedKubernetes. In this case, if you set the profile parameter to |
profile | String | Yes | Serverless | The identifier of the cluster. If you set this parameter to |
cluster_spec | String | No | ack.pro.small | The type of the ACK Serverless cluster. Valid values:
Default value: For more information, see ACK Serverless Pro cluster overview. |
name | String | Yes | cluster-demo | The cluster name. The name must be 1 to 63 characters in length and can contain digits, letters, and hyphens (-). The name cannot start with a hyphen (-). |
kubernetes_version | String | No | 1.30.1-aliyun.1 | The Kubernetes version of the cluster. ACK supports all open source Kubernetes versions. 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 two types of clusters that run the latest Kubernetes version in the ACK console. If you want to create clusters that run earlier Kubernetes versions, call API operations. For more information about Kubernetes versions that are supported by ACK, see Support for Kubernetes versions. |
private_zone | Boolean | No | false | Specifies whether to enable service discovery based on Alibaba Cloud DNS PrivateZone. Valid values:
For more information, see Enable service discovery based on Alibaba Cloud DNS PrivateZone. |
region_id | String | Yes | cn-beijing | The ID of the region in which you want to deploy the cluster. |
endpoint_public_access | Boolean | No | true | Specifies whether to allow the cluster to access the API server over the Internet. Valid values:
Default value: |
service_discovery_types | Array of String | No | PrivateZone | The type of service discovery that is implemented in the ACK Serverless cluster. Valid values:
By default, this parameter is not specified. |
zoneid | String | No | cn-beiji**** | The ID of the zone in which the cluster resides. Important If you do not specify the |
logging_type | String | No | SLS | Specifies whether to enable Simple Log Service for the cluster. Set the value to |
tags | Array of tag | No | [{"key": "env", "value": "prod"}] | The tags that you want to add to the cluster. A tag consists of the following elements:
|
deletion_protection | Boolean | No | true | Specifies whether to enable deletion protection for the cluster. After deletion protection is enabled, the cluster cannot be deleted in the ACK console or by calling API operations. Valid values:
Default value: |
service_cidr | String | No | 172.21.0.0/20 | The Service CIDR block. Valid values: 10.0.0.0/16-24, 172.16-31.0.0/16-24, and 192.168.0.0/16-24. The Service CIDR block cannot overlap with the VPC CIDR block or the CIDR blocks of existing clusters in the VPC. The VPC CIDR block is 10.1.0.0/21. You cannot modify the Service CIDR block after the cluster is created. Default value: 172.19.0.0/20. |
timezone | String | No | Asia/Shanghai | The time zone of the cluster. For more information, see Supported time zones. |
addons | Array of addon | No | [{"name":"logtail-ds","config":"{\"sls_project_name\":\"your_sls_project_name\"}"}] | The components that you want to install in the cluster. You can specify the following parameters:
Network plug-in: required. You can select Flannel or Terway when you create the cluster.
Volume plug-in: optional. Set the value to Specify the Log Service component: optional. Note If Simple Log Service is not enabled for the cluster, you cannot use the cluster auditing feature.
Ingress controller: optional. By default, the nginx-ingress-controller component is installed in ACK dedicated clusters.
Event center: optional. By default, the event center feature is enabled. You can use Kubernetes event centers to store and query events and configure alerts. You can use the Logstores that are associated with Kubernetes event centers free of charge within 90 days. For more information, see Create and use an event center. To enable the event center feature, specify the ack-node-problem-detector component in the following format: [{"name":"ack-node-problem-detector","config":"{\"sls_project_name\":\" your_sls_project_name\"}"}]. |
snat_entry | Boolean | No | true | Specifies whether to create a NAT gateway and configure Source Network Address Translation (SNAT) rules when you create the ACK Serverless cluster. Valid values:
Default value: |
vpcid | String | No | vpc-2zeik9h3ahvv2zz95**** | The VPC in which you want to deploy the cluster. You must specify a VPC when you create the cluster. Note If you specify the |
vswitch_ids | Array of String | No | ["vsw-2ze97jwri7cei0mpw****"] | The IDs of vSwitches. You can specify one to three vSwitches. |
security_group_id | String | No | sg-bp1bdue0qc1g7k**** | The ID of the existing security group that you want to use for the cluster. You must specify this parameter or the |
resource_group_id | String | No | rg-acfm3mkrure**** | The ID of the resource group to which the cluster belongs. You can use this parameter to isolate different clusters. |
Response syntax
HTTP/1.1 200
Content-Type:application/json
{
"cluster_id" : "String",
"request_id" : "String",
"task_id" : "String"
}
Response parameters
Table 2. Response 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. |
Example 1: Create an ACK Serverless cluster in a VPC that is automatically created
Sample requests
POST /clusters HTTP/1.1
<Common request headers>
{
"cluster_type":"ManagedKubernetes",
"profile":"Serverless",
"cluster_spec":"ack.standard",
"name":"test-ask",
"region_id":"cn-hangzhou",
"endpoint_public_access":false,
"logging_type" : "SLS",
"private_zone":false,
"snat_entry":true,
"tags":[
{
"key":"k-aa",
"value":"v-aa"
}
],
"deletion_protection":false,
"addons":[
{
"name":"logtail-ds"
}
],
"zoneid":"cn-hangzhou-i"
}
Sample responses
{
"cluster_id": "cb95aa626a47740afbf6aa099b650****",
"RequestId": "687C5BAA-D103-4993-884B-C35E4314A1E1",
"task_id": "T-5a54309c80282e39ea00002f",
}
Example 2: Create an ACK Serverless cluster in an existing VPC
Sample requests
POST /clusters HTTP/1.1
<Common request headers>
{
"cluster_type":"ManagedKubernetes",
"profile":"Serverless",
"cluster_spec":"ack.pro.small",
"name":"ask-cluster",
"region_id":"cn-shenzhen",
"endpoint_public_access":true,
"logging_type": "SLS",
"private_zone":true,
"tags":[
{
"key":"tier",
"value":"frontend"
}
],
"deletion_protection":true,
"addons":[
{
"name":"logtail-ds"
}
],
"vpcid":"vpc-wz984yvbd6lck22z3****",
"vswitch_ids":[
"vsw-wz9uwxhawmtzg7u9h****"
],
"security_group_id":"sg-wz9b86l4s7nthi1k****"
}
Sample responses
{
"cluster_id": "cb95aa626a47740afbf6aa099b650****",
"RequestId": "687C5BAA-D103-4993-884B-C35E4314A1E1",
"task_id": "T-5a54309c80282e39ea00002f",
}
Error codes
For a list of error codes, see Service error codes.