• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference
  4. Cluster and Host Management (Proprietary APIs)
  5. Creating a Container Cluster

Creating a Container Cluster

Function

This API is used to create a container cluster.

URI

POST /api/v1/clusters

Request

Request parameter:

Table 1 describes the request parameters.

Table 1 Request parameters

Parameter

Mandatory

Type

Description

kind

Yes

String

Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. The value is in lowercase.

apiVersion

Yes

String

APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.

metadata

Yes

Table 2

-

spec

Yes

Table 3

-

Table 2 Data structure of the metadata field

Parameter

Mandatory

Type

Description

name

Yes

String

Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated.

The name must be 0 to 24 characters in length. A container cluster name must start with a lowercase letter and contain only lowercase letters, digits, and hyphens.

Table 3 Data structure of the spec field

Parameter

Mandatory

Type

Description

description

No

String

Brief description of the container cluster.

The description must be 0 to 200 characters in length.

vpc

Yes

String

VPC ID of the container cluster.

NOTE:

Obtain the VPC ID before creating a container cluster.

subnet

Yes

String

Subnet ID of the container cluster.

NOTE:

Obtain the subnet ID before creating a container cluster.

region

Yes

String

Region to which the container cluster belongs.

security_group_id

No

String

Security group ID of the container cluster.

NOTE:

If this parameter is left blank, CCE will dynamically create a security group when creating the container cluster.

clustertype

No

String

Container cluster type.

Options: HA and Single.

Default: Single.

NOTE:
  • HA: An HA container cluster has three master nodes. This cluster is available only when two or more masters are available. This ensures the high reliability of the cluster.
  • Single: A single container cluster has only one master node.

Example request:

{
    "kind": "cluster",
    "apiVersion": "v1",
    "metadata": {
        "name": "test"
    },
    "spec": {
        "description": "",
        "vpc": "794d4557-6fd3-4a5c-bfb1-b8b338ab6d34",
        "subnet": "f1e7f3b0-2feb-4054-9005-6e7b9ce7ccb7",
        "region": "eu-de",
        "security_group_id": "159585ee-e65d-4362-a6cd-66521c98a32d",
        "clustertype": "Single"
    }
}

Response

N/A

Status Code

Table 4 describes the status code of this API.

Table 4 Status code

Status Code

Description

201

The container cluster is created successfully.

For the description about status codes, see section Status Codes.