• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference 2.0
  4. API
  5. Cluster Management
  6. Creating a Node

Creating a Node

Function

This API is used to create a node.

URI

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes

Table 1 describes the parameters of the API.

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Project ID.

cluster_id

Yes

Cluster ID.

Request

Request parameters:

Table 2 describes the request parameters.

Table 2 Parameter description

Parameter

Mandatory

Type

Description

kind

Yes

String

API type. The value is fixed to Node.

apiVersion

Yes

String

API version. The value is fixed to v3.

metadata

Yes

Table 3

-

spec

Yes

Table 4

-

Table 3 Data structure of the metadata field

Parameter

Mandatory

Type

Description

name

No

String

Node name.

labels

No

String

Node label in the format of key/value.

annotations

No

String

Node annotation in the format of key/value.

Table 4 Data structure of the spec field

Parameter

Mandatory

Type

Description

flavor

Yes

String

Node specifications. For details, see the flavorRef parameter in Help Center > Elastic Cloud Server > API Reference > Extension ECS APIs > Lifecycle Management > Creating ECSs.

az

Yes

String

Name of the AZ where the node resides. For details, see the availability_zone parameter in Help Center > Elastic Cloud Server > API Reference > Extension ECS APIs > Lifecycle Management > Creating ECSs.

login

Yes

Table 5

Parameters for logging in to the node.

rootVolume

Yes

Table 6

System disk parameters of the node.

dataVolumes

Yes

Table 6

Data disk parameters of a node. At present, only one data disk can be configured

publicIP

No

Table 7

Elastic IP address parameters of a node.

count

Yes

Integer

Number of nodes.

Table 5 Data structure of the login field

Parameter

Mandatory

Type

Description

sshKey

Yes

String

Name of the key pair used for login.

Table 6 Data structure of the volume field

Parameter

Mandatory

Type

Description

size

Yes

String

Volume size in the unit of GB.

volumetype

Yes

String

Volume type. The possible values include data_volumes, root_volume, and eip. For details, see the data_volumes, root_volume, or eip parameter in Help Center > Elastic Cloud Server > API Reference > Extension ECS APIs > Lifecycle Management > Creating ECSs.

Table 7 Data structure of the publicIP field

Parameter

Mandatory

Type

Description

ids

No

String

List of IDs of the existing elastic IP addresses.

NOTICE:

If ids is set, you do not need to set count and eip.

count

No

Integer

Number of elastic IP addresses to be dynamically created.

NOTICE:

The count and eip parameters must be set simultaneously.

eip

No

Table 8

Elastic IP address.

NOTICE:

The count and eip parameters must be set simultaneously.

Table 8 Data structure of the eip field

Parameter

Mandatory

Type

Description

type

Yes

String

Elastic IP address type. For details, see the iptype parameter in Help Center > Elastic Cloud Server > API Reference > Extension ECS APIs > Lifecycle Management > Creating ECSs.

bandwidth

Yes

Table 9

Bandwidth parameters of the elastic IP address.

Table 9 Data structure of the bandwidth field

Parameter

Mandatory

Type

Description

chargemode

No

String

  • If this field is not carried, the node is charged by bandwidth.
  • If this field is carried but is left blank, the node is charged by bandwidth.
  • If this field is set to traffic, the node is charged by traffic.

If this parameter is set to another value, the ECS creation will fail.

size

Yes

Integer

Bandwidth size.

For details, see the size parameter in Help Center > Elastic Cloud Server > API Reference > Extension ECS APIs > Lifecycle Management > Creating ECSs.

sharetype

Yes

String

Bandwidth sharing type.

For details, see the sharetype parameter in Help Center > Elastic Cloud Server > API Reference > Extension ECS APIs > Lifecycle Management > Creating ECSs.

Example request:

{
    "kind": "Node",
    "apiVersion": "v3",
    "metadata": {
        "name": "mycluster-demo",
        "labels": {
            "foo": "bar"
        },
        "annotations": {
            "annotation1": "abc"
        }
    },
    "spec": {
        "flavor": "s1.large",
        "az": "eu-de",
        "login": {
            "sshKey": "KeyPair-demo"
        },
        "rootVolume": {
            "size": 40,
            "volumetype": "SATA"
        },
        "dataVolumes": [
            {
                "size": 100,
                "volumetype": "SATA"
            }
        ],
        "publicIP": {
            "count": 1,
            "eip": {
                "type": "5_bgp",
                "bandwidth": {
                    "chargemode": "traffic",
                    "size": 10,
                    "sharetype": "PER"
                }
            }
        },
        "count": 1
    }
}

Response

Response parameters:

Table 10 describes the response parameters.

Table 10 Response parameters

Parameter

Type

Description

kind

String

API type. The value is fixed to Host.

apiVersion

String

API version. The value is fixed to v3.

metadata

Table 11

Node metadata.

spec

Table 12

Node parameters.

status

Table 13

Node status.

Table 11 Data structure of the metadata field

Parameter

Type

Description

name

String

Node name.

uid

String

Node ID.

labels

String

Node label in the format of key/value.

annotations

String

Node annotation in the format of key/value.

Table 12 Data structure of the spec field

Parameter

Type

Description

flavor

String

Node specifications. For details, see the flavorRef parameter in Help Center > Elastic Cloud Server > API Reference > Extension ECS APIs > Lifecycle Management > Creating ECSs.

az

String

Name of the AZ where the node resides. For details, see the availability_zone parameter in Help Center > Elastic Cloud Server > API Reference > Extension ECS APIs > Lifecycle Management > Creating ECSs.

os

String

OS of the node.

login

Table 5

Parameters for logging in to the node.

rootVolume

Table 6

System disk parameters of the node.

dataVolumes

Table 6

Data disk parameters of a node. At present, only one data disk can be configured

publicIP

Table 7

Elastic IP address parameters of a node.

count

Integer

Number of nodes.

billingMode

Integer

Billing mode of a node. Currently, only pay-per-use is supported.

Value:

0: pay-per-use

extendParam

String

Extended parameter.

Table 13 Data structure of the status field

Parameter

Type

Description

jobID

String

ID of the job for creating a node.

Example response:

{
    "kind": "Node",
    "apiVersion": "v3",
    "metadata": {
        "name": "node-demo",
        "uid": "c33b6898-38c9-11e9-b246-0255ac101413,",
        "labels": {
            "foo": "bar"
        },
        "annotations": {
            "annotation1": "abc"
        }
    },
    "spec": {
        "flavor": "s1.large",
        "az": "eu-de",
        "os": "EulerOS 2.2",
        "login": {
            "sshKey": "KeyPair-demo",
        },
        "rootVolume": {
            "volumetype": "SATA",
            "size": 40
        },
        "dataVolumes": [
            {
                "volumetype": "SATA",
                "size": 100
            }
        ],
        "publicIP": {
            "count": 1,
            "eip": {
                "bandwidth": {
                    "size": 10,
                    "sharetype": "PER",
                    "chargemode": "traffic"
                }
            }
        },
        "count": 1,
        "billingMode": 0,
        "extendParam": {
            "chargingMode": 0,
            "ecs:performancetype": "normal",
            "orderID": "",
            "productID": "",
            "publicKey": ""
        }
    },
    "status": {
        "jobID": "f0c8be51-3025-11e9-9e7b-0255ac101407"
    }
}

Status Code

Table 14 describes the status code of the API.

Table 14 Status code

Status Code

Description

201

The job for creating a node in a specified cluster is successfully delivered.

For details about error status codes, see Status Codes.