You can call the CreateCluster operation to create an 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
Parameter | Type | Required | Example | Description |
cluster_type | String | Yes | ManagedKubernetes | The type of the cluster. If you set this parameter to ManagedKubernetes and the profile parameter to |
profile | String | Yes | Serverless | The profile of the cluster. If you set this parameter to |
cluster_spec | String | No | ack.pro.small | The specification of the ACK Serverless cluster. Valid values:
Default value: For more information, see ACK Serverless Pro cluster overview. |
name | String | Yes | cluster-demo | The name of the cluster. The name must be 1 to 63 characters in length, and can contain digits, letters, and hyphens (-). It cannot start with a hyphen (-). |
kubernetes_version | String | No | 1.16.9-aliyun.1 | The Kubernetes version of the cluster. Container Service for Kubernetes (ACK) supports all open source Kubernetes versions. We recommend that you specify the latest Kubernetes version. If you do not set 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, use the API. For more information about Kubernetes versions that are supported by ACK, see Overview of Kubernetes versions supported by ACK. |
private_zone | Boolean | No | false | Specifies whether to enable Alibaba Cloud DNS PrivateZone for service discovery. Valid values:
For more information, see Use Alibaba Cloud DNS PrivateZone to implement service discovery in ACK Serverless clusters. |
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 enable Internet access for the API server. Valid values:
Default value: |
service_discovery_types | Array of String | No | PrivateZone | The type of service discovery that is implemented in the
By default, this parameter is not specified. |
zoneid | String | No | cn-beiji**** | The ID of the zone in which the cluster is deployed. Important If you do not set the |
logging_type | String | No | SLS | Specifies whether to enable Log Service for the cluster. Set the value to |
tags | Array of tag | No | [{"key": "env", "value": "prod"}] | The labels that you want to add to the cluster. A label 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 the API. Valid values:
Default value: |
service_cidr | String | No | 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. |
timezone | String | No | Asia/Shanghai | The time zone of the cluster. For more information, see 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. Parameter description:
Network plug-in: required. Supported network plug-ins are Flannel and Terway. Select one of the plug-ins for the cluster.
Volume plug-in: required. Supported volume plug-ins are
Log Service component: optional. Note If Log Service is disabled, you cannot use the cluster auditing feature.
Ingress controller: optional. By default, the nginx-ingress-controller component is installed in dedicated Kubernetes 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 alert rules. 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 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 the system creates 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 a cluster. Note If you specify the |
vswitch_ids | Array of String | No | ["vsw-2ze97jwri7cei0mpw****"] | The ID of the vSwitch. 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 set 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
Parameter | Type | Example | Description |
cluster_id | String | cb95aa626a47740afbf6aa099b650**** | The ID of the cluster. |
request_id | String | 687C5BAA-D103-4993-884B-C35E4314A1E1 | The ID of the request. |
task_id | String | T-5a54309c80282e39ea00002f | The ID of the task. |
Example 1: Create an ACK Serverless cluster in an automatically created VPC
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, visit the API Error Center.