You can call this operation to create a cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation only uses common request headers. For more information, see the Common request parameters topic.

Request syntax

POST /pop/v5/resource/cluster HTTPS|HTTP

Request parameters

Parameter Type Required Example Description
ClusterName String Yes product_test2

The name of the cluster that you want to create.

ClusterType Integer Yes 2

The type of the cluster that you want to create. Valid values: 1: Swarm cluster. 2: ECS cluster. 3: Kubernetes cluster.

NetworkMode Integer Yes 2

The network type of the cluster that you want to create. Valid values: 1: classic network. 2: VPC.

LogicalRegionId String No cn-beijing:test
VpcId String No vpc-2zef6ob8mrlzv8x3****

The ID of the virtual private cloud (VPC) for the cluster that you want to create. This parameter is required if ClusterType is set to VPC.

OversoldFactor Integer No 2

Specifies the CPU overselling factor for the cluster that you want to create with Docker installed. Valid values: 2 (1:2), 4 (1:4), and 8 (1:8).

IaasProvider String No aliyun

Response parameters

Parameter Type Example Description
Code Integer 200

The returned code.

Message String success

The returned message.

RequestId String b197-40ab-9155-****

The ID of the request.

Cluster Struct

The data pattern of the cluster that was created.

ClusterId String 8705ad13-5d86-47fc-****-257b59ed****

The ID of the cluster that was created.

RegionId String cn-beijing

The ID of the logical zone where the cluster is located.

ClusterName String product_test2

The name of the cluster that was created.

ClusterType Integer 2

The type of the cluster that was created. Valid values: 1: Swarm cluster. 2: ECS cluster. 3: Kubernetes cluster.

OversoldFactor Integer 1

The CPU overselling factor of the created cluster with Docker installed. Valid values: 2 (1: 2), 4 (1: 4), and 8 (1: 8).

NetworkMode Integer 2

The network type of the cluster that was created. Valid values: 1: classic network. 2: VPC.

VpcId String vpc-2zef6ob8mrlzv8x3q****

The ID of the VPC where the created cluster is located.

IaasProvider String ALIYUN

The provider of Infrastructure as a Service (IaaS) resources used in the created cluster.

Examples

Sample requests

POST /pop/v5/resource/cluster HTTP/1.1
Common request headers
{
  "ClusterName": "jianwei_product_test2"
  "ClusterType": 2
  "NetworkMode": 2
}

Sample success responses

JSON format

{
    "Message": "success",
    "Cluster": {
        "OversoldFactor": 1,
        "ClusterName": "product_test2",
        "ClusterId": "8705ad13-5d86-47fc-b68f-257b59ed****",
        "NetworkMode": 2,
        "RegionId": "cn-beijing",
        "ClusterType": 2,
        "IaasProvider": "ALIYUN",
        "VpcId": "vpc-2zef6ob8mrlzv8x3q****"
    },
    "Code": 200
}

XML format

<Message>success</Message>
<Cluster>
    <OversoldFactor>1</OversoldFactor>
    <ClusterName>product_test2</ClusterName>
    <ClusterId>8705ad13-5d86-47fc-b68f-257b59ed****</ClusterId>
    <NetworkMode>2</NetworkMode>
    <RegionId>cn-beijing</RegionId>
    <ClusterType>2</ClusterType>
    <IaasProvider>ALIYUN</IaasProvider>
    <VpcId>vpc-2zef6ob8mrlzv8x3q****</VpcId>
</Cluster>
<Code>200</Code>

Error codes

For a list of error codes, visit the API Error Center.