You can call CreateCluster to describe how to create a serverless Kubernetes cluster.

Request information

Request line

POST /clusters HTTP/1.1

Custom request headers

None. For more information, see Public request headers.

Request body

{
"cluster_type": "Ask", 
"name": "cluster name",
"region_id": "region",
"zoneid": "zone",
"nat_gateway": "true", //whether to create a NAT gateway
"private_zone": "true", //whether to enable privateZone for service discovery
"vpc_id": "VPC ID", //If this parameter is not specified, a VPC network is automatically created.
"tags": "an array of tags",
"vswitchid": "VSwitch ID",
}
Table 1. Request body parameters
Name Type Required Description
cluster_type string Yes The type of the cluster.
name string Yes The name of the cluster. The name can contain uppercase and lowercase letters, digits, and hyphens (-).
private_zone bool Yes Whether to enable PrivateZone for service discovery. Valid values: true and false. For more information, see Use the service discovery feature based on Alibaba Cloud DNS PrivateZone in serverless Kubernetes clusters.
region_id string Yes The ID of the region where the cluster is deployed.
zoneid string Yes The zone of the region.
vswitch_ids string No The IDs of the VSwitches. Optional. If this parameter is not specified, the system automatically creates a VSwitch with CIDR block 192.168.0.0/16.
tags list No The tags of the cluster.
  • key: The name of the tag.
  • value: The value of the tag.
nat_gateway bool No Whether to create a NAT Gateway. Valid values: true and false. Default is false.
vpc_id string No The ID of the VPC network where the cluster is deployed. Optional. If this parameter is not specified, the system automatically creates a VPC network with CIDR block 192.168.0.0/16.
Note The vpc_id and vswitch_id parameters must be used together.

Response information

Response line

HTTP/1.1 202 Accepted

Custom response headers

None. For more information, see Public response headers.

Table 2. Response body
Name Type Description
cluster_id string The ID of the cluster.
request_id string The ID of the request.
task_id string The ID of the task. The task ID is automatically assigned by the system and used to query task status.

Examples

Sample request

POST /clusters HTTP/1.1
<Common request headers>
{
"cluster_type":"ASK",
"name":"my-test-Kubernetes-cluster",
"region_id":"cn-beijing",
"tags":[],
"vpcid":"vpc-2zegvl5etah5requ0****",
"vswitch_ids":["vsw-2ze48rkq464rsdts1****"]
}

Sample response

HTTP/1.1 202 Accepted
<Common response headers>
{
    "cluster_id": "cb95aa626a47740afbf6aa099b650****",
    "request_id": "687C5BAA-D103-4993-884B-C35E4314A1E1",
    "task_id": "T-5a54309c80282e39ea00002f"
}