Updated on 2024-11-06 GMT+08:00

Creating a Node

Function

This API is used to create a node in a specified cluster.

  • If there is no cluster, create one.

  • The URL for cluster management is in the format of https://Endpoint/uri. In the URL, uri indicates the resource path, that is, the path for API access.

Constraints

Only KVM nodes can be created. Non-KVM nodes cannot be used after being created.

Calling Method

For details, see Calling APIs.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Details:

Project ID. For details about how to obtain the value, see How to Obtain Parameters in the API URI.

Constraints:

None

Options:

Project IDs of the account

Default value:

N/A

cluster_id

Yes

String

Details:

Cluster ID. For details about how to obtain the value, see How to Obtain Parameters in the API URI.

Constraints:

None

Options:

Cluster IDs

Default value:

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

nodepoolScaleUp

No

String

Whether the request is delivered by the node pool. If the value is not NodepoolScaleUp, the number of pods in the corresponding node pool is automatically updated.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Details:

Request body type or format

Constraints:

The GET method is not verified.

Options:

  • application/json

  • application/json;charset=utf-8

  • application/x-pem-file

Default value:

N/A

X-Auth-Token

Yes

String

Details:

Requests for calling an API can be authenticated using either a token or AK/SK. If token-based authentication is used, this parameter is mandatory and must be set to a user token. For details, see Obtaining a User Token.

Constraints:

None

Options:

N/A

Default value:

N/A

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

kind

Yes

String

API type. The value is fixed at Node and cannot be changed.

apiVersion

Yes

String

API version. The value is fixed at v3 and cannot be changed.

metadata

No

NodeMetadata object

Node metadata, which is a collection of attributes.

spec

Yes

NodeSpec object

Detailed description of the node. CCE creates or updates objects by defining or updating spec.

Table 5 NodeMetadata

Parameter

Mandatory

Type

Description

name

No

String

Node name.

NOTE:

Enter 1 to 56 characters starting with a lowercase letter and not ending with a hyphen (-). Only lowercase letters, digits, hyphens (-), and periods (.) are allowed.

If name is not configured or is left blank, the node name is generated based on the default rule, which is Cluster name-Random characters. Only the first 36 characters are kept for a long cluster name.

If the number of nodes (count) is greater than 1, some random characters are added to the end of the entered node name according to the default rule, which is User-defined name-Random characters. If the length of the entered node name exceeds 50 characters, the system uses the first 50 characters and adds a random character string to the end of the name.

uid

No

String

Node ID, which is unique and automatically generated after the resource is created. A user-defined ID will not take effect.

labels

No

Map<String,String>

CCE node label (not the native Kubernetes label).

Labels are used to select objects that meet certain criteria. A label is a key-value pair.

Example:

"labels": {
  "key" : "value"
}

annotations

No

Map<String,String>

CCE node annotations, in key-value pairs (not the native Kubernetes annotations).

Example:

"annotations": {
  "key1" : "value1",
  "key2" : "value2"
}
NOTE:
  • annotations are not used to identify or select objects. The metadata in annotations may be small or large, structured or unstructured, and may include characters that are not allowed in labels.

  • This parameter is used only for query and cannot be input through a request. Entered data of this parameter is invalid.

creationTimestamp

No

String

Time when the object was created. The value is automatically generated after the object is created. A user-defined value will not take effect.

updateTimestamp

No

String

Time when the object was updated. The value is automatically generated after the object is created. A user-defined value will not take effect.

ownerReference

No

ownerReference object

Owner object

Table 6 ownerReference

Parameter

Mandatory

Type

Description

nodepoolName

No

String

Node pool name

nodepoolID

No

String

Node pool UID

Table 7 NodeSpec

Parameter

Mandatory

Type

Description

flavor

Yes

String

Details:

Node flavors. For details about the node flavors supported by CCE clusters, see Node Specifications.

Constraints:

None

Options:

N/A

Default value:

N/A

az

Yes

String

Details:

AZ where the node to be created is located. You need to specify the AZ name. Random AZs will not be allocated to a node created using APIs.

For details about AZs supported by CCE, see Regions and Endpoints.

Constraints:

When you are creating a node pool and configuring a scaling group, this parameter cannot be set to random.

Options:

N/A

Default value:

N/A

os

No

String

Details:

Node OS. For details about the supported OSs, see Node OSs.

Constraints:

  • If the selected OS is not supported by the current cluster version, it will be automatically replaced with a supported OS of the same series.

  • If alpha.cce/NodeImageID in extendParam is specified during node creation, you do not need to configure this parameter.

  • If this parameter is not specified, CCE automatically selects a supported OS version based on the cluster version.

  • This parameter is mandatory when creating a node pool.

  • If you are using shared disk space when creating a node, this parameter is mandatory. Specifically, the disk initialization configuration management parameter storage is used and the name field of virtualSpaces in StorageGroups is set to share.

Options:

N/A

Default value:

N/A

login

Yes

Login object

Details:

Node login mode. Either the key pair or password must be used for login.

Constraints:

This parameter cannot be modified when a node pool is being updated.

rootVolume

Yes

Volume object

Details:

Disk information of a node

Constraints:

None

dataVolumes

Yes

Array of Volume objects

Details:

Data disk parameters of a node. For DeC nodes, the parameter details are the same as those in rootVolume.

Constraints:

A VM can have up to 16 disks attached, while a BMS can only have up to 10 disks attached. The maximum number of disks that can be attached to either a VM or BMS is limited by their respective maximum disk limits. (You can add more data disks to each of your nodes through the CCE console or APIs.)

The data disk used by the container runtime and kubelet cannot be detached, or the node will become unavailable.

storage

No

Storage object

Details:

Disk initialization management parameter.

This parameter is complex to configure. For details, see Attaching Disks to a Node.

Constraints:

  • If a node has both local and EVS disks attached, make sure to not keep the default value for this parameter, or it may result in unexpected disk partitions.

  • If you want to change the value range of a data disk to 20 to 32768, do not use the default value.

  • If you want to use the shared disk space (with the runtime and Kubernetes partitions cancelled), do not retain the default value of this parameter. For details about the shared disk space, see Space Allocation of a Data Disk.

  • If you want to store system components in the system disk, do not use the default value.

publicIP

No

NodePublicIP object

Details:

EIP of a node

Constraints:

This parameter is not supported when you add a node during node pool creation.

nodeNicSpec

No

NodeNicSpec object

Details:

ENI of a node

Constraints:

None

count

No

Integer

Details:

Number of nodes to be created in batches

Constraints:

This parameter can be left blank when it is used for a node pool.

Options:

Positive integers that are greater than or equal to 1 and less than or equal to the maximum limit

Default value:

N/A

billingMode

No

Integer

Details:

Billing mode of a node

Constraints:

None

Options:

  • 0: pay-per-use

  • 1: yearly/monthly

  • 2: (Discarded) yearly/monthly billing with auto payment enabled

Default value:

N/A

taints

No

Array of Taint objects

Details:

Taints, which can be added to nodes for anti-affinity configuration. Each taint contains the following parameters:

  • Key: Enter 1 to 63 characters starting and ending with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. A DNS subdomain can be prefixed to a key.

  • Value: Enter 1 to 63 characters starting and ending with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

  • Effect: Available options are NoSchedule, PreferNoSchedule, and NoExecute.

    When creating a node, you can specify the initial value for this parameter and this field is not returned during query. In node pools, the initial value can be specified in the node template and this field is returned during query. In other scenarios, this field is not returned during query.

Example:

"taints": [{
  "key": "status",
  "value": "unavailable",
  "effect": "NoSchedule"
}, {
  "key": "looks",
  "value": "bad",
  "effect": "NoSchedule"
}]

Constraints:

A maximum of 20 taints can be configured.

k8sTags

No

Map<String,String>

Details:

Defined in key-value pairs.

  • Key: Enter 1 to 63 characters starting and ending with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. A DNS subdomain containing a maximum of 253 characters (such as example.com/my-key) can be prefixed to a key.

  • Value: The value can be left blank or contain 1 to 63 characters that start and end with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

    When creating a node, you can specify the initial value for this parameter and this field is not returned during query. In node pools, the initial value can be specified in the node template and this field is returned during query. In other scenarios, this field is not returned during query.

Example:

"k8sTags": {
  "key": "value"
}

Constraints:

A maximum of 20 key-value pairs are allowed.

ecsGroupId

No

String

Details:

ECS group ID. If this parameter is specified, nodes will be created in the specific ECS group.

Constraints:

This configuration does not take effect when a node pool is created. To ensure that all nodes in a node pool are in the same ECS group, configure nodeManagement in the node pool.

Options:

N/A

Default value:

N/A

dedicatedHostId

No

String

Details:

ID of the DeH to which nodes will be scheduled.

Constraints:

This parameter is not supported when you add a node during node pool creation.

userTags

No

Array of UserTag objects

Details:

Cloud server tag (resource tag). When creating a node, you can specify the initial value for this parameter and this field is not returned during query. In node pools, the initial value can be specified in the node template and this field is returned during query. In other scenarios, this field is not returned during query.

Constraints:

  • The key of a tag must be unique. The maximum number of custom tags supported by CCE varies depending on regions and cannot exceed 8.

  • A tag key can have a maximum of 36 characters. It can only contain letters, digits, Unicode characters, and special characters (-_).

runtime

No

Runtime object

Details:

Container runtime

  • Clusters earlier than v1.25: The default value is docker.

  • Clusters of v1.25 or later: The default value varies with the OSs.

  • For nodes running EulerOS 2.5 or EulerOS 2.8, the default container runtime is docker. For nodes running other OSs, the default container runtime is containerd.

Constraints:

None

initializedConditions

No

Array of strings

Details:

Custom initialization flag, which is left blank by default.

Before CCE nodes are initialized, they are tainted with node.cloudprovider.kubernetes.io/uninitialized to prevent pods from being scheduled to them. When creating a node, you can specify the initializedConditions parameter to control the taint removal time. By default, the timeout interval is not configured.

Example:

  1. Create a node and add parameter "initializedConditions": ["CCEInitial", "CustomedInitial"].

  2. After custom initialization is complete, CCE will call a Kubernetes API (for example, PATCH /v1/nodes/{node_ip}/status) to update the node conditions by adding two labels of types CCEInitial and CustomedInitial and setting the status to True, as shown in the following:

status:
  conditions:
  - type: CCEInitial
    status: 'True'
  - type: CustomedInitial
    status: 'True'
  1. CCE polls status.Conditions of nodes to check whether there are conditions of types CCEInitial and CustomedInitial. If such conditions exist and the status is True, the node initialization is complete and the initialization taint is removed.

  2. initializedConditions allows you to configure a timeout period during node creation. For example, "initializedConditions": ["CCEInitial:15m", "CustomedInitial:15m"] indicates that the timeout period is 15 minutes. After the timeout period is reached, the initialization conditions will be automatically ignored and the initialization taint will be removed when CCE polls the node.

Constraints:

  • The timeout interval in initializedConditions ranges from 1 to 99 seconds.

  • Each value has 1 to 20 characters, which must consist of letters and digits.

  • The maximum number of flags cannot exceed 2.

  • The unit of the timeout period is minute (m).

extendParam

No

NodeExtendParam object

Details:

Extended parameters for creating a node

Constraints:

None

hostnameConfig

No

HostnameConfig object

Details:

Kubernetes node name configuration parameter

Constraints:

The supported cluster version is v1.23.6-r0 to v1.25 or v1.25.2-r0 or later.

serverEnterpriseProjectID

No

String

Details:

Enterprise project ID of a server. CCE does not support features provided by EPS. This field is used only for synchronizing enterprise project IDs of servers.

Constraints:

To create a node or node pool, you can specify an existing enterprise project for it. If this field is left blank, it inherits the enterprise project attributes of the cluster that runs the node or node pool.

When updating a node pool, any configuration modifications you made will apply only to new nodes. You need to modify the enterprise projects of existing nodes on the EPS console.

Options:

N/A

Default value:

If no value is specified during update, this field will not be updated.

If this parameter is left blank, the cluster enterprise project is returned.

Table 8 Login

Parameter

Mandatory

Type

Description

sshKey

No

String

Details:

Name of the key pair used for login

Constraints:

None

Options:

N/A

Default value:

N/A

userPassword

No

UserPassword object

Details:

Password used for node login

Constraints:

None

Table 9 UserPassword

Parameter

Mandatory

Type

Description

username

No

String

Details:

Login account. The default value is root.

Constraints:

None

Options:

N/A

Default value:

root

password

Yes

String

Details:

Login password. If a username and password are used when a node is created, this field is shielded in the response body.

Constraints:

The password field must be salted during node creation. For details, see Adding a Salt in the password Field When Creating a Node.

Options:

A password must:

  • Contain 8 to 26 characters.

  • Contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters !@$%^-_=+[{}]:,./?

  • Not contain the username or the username spelled backwards.

Default value:

N/A

Table 10 Volume

Parameter

Mandatory

Type

Description

size

Yes

Integer

Details:

Disk size, in GiB

Constraints:

None

Options:

  • System disks: 40 to 1024

  • The first data disk: 20 to 32768 (When storage is not specified, this value range becomes 100 to 32768.)

  • Other data disks: 10 to 32768 (When storage is not specified, this value range becomes 100 to 32768.)

Default value:

N/A

volumetype

Yes

String

Details:

Disk type. For details about possible values, see the root_volume parameter in the API used to create an ECS.

Constraints:

None

Options:

  • SAS: high I/O SAS disks

  • SSD: ultra-high I/O SSD disks

  • SATA: common I/O SATA disks. SATA disks have been removed from EVS. You can find them attached only to existing nodes.

NOTE:

For details about disk types, see Disk Types and Performance.

Default value:

N/A

extendParam

No

Map<String,Object>

Details:

Extended disk parameters, defined in extendparam in the API used to create an ECS.

For details, see extendparam Field Description for Creating Disks.

Constraints:

None

cluster_id

No

String

Details:

ID of the storage pool used by the ECS system disk. This field is used only for DeC clusters and functions as dssPoolID, that is, the ID of the DSS storage pool.

To obtain the value, see the ID field in the API used to obtain details of a DSS storage pool.

Constraints:

None

Options:

N/A

Default value:

N/A

cluster_type

No

String

Details:

Storage class of the ECS system disk

Constraints:

None

Options:

This field is used only for DeC clusters, and the value is always dss.

Default value:

N/A

hw:passthrough

No

Boolean

Details:

  • Pay attention to this field if your ECS is SDI-compliant. If the value of this field is true, the created disk is of SCSI type.

  • If the node pool type is ElasticBMS, this field must be set to true.

  • If the node specification involves both local and EVS disks, configure the disk initialization parameters. For details, see Attaching Disks to a Node.

Constraints:

None

Options:

N/A

Default value:

N/A

metadata

No

VolumeMetadata object

Details:

EVS disk encryption information. This parameter is mandatory only when the system disk or data disk of the node to be created needs to be encrypted.

Constraints:

None

Table 11 VolumeMetadata

Parameter

Mandatory

Type

Description

__system__encrypted

No

String

Details:

Whether an EVS disk is encrypted. The value 0 indicates that the EVS disk is not encrypted, and the value 1 indicates that the EVS disk is encrypted.

Constraints:

None

Options:

N/A

Default value:

If this parameter does not appear, the disk is not encrypted.

__system__cmkid

No

String

Details:

CMK ID, which indicates encryption in metadata. This field is used with __system__encrypted.

Constraints:

None

Options:

N/A

Default value:

N/A

Table 12 Storage

Parameter

Mandatory

Type

Description

storageSelectors

Yes

Array of StorageSelectors objects

Details:

Disk selection. Matched disks are managed based on matchLabels and storageType settings. Disks are matched in sequence. The matching rule in the front is matched first.

Constraints:

None

storageGroups

Yes

Array of StorageGroups objects

Details:

A storage group consisting of multiple storage devices, which are used to divide storage space.

Constraints:

None

Table 13 StorageSelectors

Parameter

Mandatory

Type

Description

name

Yes

String

Details:

Name of a selector, which is used as the index of selectorNames in storageGroup.

Constraints:

The name of each selector must be unique.

Options:

N/A

Default value:

N/A

storageType

Yes

String

Details:

Storage type

Constraints:

  • The local storage type does not support disk selection. All local disks form a VG. Therefore, only one local storage selector is allowed.

  • The system storage type does not support disk selection. It is recommended that you use the system disk to store system components. As a result, only one storage selector of the system type is allowed, and the name must be cceUse.

Options:

Only evs (EVS disks), local (local disks), and system (system disks) are supported.

Default value:

N/A

matchLabels

No

matchLabels object

Details:

Matching field of an EVS disk

Constraints:

If storageType is set to system (system disk), you do not need to configure this parameter.

Options:

The size, volumeType, metadataEncrypted, metadataCmkid, and count fields in DataVolume are supported.

Default value:

N/A

Table 14 matchLabels

Parameter

Mandatory

Type

Description

size

No

String

Details:

Matched disk size, for example, 100. If this parameter is left blank, the disk size is not limited.

Constraints:

None

Options:

N/A

Default value:

N/A

volumeType

No

String

Details:

EVS disk type

Constraints:

None

Options:

SSD, GPSSD, SAS, ESSD, and SATA are supported. If this parameter is left blank, there is no restriction on the disk type.

Default value:

N/A

metadataEncrypted

No

String

Details:

Disk encryption identifier. If this parameter is set to 0, it specifies that the disk is not encrypted. If this parameter is set to 1, it specifies that the disk is encrypted. If this parameter is left blank, there is no restriction on the disk encryption identifier.

Constraints:

None

Options:

N/A

Default value:

N/A

metadataCmkid

No

String

Details:

CMK ID of an encrypted disk. The value is a string of 36 bytes. If this parameter is left blank, there is no restriction on the disk key ID.

Constraints:

None

Options:

N/A

Default value:

N/A

count

No

String

Details:

Number of disks to be selected. If this parameter is left blank, all disks of this type are selected.

Constraints:

None

Options:

N/A

Default value:

N/A

Table 15 StorageGroups

Parameter

Mandatory

Type

Description

name

Yes

String

Details:

Name of a virtual storage group, which must be unique

Constraints:

None

Options:

  • If cceManaged is set to true, the name field must be set to vgpaas.

  • If the data disk is used as a temporary storage volume, the name field must be set to vg-everest-localvolume-ephemeral.

  • If the data disk is used as a persistent storage volume, the name field must be set to vg-everest-localvolume-persistent.

Default value:

N/A

cceManaged

No

Boolean

Details:

Storage space to which Kubernetes and runtime belong. Only one group is set to true. If this parameter is left blank, the default value false is used.

Constraints:

None

Options:

N/A

Default value:

N/A

selectorNames

Yes

Array of strings

Details:

Corresponds to name in storageSelectors. One group can select multiple selectors, but one selector can be selected by only one group.

Constraints:

System components cannot be separately stored in the system disk and data disks. Therefore, when the selector type is set to system, only one selector can be selected for a group.

virtualSpaces

Yes

Array of VirtualSpace objects

Details:

Detailed management of space configurations in a group

Constraints:

None

Table 16 VirtualSpace

Parameter

Mandatory

Type

Description

name

Yes

String

Details:

Name of a virtualSpace. Only types of share, kubernetes, runtime, and user are supported.

Constraints:

None

Options:

  • Kubernetes: Kubernetes space configuration. lvmConfig needs to be configured.

  • runtime: runtime space configuration. runtimeConfig needs to be configured.

  • user: user space configuration. lvmConfig needs to be configured.

Default value:

N/A

size

Yes

String

Details:

Size of a virtualSpace. The value must be an integer in percentage, for example, 90%.

Constraints:

None

Options:

10 to 90. The sum of percentages of all virtualSpaces in a group cannot exceed 100%.

Default value:

N/A

lvmConfig

No

LVMConfig object

Details:

LVM configuration management, which is applicable to share, Kubernetes, and user space configuration

Constraints:

One virtualSpace supports only one config.

runtimeConfig

No

RuntimeConfig object

Details:

Runtime configuration management, which is applicable to runtime space configuration

Constraints:

One virtualSpace supports only one config.

Table 17 LVMConfig

Parameter

Mandatory

Type

Description

lvType

Yes

String

Details:

LVM write mode. linear indicates the linear mode. striped indicates the striped mode, in which multiple disks are used to form a strip to improve disk performance.

Constraints:

None

Options:

N/A

Default value:

N/A

path

No

String

Details:

Disk mount path. This parameter only takes effect in user configuration. The value can be an absolute path containing digits, uppercase letters, lowercase letters, periods (.), hyphens (-), and underscores (_).

Constraints:

Do not leave the path empty or set it to a key OS path such as the root directory. Key OS paths that cannot be entered:

/, /home, /home/, /bin, /bin/, /lib, /lib/, /root, /root/, /boot, /boot/, /dev, /dev/, /etc, /etc/, /lost+found, /lost+found/, /mnt, /mnt/, /proc, /proc/,/sbin, /sbin/, /srv, /srv/, /tmp, /tmp/, /var, /var/, /media, /media/, /opt, /opt/, /selinux, /selinux/, /sys, /sys/, /usr, /usr/, /opt/cloud/, /mnt/paas/, /home/paas/, /var/paas/, /var/lib/, /var/script/

Options:

N/A

Default value:

N/A

Table 18 RuntimeConfig

Parameter

Mandatory

Type

Description

lvType

Yes

String

Details:

LVM write mode. linear indicates the linear mode. striped indicates the striped mode, in which multiple disks are used to form a strip to improve disk performance.

Constraints:

None

Options:

N/A

Default value:

N/A

Table 19 NodePublicIP

Parameter

Mandatory

Type

Description

ids

No

Array of strings

Details:

IDs of existing EIPs

Constraints:

  • The quantity cannot be greater than the number of nodes to be created.

  • If ids has been specified, you do not need to configure count and eip.

count

No

Integer

Details:

Number of EIPs to be dynamically created

Constraints:

count and eip must be configured simultaneously.

Options:

N/A

Default value:

N/A

eip

No

NodeEIPSpec object

Details:

EIP configuration

Constraints:

This parameter is not supported when creating a node pool.

Table 20 NodeEIPSpec

Parameter

Mandatory

Type

Description

iptype

Yes

String

Details:

EIP type, specified in publicip.type in the API for assigning an EIP.

For details, see Assigning an EIP.

Constraints:

None

Options:

N/A

Default value:

N/A

bandwidth

No

NodeBandwidth object

Details:

Bandwidth parameters of the EIP

Constraints:

None

Table 21 NodeBandwidth

Parameter

Mandatory

Type

Description

chargemode

No

String

Details:

Bandwidth billing mode

NOTE:
  • Billed by bandwidth: The billing will be based on the data transmission rate (in Mbps) of public networks. This billing mode is recommended if your bandwidth usage is higher than 10%.

  • Billed by traffic: The billing is based on the total amount of data (in GB) transmitted over the public network. This mode is available only when you are creating a pay-per-use node. This billing mode is recommended if your bandwidth usage is lower than 10%.

Constraints:

None

Options:

  • If this field is not specified, the billing is based on bandwidth.

  • If the field value is empty, the billing is based on bandwidth.

  • If the field value is traffic, the billing is based on traffic.

  • If the value is out of the preceding options, the cloud server will fail to be created.

Default value:

N/A

size

No

Integer

Details:

Bandwidth size, specified in bandwidth.size in the API for assigning an EIP.

For details, see Assigning an EIP.

Constraints:

None

Options:

N/A

Default value:

N/A

sharetype

No

String

Details:

Bandwidth sharing type. Dedicated bandwidth is supported only. PER specifies dedicated bandwidth.

Constraints:

None

Options:

N/A

Default value:

N/A

Table 22 NodeNicSpec

Parameter

Mandatory

Type

Description

primaryNic

No

NicSpec object

Details:

Description of the primary ENI

Constraints:

None

extNics

No

Array of NicSpec objects

Details:

Extension ENI

Constraints:

This parameter is not supported when you add a node during node pool creation.

Table 23 NicSpec

Parameter

Mandatory

Type

Description

subnetId

No

String

Details:

Network ID of the subnet to which an ENI belongs. If subnetList is also configured for a node pool, the subnetList field is used for adding subnets to the node pool.

Constraints:

  • If subnetId is not specified when a primary ENI is creating, the cluster subnet will be used.

  • When creating an extension ENI, you must specify subnetId.

Options:

N/A

Default value:

N/A

fixedIps

No

Array of strings

Details:

The IP address of the primary ENI is specified using fixedIps. The number of IP addresses cannot be greater than the number of created nodes.

Constraints:

Either fixedIps or ipBlock can be specified. fiexdIps cannot be specified for extension ENIs.

ipBlock

No

String

Details:

CIDR format of the primary ENI IP address range. The IP address of the created node falls in this range.

Constraints:

Either fixedIps or ipBlock can be specified.

Options:

N/A

Default value:

N/A

subnetList

No

Array of strings

Details:

Network ID list of the subnet where the ENI resides. Multiple subnets can be configured for a node pool.

Constraints:

A maximum of 20 subnets can be configured.

Table 24 Taint

Parameter

Mandatory

Type

Description

key

Yes

String

Details:

Key

Constraints:

The value must contain 1 to 63 characters starting and ending with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

Options:

N/A

Default value:

N/A

value

No

String

Details:

Value

Constraints:

The value must contain 1 to 63 characters starting and ending with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

Options:

N/A

Default value:

N/A

effect

Yes

String

Details:

Effect

Constraints:

None

Options:

Available options are NoSchedule, PreferNoSchedule, and NoExecute.

Default value:

N/A

Table 25 UserTag

Parameter

Mandatory

Type

Description

key

No

String

Details:

Key of the cloud server tag

Constraints:

The value cannot start with CCE- or __type_baremetal.

Options:

A tag key can have a maximum of 36 characters. It can only contain letters, digits, Unicode characters, and special characters (-_).

Default value:

N/A

value

No

String

Details:

Value of the cloud server tag

Constraints:

None

Options:

A tag value can have a maximum of 43 characters. It can only contain letters, digits, Unicode characters, and special characters (-_).

Default value:

N/A

Table 26 Runtime

Parameter

Mandatory

Type

Description

name

No

String

Details:

Container runtime

Constraints:

None

Options:

N/A

Default value:

  • Clusters earlier than v1.25: The default value is docker.

  • Clusters of v1.25 or later: The default value varies with the OSs.

  • For nodes running EulerOS 2.5 or EulerOS 2.8, the default value is docker. For nodes running other OSs, the default value is containerd.

Table 27 NodeExtendParam

Parameter

Mandatory

Type

Description

ecs:performancetype

No

String

Details:

ECS flavor types. This field is returned in the response.

Constraints:

None

Options:

N/A

Default value:

N/A

orderID

No

String

Details:

Order ID

Constraints:

This parameter is returned in the response when the node is billed on a yearly/monthly basis with auto payment enabled (only in creation scenarios).

Options:

N/A

Default value:

N/A

productID

No

String

Details:

Product ID

Constraints:

This field is returned in the response when the node is billed on a yearly/monthly basis with auto payment enabled.

Options:

N/A

Default value:

N/A

maxPods

No

Integer

Details:

Maximum number of pods that can be created on a node, including the default system pods.

This limit prevents the node from being overloaded with pods.

The number of pods that can be created on a node is determined by multiple parameters. For details, see Maximum Number of Pods That Can Be Created on a Node.

Constraints:

None

Options:

16 to 256

Default value:

N/A

periodType

No

String

Details:

Subscription period type

Constraints:

  • As a request parameter, it is valid and mandatory only when billingMode is set to 1 (yearly/monthly billing) or 2 (yearly/monthly billing with auto payment enabled) (This option has been discarded).

  • As a response parameter, it is returned only when a yearly/monthly node is created.

Options:

  • month

  • year

Default value:

N/A

periodNum

No

Integer

Details:

Number of subscription periods

Constraints:

  • As a request parameter, it is valid and mandatory only when billingMode is set to 1 (yearly/monthly billing) or 2 (yearly/monthly billing with auto payment enabled) (This option has been discarded).

  • As a response parameter, it is returned only when a yearly/monthly node is created.

Options:

  • If periodType is month, the value ranges from 1 to 9.

  • If periodType is year, the value ranges from 1 to 3.

Default value:

N/A

isAutoRenew

No

String

Details:

Whether auto-renewal is enabled

Constraints:

This field is valid when billingMode is set to 1 or 2 (discarded). If not specified, auto-renewal is not enabled.

Options:

  • true: Auto-renewal is enabled.

  • false: Auto-renewal is not enabled.

Default value:

N/A

isAutoPay

No

String

Details:

Whether an order is automatically or manually paid

Constraints:

This field is valid when billingMode is set to 1 or 2 (discarded). If not specified when billingMode is set to 1, auto payment is not enabled. (Discarded) If not specified when billingMode is set to 2, auto payment is enabled.

Options:

  • true: Auto payment is enabled.

  • false: Auto payment is not enabled.

Default value:

N/A

DockerLVMConfigOverride

No

String

Details:

Docker data disk configuration item. (This parameter has been discarded. Use the storage field instead.) Example of the default configuration:

"DockerLVMConfigOverride":"dockerThinpool=vgpaas/90%VG;kubernetesLV=vgpaas/10%VG;diskType=evs;lvType=linear"

By default, if no VD disk is available, an error occurs because the data disk fails to be found. Specify diskType based on the actual drive letter type.

Constraints:

None

Options:

The following fields are included:

  • userLV: (Optional) size of the user space, for example, vgpaas/20%VG

  • userPath (Optional): mount path of the user space, for example, /home/wqt-test

  • diskType: disk type. Only evs, hdd, and ssd are supported.

  • lvType: type of a logic volume. The value can be linear or striped.

  • dockerThinpool: Docker space size, for example, vgpaas/60%VG

  • kubernetesLV: kubelet space size, for example, vgpaas/20%VG

    Default value:

    N/A

dockerBaseSize

No

Integer

Details:

Available disk space of a single container on a node (unit: G). This parameter has been discarded. Use containerBaseSize.

For details about how to allocate the space for the container runtime, see Space Allocation of a Data Disk.

Constraints:

When Device Mapper is used, it is recommended that dockerBaseSize be set to a value less than or equal to 80 GiB. If the value is too large, the container runtime may fail to be started due to long initialization. If there are special requirements for the container disk space, you can mount an external or local storage device.

  • The dockerBaseSize setting takes effect only on nodes running EulerOS or Huawei Cloud EulerOS 2.0 in clusters of the new version.

Options:

10 to 500

Default value:

If the value is not specified or is set to 0, the default value is used.

  • The default value is 10 in Device Mapper mode.

  • In OverlayFS mode, the available space of a single container is not limited by default.

containerBaseSize

No

Integer

Details:

Available disk space of a single container on a node (unit: G).

For details about how to allocate the space for the container runtime, see Space Allocation of a Data Disk.

Constraints:

When Device Mapper is used, it is recommended that containerBaseSize be set to a value less than or equal to 80 GiB. If the value is too large, the container runtime may fail to be started due to long initialization. If there are special requirements for the container disk space, you can mount an external or local storage device. In new versions, the Device Mapper mode is used only by BMSs in the same resource pool and is being discarded.

  • The containerBaseSize setting takes effect only on nodes running EulerOS or Huawei Cloud EulerOS 2.0 in clusters of the new version (v1.23.14-r0, v1.25.9-r0, v1.27.6-r0, v1.28.4-r0 or later).

  • This parameter cannot be updated when a node pool is being updated.

Options:

10 to 500

Default value:

If the value is not specified or is set to 0, the default value is used.

  • The default value is 10 in Device Mapper mode.

  • In OverlayFS mode, the available space of a single container is not limited by default.

publicKey

No

String

Details:

Public key of a node

Constraints:

None

Options:

N/A

Default value:

N/A

alpha.cce/preInstall

No

String

Details:

Pre-installation script.

The input value must be encoded using Base64. The method is as follows:

echo -n "*Content to be encoded*" | base64

Constraints:

The characters of both the pre-installation and post-installation scripts are centrally calculated, and the total number of characters after transcoding cannot exceed 10,240.

Options:

N/A

Default value:

N/A

alpha.cce/postInstall

No

String

Details:

Post-installation script.

The input value must be encoded using Base64. The method is as follows:

echo -n "*Content to be encoded*" | base64

Constraints:

The characters of both the pre-installation and post-installation scripts are centrally calculated, and the total number of characters after transcoding cannot exceed 10,240.

Options:

N/A

Default value:

N/A

alpha.cce/NodeImageID

No

String

Details:

This parameter is required when a custom image is used to create a BMS node.

Constraints:

None

Options:

N/A

Default value:

N/A

nicMultiqueue

No

String

Details:

  • Number of ENI queues. Example:

"[{\"queue\":4}]"

The following fields are included:

  • queue: number of ENI queues

  • Supported proportions are {"1":128, "2":92, "4":92, "8":32, "16":16, "28":9}. That is, if there is one queue, a maximum of 128 ENIs can be bound. If there are two queues, a maximum of 92 ENIs can be bound.

  • A larger number of ENI queues indicates higher performance but fewer ENIs can be bound. The queue settings cannot be changed after creation.

Constraints:

This field can be configured only for BMS nodes in CCE Turbo clusters.

Options:

N/A

Default value:

N/A

nicThreshold

No

String

Details:

  • ENI pre-binding thresholds. Example:

"0.3:0.6"
  • Low threshold (L): determines the minimum number of pre-bound ENIs (Min). Formula: Min = Total number of ENIs of the node × L

  • High threshold (H): determines the maximum number of pre-bound ENIs (Max). Formula: Max = Total number of ENIs of the node × H

  • Number of ENIs bound to a BMS node (B) and number of ENIs being used by pods (U): U + Min < B < U + Max

  • If the number of pre-bound ENIs on a BMS node is smaller than the minimum allowed, the system will bind more ENIs to make the numbers equal.

  • If the number of pre-bound ENIs on a BMS node is larger than the maximum allowed, the system periodically unbinds ENIs (about every 2 minutes) to make the numbers equal.

    Constraints:

  • This field can be configured only for BMS nodes in CCE Turbo clusters.

  • Pre-binding ENIs can speed up workload creation but occupies IP addresses.

Options:

Both the thresholds are one-decimal-place values ranging from 0.0 to 1.0. The low threshold must be smaller than or equal to the high one.

Default value:

N/A

chargingMode

No

Integer

Details:

Billing mode of a node. This parameter has been discarded. Use billingMode in NodeSpec instead.

Constraints:

None

Options:

N/A

Default value:

N/A

marketType

No

String

Details:

When creating a spot ECS, this parameter should be set to spot.

Constraints:

This parameter is valid only when billingMode is set to 0.

Options:

N/A

Default value:

N/A

spotPrice

No

String

Details:

The highest price per hour a user accepts for a spot ECS

Constraints:

  • This parameter takes effect only when billingMode is set to 0 and marketType is set to spot.

  • When billingMode is set to 0 and marketType is set to spot, if spotPrice is not specified, the pay-per-use price is used by default.

  • The spotPrice value must be less than or equal to the pay-per-use price and greater than or equal to the ECS market price.

Options:

N/A

Default value:

N/A

agency_name

No

String

Details:

Agency name.

An agency is created by a tenant administrator on Identity and Access Management (IAM) to provide temporary credentials for CCE nodes to access cloud servers.

This parameter is returned only when it is transferred during node creation.

Constraints:

None

Options:

N/A

Default value:

N/A

kubeReservedMem

No

Integer

Details:

Reserved node memory, which is reserved for Kubernetes components.

Constraints:

None

Options:

N/A

Default value:

N/A

systemReservedMem

No

Integer

Details:

Reserved node memory, which is reserved for system components.

Constraints:

None

Options:

N/A

Default value:

N/A

init-node-password

No

String

Details:

Node password. If this parameter is used as a response parameter, asterisks (*) will be displayed.

Constraints:

None

Options:

N/A

Default value:

N/A

Table 28 HostnameConfig

Parameter

Mandatory

Type

Description

type

Yes

String

Details:

Configuration type of the Kubernetes node name. The default value is privateIp.

Constraints:

  • The node names, Kubernetes node names, and VM names of the nodes configured with cceNodeName are the same. Node names cannot be changed. Once a VM name is altered on the ECS console, the node name cannot be modified accordingly during ECS synchronization.

  • To prevent conflicts between Kubernetes node names, a suffix is automatically added to the node name of a node configured with cceNodeName. The suffix consists of a hyphen (-) followed by five random lowercase letters and digits (0 to 9).

Options:

  • privateIp: Use the private node IP address the as the Kubernetes node name.

  • cceNodeName: Use the CCE node name as the Kubernetes node name.

Default value:

privateIp

Response Parameters

Status code: 201

Table 29 Response body parameters

Parameter

Type

Description

kind

String

API type. The value is fixed at Node and cannot be changed.

apiVersion

String

API version. The value is fixed at v3 and cannot be changed.

metadata

NodeMetadata object

Node metadata, which is a collection of attributes.

spec

NodeSpec object

Detailed description of the node. CCE creates or updates objects by defining or updating spec.

status

NodeStatus object

Node status, which is dynamically recorded. A user-defined value will not function when a node is being created or modified.

Table 30 NodeMetadata

Parameter

Type

Description

name

String

Node name.

NOTE:

Enter 1 to 56 characters starting with a lowercase letter and not ending with a hyphen (-). Only lowercase letters, digits, hyphens (-), and periods (.) are allowed.

If name is not configured or is left blank, the node name is generated based on the default rule, which is Cluster name-Random characters. Only the first 36 characters are kept for a long cluster name.

If the number of nodes (count) is greater than 1, some random characters are added to the end of the entered node name according to the default rule, which is User-defined name-Random characters. If the length of the entered node name exceeds 50 characters, the system uses the first 50 characters and adds a random character string to the end of the name.

uid

String

Node ID, which is unique and automatically generated after the resource is created. A user-defined ID will not take effect.

labels

Map<String,String>

CCE node label (not the native Kubernetes label).

Labels are used to select objects that meet certain criteria. A label is a key-value pair.

Example:

"labels": {
  "key" : "value"
}

annotations

Map<String,String>

CCE node annotations, in key-value pairs (not the native Kubernetes annotations).

Example:

"annotations": {
  "key1" : "value1",
  "key2" : "value2"
}
NOTE:
  • annotations are not used to identify or select objects. The metadata in annotations may be small or large, structured or unstructured, and may include characters that are not allowed in labels.

  • This parameter is used only for query and cannot be input through a request. Entered data of this parameter is invalid.

creationTimestamp

String

Time when the object was created. The value is automatically generated after the object is created. A user-defined value will not take effect.

updateTimestamp

String

Time when the object was updated. The value is automatically generated after the object is created. A user-defined value will not take effect.

ownerReference

ownerReference object

Owner object

Table 31 ownerReference

Parameter

Type

Description

nodepoolName

String

Node pool name

nodepoolID

String

Node pool UID

Table 32 NodeSpec

Parameter

Type

Description

flavor

String

Details:

Node flavors. For details about the node flavors supported by CCE clusters, see Node Specifications.

Constraints:

None

Options:

N/A

Default value:

N/A

az

String

Details:

AZ where the node to be created is located. You need to specify the AZ name. Random AZs will not be allocated to a node created using APIs.

For details about AZs supported by CCE, see Regions and Endpoints.

Constraints:

When you are creating a node pool and configuring a scaling group, this parameter cannot be set to random.

Options:

N/A

Default value:

N/A

os

String

Details:

Node OS. For details about the supported OSs, see Node OSs.

Constraints:

  • If the selected OS is not supported by the current cluster version, it will be automatically replaced with a supported OS of the same series.

  • If alpha.cce/NodeImageID in extendParam is specified during node creation, you do not need to configure this parameter.

  • If this parameter is not specified, CCE automatically selects a supported OS version based on the cluster version.

  • This parameter is mandatory when creating a node pool.

  • If you are using shared disk space when creating a node, this parameter is mandatory. Specifically, the disk initialization configuration management parameter storage is used and the name field of virtualSpaces in StorageGroups is set to share.

Options:

N/A

Default value:

N/A

login

Login object

Details:

Node login mode. Either the key pair or password must be used for login.

Constraints:

This parameter cannot be modified when a node pool is being updated.

rootVolume

Volume object

Details:

Disk information of a node

Constraints:

None

dataVolumes

Array of Volume objects

Details:

Data disk parameters of a node. For DeC nodes, the parameter details are the same as those in rootVolume.

Constraints:

A VM can have up to 16 disks attached, while a BMS can only have up to 10 disks attached. The maximum number of disks that can be attached to either a VM or BMS is limited by their respective maximum disk limits. (You can add more data disks to each of your nodes through the CCE console or APIs.)

The data disk used by the container runtime and kubelet cannot be detached, or the node will become unavailable.

storage

Storage object

Details:

Disk initialization management parameter.

This parameter is complex to configure. For details, see Attaching Disks to a Node.

Constraints:

  • If a node has both local and EVS disks attached, make sure to not keep the default value for this parameter, or it may result in unexpected disk partitions.

  • If you want to change the value range of a data disk to 20 to 32768, do not use the default value.

  • If you want to use the shared disk space (with the runtime and Kubernetes partitions cancelled), do not retain the default value of this parameter. For details about the shared disk space, see Space Allocation of a Data Disk.

  • If you want to store system components in the system disk, do not use the default value.

publicIP

NodePublicIP object

Details:

EIP of a node

Constraints:

This parameter is not supported when you add a node during node pool creation.

nodeNicSpec

NodeNicSpec object

Details:

ENI of a node

Constraints:

None

count

Integer

Details:

Number of nodes to be created in batches

Constraints:

This parameter can be left blank when it is used for a node pool.

Options:

Positive integers that are greater than or equal to 1 and less than or equal to the maximum limit

Default value:

N/A

billingMode

Integer

Details:

Billing mode of a node

Constraints:

None

Options:

  • 0: pay-per-use

  • 1: yearly/monthly

  • 2: (Discarded) yearly/monthly billing with auto payment enabled

Default value:

N/A

taints

Array of Taint objects

Details:

Taints, which can be added to nodes for anti-affinity configuration. Each taint contains the following parameters:

  • Key: Enter 1 to 63 characters starting and ending with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. A DNS subdomain can be prefixed to a key.

  • Value: Enter 1 to 63 characters starting and ending with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

  • Effect: Available options are NoSchedule, PreferNoSchedule, and NoExecute.

    When creating a node, you can specify the initial value for this parameter and this field is not returned during query. In node pools, the initial value can be specified in the node template and this field is returned during query. In other scenarios, this field is not returned during query.

Example:

"taints": [{
  "key": "status",
  "value": "unavailable",
  "effect": "NoSchedule"
}, {
  "key": "looks",
  "value": "bad",
  "effect": "NoSchedule"
}]

Constraints:

A maximum of 20 taints can be configured.

k8sTags

Map<String,String>

Details:

Defined in key-value pairs.

  • Key: Enter 1 to 63 characters starting and ending with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. A DNS subdomain containing a maximum of 253 characters (such as example.com/my-key) can be prefixed to a key.

  • Value: The value can be left blank or contain 1 to 63 characters that start and end with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

    When creating a node, you can specify the initial value for this parameter and this field is not returned during query. In node pools, the initial value can be specified in the node template and this field is returned during query. In other scenarios, this field is not returned during query.

Example:

"k8sTags": {
  "key": "value"
}

Constraints:

A maximum of 20 key-value pairs are allowed.

ecsGroupId

String

Details:

ECS group ID. If this parameter is specified, nodes will be created in the specific ECS group.

Constraints:

This configuration does not take effect when a node pool is created. To ensure that all nodes in a node pool are in the same ECS group, configure nodeManagement in the node pool.

Options:

N/A

Default value:

N/A

dedicatedHostId

String

Details:

ID of the DeH to which nodes will be scheduled.

Constraints:

This parameter is not supported when you add a node during node pool creation.

userTags

Array of UserTag objects

Details:

Cloud server tag (resource tag). When creating a node, you can specify the initial value for this parameter and this field is not returned during query. In node pools, the initial value can be specified in the node template and this field is returned during query. In other scenarios, this field is not returned during query.

Constraints:

  • The key of a tag must be unique. The maximum number of custom tags supported by CCE varies depending on regions and cannot exceed 8.

  • A tag key can have a maximum of 36 characters. It can only contain letters, digits, Unicode characters, and special characters (-_).

runtime

Runtime object

Details:

Container runtime

  • Clusters earlier than v1.25: The default value is docker.

  • Clusters of v1.25 or later: The default value varies with the OSs.

  • For nodes running EulerOS 2.5 or EulerOS 2.8, the default container runtime is docker. For nodes running other OSs, the default container runtime is containerd.

Constraints:

None

initializedConditions

Array of strings

Details:

Custom initialization flag, which is left blank by default.

Before CCE nodes are initialized, they are tainted with node.cloudprovider.kubernetes.io/uninitialized to prevent pods from being scheduled to them. When creating a node, you can specify the initializedConditions parameter to control the taint removal time. By default, the timeout interval is not configured.

Example:

  1. Create a node and add parameter "initializedConditions": ["CCEInitial", "CustomedInitial"].

  2. After custom initialization is complete, CCE will call a Kubernetes API (for example, PATCH /v1/nodes/{node_ip}/status) to update the node conditions by adding two labels of types CCEInitial and CustomedInitial and setting the status to True, as shown in the following:

status:
  conditions:
  - type: CCEInitial
    status: 'True'
  - type: CustomedInitial
    status: 'True'
  1. CCE polls status.Conditions of nodes to check whether there are conditions of types CCEInitial and CustomedInitial. If such conditions exist and the status is True, the node initialization is complete and the initialization taint is removed.

  2. initializedConditions allows you to configure a timeout period during node creation. For example, "initializedConditions": ["CCEInitial:15m", "CustomedInitial:15m"] indicates that the timeout period is 15 minutes. After the timeout period is reached, the initialization conditions will be automatically ignored and the initialization taint will be removed when CCE polls the node.

Constraints:

  • The timeout interval in initializedConditions ranges from 1 to 99 seconds.

  • Each value has 1 to 20 characters, which must consist of letters and digits.

  • The maximum number of flags cannot exceed 2.

  • The unit of the timeout period is minute (m).

extendParam

NodeExtendParam object

Details:

Extended parameters for creating a node

Constraints:

None

hostnameConfig

HostnameConfig object

Details:

Kubernetes node name configuration parameter

Constraints:

The supported cluster version is v1.23.6-r0 to v1.25 or v1.25.2-r0 or later.

serverEnterpriseProjectID

String

Details:

Enterprise project ID of a server. CCE does not support features provided by EPS. This field is used only for synchronizing enterprise project IDs of servers.

Constraints:

To create a node or node pool, you can specify an existing enterprise project for it. If this field is left blank, it inherits the enterprise project attributes of the cluster that runs the node or node pool.

When updating a node pool, any configuration modifications you made will apply only to new nodes. You need to modify the enterprise projects of existing nodes on the EPS console.

Options:

N/A

Default value:

If no value is specified during update, this field will not be updated.

If this parameter is left blank, the cluster enterprise project is returned.

Table 33 Login

Parameter

Type

Description

sshKey

String

Details:

Name of the key pair used for login

Constraints:

None

Options:

N/A

Default value:

N/A

userPassword

UserPassword object

Details:

Password used for node login

Constraints:

None

Table 34 UserPassword

Parameter

Type

Description

username

String

Details:

Login account. The default value is root.

Constraints:

None

Options:

N/A

Default value:

root

password

String

Details:

Login password. If a username and password are used when a node is created, this field is shielded in the response body.

Constraints:

The password field must be salted during node creation. For details, see Adding a Salt in the password Field When Creating a Node.

Options:

A password must:

  • Contain 8 to 26 characters.

  • Contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters !@$%^-_=+[{}]:,./?

  • Not contain the username or the username spelled backwards.

Default value:

N/A

Table 35 Volume

Parameter

Type

Description

size

Integer

Details:

Disk size, in GiB

Constraints:

None

Options:

  • System disks: 40 to 1024

  • The first data disk: 20 to 32768 (When storage is not specified, this value range becomes 100 to 32768.)

  • Other data disks: 10 to 32768 (When storage is not specified, this value range becomes 100 to 32768.)

Default value:

N/A

volumetype

String

Details:

Disk type. For details about possible values, see the root_volume parameter in the API used to create an ECS.

Constraints:

None

Options:

  • SAS: high I/O SAS disks

  • SSD: ultra-high I/O SSD disks

  • SATA: common I/O SATA disks. SATA disks have been removed from EVS. You can find them attached only to existing nodes.

NOTE:

For details about disk types, see Disk Types and Performance.

Default value:

N/A

extendParam

Map<String,Object>

Details:

Extended disk parameters, defined in extendparam in the API used to create an ECS.

For details, see extendparam Field Description for Creating Disks.

Constraints:

None

cluster_id

String

Details:

ID of the storage pool used by the ECS system disk. This field is used only for DeC clusters and functions as dssPoolID, that is, the ID of the DSS storage pool.

To obtain the value, see the ID field in the API used to obtain details of a DSS storage pool.

Constraints:

None

Options:

N/A

Default value:

N/A

cluster_type

String

Details:

Storage class of the ECS system disk

Constraints:

None

Options:

This field is used only for DeC clusters, and the value is always dss.

Default value:

N/A

hw:passthrough

Boolean

Details:

  • Pay attention to this field if your ECS is SDI-compliant. If the value of this field is true, the created disk is of SCSI type.

  • If the node pool type is ElasticBMS, this field must be set to true.

  • If the node specification involves both local and EVS disks, configure the disk initialization parameters. For details, see Attaching Disks to a Node.

Constraints:

None

Options:

N/A

Default value:

N/A

metadata

VolumeMetadata object

Details:

EVS disk encryption information. This parameter is mandatory only when the system disk or data disk of the node to be created needs to be encrypted.

Constraints:

None

Table 36 VolumeMetadata

Parameter

Type

Description

__system__encrypted

String

Details:

Whether an EVS disk is encrypted. The value 0 indicates that the EVS disk is not encrypted, and the value 1 indicates that the EVS disk is encrypted.

Constraints:

None

Options:

N/A

Default value:

If this parameter does not appear, the disk is not encrypted.

__system__cmkid

String

Details:

CMK ID, which indicates encryption in metadata. This field is used with __system__encrypted.

Constraints:

None

Options:

N/A

Default value:

N/A

Table 37 Storage

Parameter

Type

Description

storageSelectors

Array of StorageSelectors objects

Details:

Disk selection. Matched disks are managed based on matchLabels and storageType settings. Disks are matched in sequence. The matching rule in the front is matched first.

Constraints:

None

storageGroups

Array of StorageGroups objects

Details:

A storage group consisting of multiple storage devices, which are used to divide storage space.

Constraints:

None

Table 38 StorageSelectors

Parameter

Type

Description

name

String

Details:

Name of a selector, which is used as the index of selectorNames in storageGroup.

Constraints:

The name of each selector must be unique.

Options:

N/A

Default value:

N/A

storageType

String

Details:

Storage type

Constraints:

  • The local storage type does not support disk selection. All local disks form a VG. Therefore, only one local storage selector is allowed.

  • The system storage type does not support disk selection. It is recommended that you use the system disk to store system components. As a result, only one storage selector of the system type is allowed, and the name must be cceUse.

Options:

Only evs (EVS disks), local (local disks), and system (system disks) are supported.

Default value:

N/A

matchLabels

matchLabels object

Details:

Matching field of an EVS disk

Constraints:

If storageType is set to system (system disk), you do not need to configure this parameter.

Options:

The size, volumeType, metadataEncrypted, metadataCmkid, and count fields in DataVolume are supported.

Default value:

N/A

Table 39 matchLabels

Parameter

Type

Description

size

String

Details:

Matched disk size, for example, 100. If this parameter is left blank, the disk size is not limited.

Constraints:

None

Options:

N/A

Default value:

N/A

volumeType

String

Details:

EVS disk type

Constraints:

None

Options:

SSD, GPSSD, SAS, ESSD, and SATA are supported. If this parameter is left blank, there is no restriction on the disk type.

Default value:

N/A

metadataEncrypted

String

Details:

Disk encryption identifier. If this parameter is set to 0, it specifies that the disk is not encrypted. If this parameter is set to 1, it specifies that the disk is encrypted. If this parameter is left blank, there is no restriction on the disk encryption identifier.

Constraints:

None

Options:

N/A

Default value:

N/A

metadataCmkid

String

Details:

CMK ID of an encrypted disk. The value is a string of 36 bytes. If this parameter is left blank, there is no restriction on the disk key ID.

Constraints:

None

Options:

N/A

Default value:

N/A

count

String

Details:

Number of disks to be selected. If this parameter is left blank, all disks of this type are selected.

Constraints:

None

Options:

N/A

Default value:

N/A

Table 40 StorageGroups

Parameter

Type

Description

name

String

Details:

Name of a virtual storage group, which must be unique

Constraints:

None

Options:

  • If cceManaged is set to true, the name field must be set to vgpaas.

  • If the data disk is used as a temporary storage volume, the name field must be set to vg-everest-localvolume-ephemeral.

  • If the data disk is used as a persistent storage volume, the name field must be set to vg-everest-localvolume-persistent.

Default value:

N/A

cceManaged

Boolean

Details:

Storage space to which Kubernetes and runtime belong. Only one group is set to true. If this parameter is left blank, the default value false is used.

Constraints:

None

Options:

N/A

Default value:

N/A

selectorNames

Array of strings

Details:

Corresponds to name in storageSelectors. One group can select multiple selectors, but one selector can be selected by only one group.

Constraints:

System components cannot be separately stored in the system disk and data disks. Therefore, when the selector type is set to system, only one selector can be selected for a group.

virtualSpaces

Array of VirtualSpace objects

Details:

Detailed management of space configurations in a group

Constraints:

None

Table 41 VirtualSpace

Parameter

Type

Description

name

String

Details:

Name of a virtualSpace. Only types of share, kubernetes, runtime, and user are supported.

Constraints:

None

Options:

  • Kubernetes: Kubernetes space configuration. lvmConfig needs to be configured.

  • runtime: runtime space configuration. runtimeConfig needs to be configured.

  • user: user space configuration. lvmConfig needs to be configured.

Default value:

N/A

size

String

Details:

Size of a virtualSpace. The value must be an integer in percentage, for example, 90%.

Constraints:

None

Options:

10 to 90. The sum of percentages of all virtualSpaces in a group cannot exceed 100%.

Default value:

N/A

lvmConfig

LVMConfig object

Details:

LVM configuration management, which is applicable to share, Kubernetes, and user space configuration

Constraints:

One virtualSpace supports only one config.

runtimeConfig

RuntimeConfig object

Details:

Runtime configuration management, which is applicable to runtime space configuration

Constraints:

One virtualSpace supports only one config.

Table 42 LVMConfig

Parameter

Type

Description

lvType

String

Details:

LVM write mode. linear indicates the linear mode. striped indicates the striped mode, in which multiple disks are used to form a strip to improve disk performance.

Constraints:

None

Options:

N/A

Default value:

N/A

path

String

Details:

Disk mount path. This parameter only takes effect in user configuration. The value can be an absolute path containing digits, uppercase letters, lowercase letters, periods (.), hyphens (-), and underscores (_).

Constraints:

Do not leave the path empty or set it to a key OS path such as the root directory. Key OS paths that cannot be entered:

/, /home, /home/, /bin, /bin/, /lib, /lib/, /root, /root/, /boot, /boot/, /dev, /dev/, /etc, /etc/, /lost+found, /lost+found/, /mnt, /mnt/, /proc, /proc/,/sbin, /sbin/, /srv, /srv/, /tmp, /tmp/, /var, /var/, /media, /media/, /opt, /opt/, /selinux, /selinux/, /sys, /sys/, /usr, /usr/, /opt/cloud/, /mnt/paas/, /home/paas/, /var/paas/, /var/lib/, /var/script/

Options:

N/A

Default value:

N/A

Table 43 RuntimeConfig

Parameter

Type

Description

lvType

String

Details:

LVM write mode. linear indicates the linear mode. striped indicates the striped mode, in which multiple disks are used to form a strip to improve disk performance.

Constraints:

None

Options:

N/A

Default value:

N/A

Table 44 NodePublicIP

Parameter

Type

Description

ids

Array of strings

Details:

IDs of existing EIPs

Constraints:

  • The quantity cannot be greater than the number of nodes to be created.

  • If ids has been specified, you do not need to configure count and eip.

count

Integer

Details:

Number of EIPs to be dynamically created

Constraints:

count and eip must be configured simultaneously.

Options:

N/A

Default value:

N/A

eip

NodeEIPSpec object

Details:

EIP configuration

Constraints:

This parameter is not supported when creating a node pool.

Table 45 NodeEIPSpec

Parameter

Type

Description

iptype

String

Details:

EIP type, specified in publicip.type in the API for assigning an EIP.

For details, see Assigning an EIP.

Constraints:

None

Options:

N/A

Default value:

N/A

bandwidth

NodeBandwidth object

Details:

Bandwidth parameters of the EIP

Constraints:

None

Table 46 NodeBandwidth

Parameter

Type

Description

chargemode

String

Details:

Bandwidth billing mode

NOTE:
  • Billed by bandwidth: The billing will be based on the data transmission rate (in Mbps) of public networks. This billing mode is recommended if your bandwidth usage is higher than 10%.

  • Billed by traffic: The billing is based on the total amount of data (in GB) transmitted over the public network. This mode is available only when you are creating a pay-per-use node. This billing mode is recommended if your bandwidth usage is lower than 10%.

Constraints:

None

Options:

  • If this field is not specified, the billing is based on bandwidth.

  • If the field value is empty, the billing is based on bandwidth.

  • If the field value is traffic, the billing is based on traffic.

  • If the value is out of the preceding options, the cloud server will fail to be created.

Default value:

N/A

size

Integer

Details:

Bandwidth size, specified in bandwidth.size in the API for assigning an EIP.

For details, see Assigning an EIP.

Constraints:

None

Options:

N/A

Default value:

N/A

sharetype

String

Details:

Bandwidth sharing type. Dedicated bandwidth is supported only. PER specifies dedicated bandwidth.

Constraints:

None

Options:

N/A

Default value:

N/A

Table 47 NodeNicSpec

Parameter

Type

Description

primaryNic

NicSpec object

Details:

Description of the primary ENI

Constraints:

None

extNics

Array of NicSpec objects

Details:

Extension ENI

Constraints:

This parameter is not supported when you add a node during node pool creation.

Table 48 NicSpec

Parameter

Type

Description

subnetId

String

Details:

Network ID of the subnet to which an ENI belongs. If subnetList is also configured for a node pool, the subnetList field is used for adding subnets to the node pool.

Constraints:

  • If subnetId is not specified when a primary ENI is creating, the cluster subnet will be used.

  • When creating an extension ENI, you must specify subnetId.

Options:

N/A

Default value:

N/A

fixedIps

Array of strings

Details:

The IP address of the primary ENI is specified using fixedIps. The number of IP addresses cannot be greater than the number of created nodes.

Constraints:

Either fixedIps or ipBlock can be specified. fiexdIps cannot be specified for extension ENIs.

ipBlock

String

Details:

CIDR format of the primary ENI IP address range. The IP address of the created node falls in this range.

Constraints:

Either fixedIps or ipBlock can be specified.

Options:

N/A

Default value:

N/A

subnetList

Array of strings

Details:

Network ID list of the subnet where the ENI resides. Multiple subnets can be configured for a node pool.

Constraints:

A maximum of 20 subnets can be configured.

Table 49 Taint

Parameter

Type

Description

key

String

Details:

Key

Constraints:

The value must contain 1 to 63 characters starting and ending with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

Options:

N/A

Default value:

N/A

value

String

Details:

Value

Constraints:

The value must contain 1 to 63 characters starting and ending with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

Options:

N/A

Default value:

N/A

effect

String

Details:

Effect

Constraints:

None

Options:

Available options are NoSchedule, PreferNoSchedule, and NoExecute.

Default value:

N/A

Table 50 UserTag

Parameter

Type

Description

key

String

Details:

Key of the cloud server tag

Constraints:

The value cannot start with CCE- or __type_baremetal.

Options:

A tag key can have a maximum of 36 characters. It can only contain letters, digits, Unicode characters, and special characters (-_).

Default value:

N/A

value

String

Details:

Value of the cloud server tag

Constraints:

None

Options:

A tag value can have a maximum of 43 characters. It can only contain letters, digits, Unicode characters, and special characters (-_).

Default value:

N/A

Table 51 Runtime

Parameter

Type

Description

name

String

Details:

Container runtime

Constraints:

None

Options:

N/A

Default value:

  • Clusters earlier than v1.25: The default value is docker.

  • Clusters of v1.25 or later: The default value varies with the OSs.

  • For nodes running EulerOS 2.5 or EulerOS 2.8, the default value is docker. For nodes running other OSs, the default value is containerd.

Table 52 NodeExtendParam

Parameter

Type

Description

ecs:performancetype

String

Details:

ECS flavor types. This field is returned in the response.

Constraints:

None

Options:

N/A

Default value:

N/A

orderID

String

Details:

Order ID

Constraints:

This parameter is returned in the response when the node is billed on a yearly/monthly basis with auto payment enabled (only in creation scenarios).

Options:

N/A

Default value:

N/A

productID

String

Details:

Product ID

Constraints:

This field is returned in the response when the node is billed on a yearly/monthly basis with auto payment enabled.

Options:

N/A

Default value:

N/A

maxPods

Integer

Details:

Maximum number of pods that can be created on a node, including the default system pods.

This limit prevents the node from being overloaded with pods.

The number of pods that can be created on a node is determined by multiple parameters. For details, see Maximum Number of Pods That Can Be Created on a Node.

Constraints:

None

Options:

16 to 256

Default value:

N/A

periodType

String

Details:

Subscription period type

Constraints:

  • As a request parameter, it is valid and mandatory only when billingMode is set to 1 (yearly/monthly billing) or 2 (yearly/monthly billing with auto payment enabled) (This option has been discarded).

  • As a response parameter, it is returned only when a yearly/monthly node is created.

Options:

  • month

  • year

Default value:

N/A

periodNum

Integer

Details:

Number of subscription periods

Constraints:

  • As a request parameter, it is valid and mandatory only when billingMode is set to 1 (yearly/monthly billing) or 2 (yearly/monthly billing with auto payment enabled) (This option has been discarded).

  • As a response parameter, it is returned only when a yearly/monthly node is created.

Options:

  • If periodType is month, the value ranges from 1 to 9.

  • If periodType is year, the value ranges from 1 to 3.

Default value:

N/A

isAutoRenew

String

Details:

Whether auto-renewal is enabled

Constraints:

This field is valid when billingMode is set to 1 or 2 (discarded). If not specified, auto-renewal is not enabled.

Options:

  • true: Auto-renewal is enabled.

  • false: Auto-renewal is not enabled.

Default value:

N/A

isAutoPay

String

Details:

Whether an order is automatically or manually paid

Constraints:

This field is valid when billingMode is set to 1 or 2 (discarded). If not specified when billingMode is set to 1, auto payment is not enabled. (Discarded) If not specified when billingMode is set to 2, auto payment is enabled.

Options:

  • true: Auto payment is enabled.

  • false: Auto payment is not enabled.

Default value:

N/A

DockerLVMConfigOverride

String

Details:

Docker data disk configuration item. (This parameter has been discarded. Use the storage field instead.) Example of the default configuration:

"DockerLVMConfigOverride":"dockerThinpool=vgpaas/90%VG;kubernetesLV=vgpaas/10%VG;diskType=evs;lvType=linear"

By default, if no VD disk is available, an error occurs because the data disk fails to be found. Specify diskType based on the actual drive letter type.

Constraints:

None

Options:

The following fields are included:

  • userLV: (Optional) size of the user space, for example, vgpaas/20%VG

  • userPath (Optional): mount path of the user space, for example, /home/wqt-test

  • diskType: disk type. Only evs, hdd, and ssd are supported.

  • lvType: type of a logic volume. The value can be linear or striped.

  • dockerThinpool: Docker space size, for example, vgpaas/60%VG

  • kubernetesLV: kubelet space size, for example, vgpaas/20%VG

    Default value:

    N/A

dockerBaseSize

Integer

Details:

Available disk space of a single container on a node (unit: G). This parameter has been discarded. Use containerBaseSize.

For details about how to allocate the space for the container runtime, see Space Allocation of a Data Disk.

Constraints:

When Device Mapper is used, it is recommended that dockerBaseSize be set to a value less than or equal to 80 GiB. If the value is too large, the container runtime may fail to be started due to long initialization. If there are special requirements for the container disk space, you can mount an external or local storage device.

  • The dockerBaseSize setting takes effect only on nodes running EulerOS or Huawei Cloud EulerOS 2.0 in clusters of the new version.

Options:

10 to 500

Default value:

If the value is not specified or is set to 0, the default value is used.

  • The default value is 10 in Device Mapper mode.

  • In OverlayFS mode, the available space of a single container is not limited by default.

containerBaseSize

Integer

Details:

Available disk space of a single container on a node (unit: G).

For details about how to allocate the space for the container runtime, see Space Allocation of a Data Disk.

Constraints:

When Device Mapper is used, it is recommended that containerBaseSize be set to a value less than or equal to 80 GiB. If the value is too large, the container runtime may fail to be started due to long initialization. If there are special requirements for the container disk space, you can mount an external or local storage device. In new versions, the Device Mapper mode is used only by BMSs in the same resource pool and is being discarded.

  • The containerBaseSize setting takes effect only on nodes running EulerOS or Huawei Cloud EulerOS 2.0 in clusters of the new version (v1.23.14-r0, v1.25.9-r0, v1.27.6-r0, v1.28.4-r0 or later).

  • This parameter cannot be updated when a node pool is being updated.

Options:

10 to 500

Default value:

If the value is not specified or is set to 0, the default value is used.

  • The default value is 10 in Device Mapper mode.

  • In OverlayFS mode, the available space of a single container is not limited by default.

publicKey

String

Details:

Public key of a node

Constraints:

None

Options:

N/A

Default value:

N/A

alpha.cce/preInstall

String

Details:

Pre-installation script.

The input value must be encoded using Base64. The method is as follows:

echo -n "*Content to be encoded*" | base64

Constraints:

The characters of both the pre-installation and post-installation scripts are centrally calculated, and the total number of characters after transcoding cannot exceed 10,240.

Options:

N/A

Default value:

N/A

alpha.cce/postInstall

String

Details:

Post-installation script.

The input value must be encoded using Base64. The method is as follows:

echo -n "*Content to be encoded*" | base64

Constraints:

The characters of both the pre-installation and post-installation scripts are centrally calculated, and the total number of characters after transcoding cannot exceed 10,240.

Options:

N/A

Default value:

N/A

alpha.cce/NodeImageID

String

Details:

This parameter is required when a custom image is used to create a BMS node.

Constraints:

None

Options:

N/A

Default value:

N/A

nicMultiqueue

String

Details:

  • Number of ENI queues. Example:

"[{\"queue\":4}]"

The following fields are included:

  • queue: number of ENI queues

  • Supported proportions are {"1":128, "2":92, "4":92, "8":32, "16":16, "28":9}. That is, if there is one queue, a maximum of 128 ENIs can be bound. If there are two queues, a maximum of 92 ENIs can be bound.

  • A larger number of ENI queues indicates higher performance but fewer ENIs can be bound. The queue settings cannot be changed after creation.

Constraints:

This field can be configured only for BMS nodes in CCE Turbo clusters.

Options:

N/A

Default value:

N/A

nicThreshold

String

Details:

  • ENI pre-binding thresholds. Example:

"0.3:0.6"
  • Low threshold (L): determines the minimum number of pre-bound ENIs (Min). Formula: Min = Total number of ENIs of the node × L

  • High threshold (H): determines the maximum number of pre-bound ENIs (Max). Formula: Max = Total number of ENIs of the node × H

  • Number of ENIs bound to a BMS node (B) and number of ENIs being used by pods (U): U + Min < B < U + Max

  • If the number of pre-bound ENIs on a BMS node is smaller than the minimum allowed, the system will bind more ENIs to make the numbers equal.

  • If the number of pre-bound ENIs on a BMS node is larger than the maximum allowed, the system periodically unbinds ENIs (about every 2 minutes) to make the numbers equal.

    Constraints:

  • This field can be configured only for BMS nodes in CCE Turbo clusters.

  • Pre-binding ENIs can speed up workload creation but occupies IP addresses.

Options:

Both the thresholds are one-decimal-place values ranging from 0.0 to 1.0. The low threshold must be smaller than or equal to the high one.

Default value:

N/A

chargingMode

Integer

Details:

Billing mode of a node. This parameter has been discarded. Use billingMode in NodeSpec instead.

Constraints:

None

Options:

N/A

Default value:

N/A

marketType

String

Details:

When creating a spot ECS, this parameter should be set to spot.

Constraints:

This parameter is valid only when billingMode is set to 0.

Options:

N/A

Default value:

N/A

spotPrice

String

Details:

The highest price per hour a user accepts for a spot ECS

Constraints:

  • This parameter takes effect only when billingMode is set to 0 and marketType is set to spot.

  • When billingMode is set to 0 and marketType is set to spot, if spotPrice is not specified, the pay-per-use price is used by default.

  • The spotPrice value must be less than or equal to the pay-per-use price and greater than or equal to the ECS market price.

Options:

N/A

Default value:

N/A

agency_name

String

Details:

Agency name.

An agency is created by a tenant administrator on Identity and Access Management (IAM) to provide temporary credentials for CCE nodes to access cloud servers.

This parameter is returned only when it is transferred during node creation.

Constraints:

None

Options:

N/A

Default value:

N/A

kubeReservedMem

Integer

Details:

Reserved node memory, which is reserved for Kubernetes components.

Constraints:

None

Options:

N/A

Default value:

N/A

systemReservedMem

Integer

Details:

Reserved node memory, which is reserved for system components.

Constraints:

None

Options:

N/A

Default value:

N/A

init-node-password

String

Details:

Node password. If this parameter is used as a response parameter, asterisks (*) will be displayed.

Constraints:

None

Options:

N/A

Default value:

N/A

Table 53 HostnameConfig

Parameter

Type

Description

type

String

Details:

Configuration type of the Kubernetes node name. The default value is privateIp.

Constraints:

  • The node names, Kubernetes node names, and VM names of the nodes configured with cceNodeName are the same. Node names cannot be changed. Once a VM name is altered on the ECS console, the node name cannot be modified accordingly during ECS synchronization.

  • To prevent conflicts between Kubernetes node names, a suffix is automatically added to the node name of a node configured with cceNodeName. The suffix consists of a hyphen (-) followed by five random lowercase letters and digits (0 to 9).

Options:

  • privateIp: Use the private node IP address the as the Kubernetes node name.

  • cceNodeName: Use the CCE node name as the Kubernetes node name.

Default value:

privateIp

Table 54 NodeStatus

Parameter

Type

Description

phase

String

Node status, which is the status of a node during its lifecycle (such as installation and uninstallation) and the status of a node in a Kubernetes cluster. Options:

  • Build: The node is being created.

  • Installing: The node is being installing.

  • Upgrading: The node is being upgraded.

  • Active: The node is running properly.

  • Abnormal: The node is abnormal.

  • Deleting: The node is being deleted.

  • Error: The node is faulty.

lastProbeTime

String

Last time when the node status was checked. If the cluster is in the abnormal, frozen, or intermediate state (for example, creating), the node status check may be affected. The node status that takes more than five minutes to check has no reference value.

jobID

String

ID of a creation or deletion job

serverId

String

ID of the underlying ECS or BMS node

privateIP

String

IP address in the private network segment of the primary NIC on the node

privateIPv6IP

String

IPv6 address in the private network segment of the primary NIC on the node

publicIP

String

Node EIP. If the ECS data is not synchronized in real time, you can click Sync Node Data on the console to manually update the data.

deleteStatus

DeleteStatus object

Resource status during resource deletion.

configurationUpToDate

Boolean

Whether the node configuration is consistent with the latest configuration of the node template in the node pool to which the node belongs. When a node pool's OS or runtime is updated, the existing nodes may have a different OS or runtime, causing configurationUpToDate to be false. However, resetting the nodes will synchronize their OSs and runtimes with the node pool, setting configurationUpToDate to true.

Table 55 DeleteStatus

Parameter

Type

Description

previous_total

Integer

Total number of existing cluster resource records when the cluster is deleted.

current_total

Integer

Latest number of resource records, which is generated based on the current cluster resource records.

updated

Integer

Total number of resource records updated when the cluster is deleted.

added

Integer

Total number of resource records updated when the cluster is deleted.

deleted

Integer

Total number of resource records deleted when the cluster is deleted.

Example Requests

  • Create a yearly/monthly node with the flavor of 2 vCPUs and 4 GiB of memory. The node runs EulerOS 2.5 for Docker containers. The sizes of the system disk and data disk of the node are 50 GB and 100 GB, respectively. Both the disks are of the high I/O type.

    POST /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes
    
    {
      "kind" : "Node",
      "apiVersion" : "v3",
      "metadata" : {
        "name" : "test-67235"
      },
      "spec" : {
        "flavor" : "c7.large.2",
        "az" : "******",
        "os" : "EulerOS 2.5",
        "dataVolumes" : [ {
          "size" : 100,
          "volumetype" : "SAS"
        } ],
        "billingMode" : 1,
        "extendParam" : {
          "maxPods" : 110,
          "periodType" : "month",
          "periodNum" : 1,
          "isAutoPay" : "false",
          "isAutoRenew" : "false"
        },
        "nodeNicSpec" : {
          "primaryNic" : {
            "subnetId" : "ca964acf-8468-4735-8229-97940ef6c881"
          }
        },
        "rootVolume" : {
          "size" : 50,
          "volumetype" : "SAS"
        },
        "runtime" : {
          "name" : "docker"
        },
        "login" : {
          "sshKey" : "KeyPair-001"
        },
        "storage" : {
          "storageSelectors" : [ {
            "name" : "cceUse",
            "storageType" : "evs",
            "matchLabels" : {
              "size" : "100",
              "volumeType" : "SAS",
              "count" : "1"
            }
          } ],
          "storageGroups" : [ {
            "name" : "vgpaas",
            "selectorNames" : [ "cceUse" ],
            "cceManaged" : true,
            "virtualSpaces" : [ {
              "name" : "runtime",
              "size" : "90%"
            }, {
              "name" : "kubernetes",
              "size" : "10%"
            } ]
          } ]
        },
        "count" : 1
      }
    }
  • Create a pay-per-use node with the flavor of 2 vCPUs and 4 GiB of memory. The node runs EulerOS 2.5 for Docker containers. The sizes of the system disk and data disk of the node are 50 GB and 100 GB, respectively. Both the disks are of the high I/O type.

    POST /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes
    
    {
      "kind" : "Node",
      "apiVersion" : "v3",
      "metadata" : {
        "name" : "test-83790"
      },
      "spec" : {
        "flavor" : "c7.large.2",
        "az" : "******",
        "os" : "EulerOS 2.5",
        "dataVolumes" : [ {
          "size" : 100,
          "volumetype" : "SAS"
        } ],
        "billingMode" : 0,
        "extendParam" : {
          "maxPods" : 110
        },
        "nodeNicSpec" : {
          "primaryNic" : {
            "subnetId" : "ca964acf-8468-4735-8229-97940ef6c881"
          }
        },
        "rootVolume" : {
          "size" : 50,
          "volumetype" : "SAS"
        },
        "runtime" : {
          "name" : "docker"
        },
        "login" : {
          "sshKey" : "KeyPair-001"
        },
        "storage" : {
          "storageSelectors" : [ {
            "name" : "cceUse",
            "storageType" : "evs",
            "matchLabels" : {
              "size" : "100",
              "volumeType" : "SAS",
              "count" : "1"
            }
          } ],
          "storageGroups" : [ {
            "name" : "vgpaas",
            "selectorNames" : [ "cceUse" ],
            "cceManaged" : true,
            "virtualSpaces" : [ {
              "name" : "runtime",
              "size" : "90%"
            }, {
              "name" : "kubernetes",
              "size" : "10%"
            } ]
          } ]
        },
        "count" : 1
      }
    }
  • Create a pay-per-usenode with the flavor of 2 vCPUs and 4 GiB of memory. The node runs Huawei Cloud EulerOS 2.0 and uses Docker. The sizes of the system disk and data disk of the node are 50 GB and 100 GB, respectively. The data disk uses the shared disk space mode.

    POST /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes
    
    {
      "kind" : "Node",
      "apiVersion" : "v3",
      "metadata" : {
        "name" : "test-66909"
      },
      "spec" : {
        "flavor" : "c7.large.2",
        "az" : "******",
        "os" : "Huawei Cloud EulerOS 2.0",
        "dataVolumes" : [ {
          "size" : 100,
          "volumetype" : "SAS"
        } ],
        "billingMode" : 0,
        "extendParam" : {
          "maxPods" : 110
        },
        "nodeNicSpec" : {
          "primaryNic" : {
            "subnetId" : "ca964acf-8468-4735-8229-97940ef6c881"
          }
        },
        "rootVolume" : {
          "size" : 50,
          "volumetype" : "SAS"
        },
        "runtime" : {
          "name" : "docker"
        },
        "login" : {
          "sshKey" : "KeyPair-001"
        },
        "storage" : {
          "storageSelectors" : [ {
            "name" : "cceUse",
            "storageType" : "evs",
            "matchLabels" : {
              "size" : "100",
              "volumeType" : "SAS",
              "count" : "1"
            }
          } ],
          "storageGroups" : [ {
            "name" : "vgpaas",
            "selectorNames" : [ "cceUse" ],
            "cceManaged" : true,
            "virtualSpaces" : [ {
              "name" : "share",
              "size" : "100%"
            } ]
          } ]
        },
        "count" : 1
      }
    }

Example Responses

Status code: 201

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

{
  "kind" : "Node",
  "apiVersion" : "v3",
  "metadata" : {
    "name" : "test-83790",
    "uid" : "5ecfddfe-87db-11ec-b5e5-0255ac101514",
    "annotations" : {
      "jobid" : "5ec1518c-87db-11ec-b5e5-0255ac101514",
      "resourceJobId" : "5ed0d692-87db-11ec-b5e5-0255ac101514"
    }
  },
  "spec" : {
    "flavor" : "c7.large.2",
    "az" : "******",
    "os" : "EulerOS 2.5",
    "login" : {
      "sshKey" : "KeyPair-001"
    },
    "rootVolume" : {
      "volumetype" : "SAS",
      "size" : 50
    },
    "dataVolumes" : [ {
      "volumetype" : "SAS",
      "size" : 100
    } ],
    "storage" : {
      "storageSelectors" : [ {
        "name" : "cceUse",
        "storageType" : "evs",
        "matchLabels" : {
          "count" : "1",
          "size" : "100",
          "volumeType" : "SAS"
        }
      } ],
      "storageGroups" : [ {
        "name" : "vgpaas",
        "cceManaged" : true,
        "selectorNames" : [ "cceUse" ],
        "virtualSpaces" : [ {
          "name" : "runtime",
          "size" : "90%"
        }, {
          "name" : "kubernetes",
          "size" : "10%"
        } ]
      } ]
    },
    "publicIP" : {
      "eip" : {
        "bandwidth" : { }
      }
    },
    "nodeNicSpec" : {
      "primaryNic" : {
        "subnetId" : "ca964acf-8468-4735-8229-97940ef6c881"
      }
    },
    "count" : 1,
    "billingMode" : 0,
    "runtime" : {
      "name" : "docker"
    },
    "extendParam" : {
      "chargingMode" : 0,
      "ecs:performancetype" : "computingv3",
      "init-node-password" : "******",
      "maxPods" : 110,
      "publicKey" : ""
    }
  },
  "status" : {
    "jobID" : "5ec1518c-87db-11ec-b5e5-0255ac101514"
  }
}

SDK Sample Code

The SDK sample code is as follows.

  • Create a yearly/monthly node with the flavor of 2 vCPUs and 4 GiB of memory. The node runs EulerOS 2.5 for Docker containers. The sizes of the system disk and data disk of the node are 50 GB and 100 GB, respectively. Both the disks are of the high I/O type.

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.cce.v3.region.CceRegion;
    import com.huaweicloud.sdk.cce.v3.*;
    import com.huaweicloud.sdk.cce.v3.model.*;
    import com.huaweicloud.sdk.cce.v3.model.Runtime;
    
    import java.util.List;
    import java.util.ArrayList;
    
    public class CreateNodeSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            CceClient client = CceClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(CceRegion.valueOf("<YOUR REGION>"))
                    .build();
            CreateNodeRequest request = new CreateNodeRequest();
            request.withClusterId("{cluster_id}");
            NodeCreateRequest body = new NodeCreateRequest();
            NodeExtendParam extendParamSpec = new NodeExtendParam();
            extendParamSpec.withMaxPods(110)
                .withPeriodType("month")
                .withPeriodNum(1)
                .withIsAutoRenew("false")
                .withIsAutoPay("false");
            Runtime runtimeSpec = new Runtime();
            runtimeSpec.withName(Runtime.NameEnum.fromValue("docker"));
            NicSpec primaryNicNodeNicSpec = new NicSpec();
            primaryNicNodeNicSpec.withSubnetId("ca964acf-8468-4735-8229-97940ef6c881");
            NodeNicSpec nodeNicSpecSpec = new NodeNicSpec();
            nodeNicSpecSpec.withPrimaryNic(primaryNicNodeNicSpec);
            List<VirtualSpace> listStorageGroupsVirtualSpaces = new ArrayList<>();
            listStorageGroupsVirtualSpaces.add(
                new VirtualSpace()
                    .withName("runtime")
                    .withSize("90%")
            );
            listStorageGroupsVirtualSpaces.add(
                new VirtualSpace()
                    .withName("kubernetes")
                    .withSize("10%")
            );
            List<String> listStorageGroupsSelectorNames = new ArrayList<>();
            listStorageGroupsSelectorNames.add("cceUse");
            List<StorageGroups> listStorageStorageGroups = new ArrayList<>();
            listStorageStorageGroups.add(
                new StorageGroups()
                    .withName("vgpaas")
                    .withCceManaged(true)
                    .withSelectorNames(listStorageGroupsSelectorNames)
                    .withVirtualSpaces(listStorageGroupsVirtualSpaces)
            );
            StorageSelectorsMatchLabels matchLabelsStorageSelectors = new StorageSelectorsMatchLabels();
            matchLabelsStorageSelectors.withSize("100")
                .withVolumeType("SAS")
                .withCount("1");
            List<StorageSelectors> listStorageStorageSelectors = new ArrayList<>();
            listStorageStorageSelectors.add(
                new StorageSelectors()
                    .withName("cceUse")
                    .withStorageType("evs")
                    .withMatchLabels(matchLabelsStorageSelectors)
            );
            Storage storageSpec = new Storage();
            storageSpec.withStorageSelectors(listStorageStorageSelectors)
                .withStorageGroups(listStorageStorageGroups);
            List<Volume> listSpecDataVolumes = new ArrayList<>();
            listSpecDataVolumes.add(
                new Volume()
                    .withSize(100)
                    .withVolumetype("SAS")
            );
            Volume rootVolumeSpec = new Volume();
            rootVolumeSpec.withSize(50)
                .withVolumetype("SAS");
            Login loginSpec = new Login();
            loginSpec.withSshKey("KeyPair-001");
            NodeSpec specbody = new NodeSpec();
            specbody.withFlavor("c7.large.2")
                .withAz("******")
                .withOs("EulerOS 2.5")
                .withLogin(loginSpec)
                .withRootVolume(rootVolumeSpec)
                .withDataVolumes(listSpecDataVolumes)
                .withStorage(storageSpec)
                .withNodeNicSpec(nodeNicSpecSpec)
                .withCount(1)
                .withBillingMode(1)
                .withRuntime(runtimeSpec)
                .withExtendParam(extendParamSpec);
            NodeMetadata metadatabody = new NodeMetadata();
            metadatabody.withName("test-67235");
            body.withSpec(specbody);
            body.withMetadata(metadatabody);
            body.withApiVersion("v3");
            body.withKind("Node");
            request.withBody(body);
            try {
                CreateNodeResponse response = client.createNode(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • Create a pay-per-use node with the flavor of 2 vCPUs and 4 GiB of memory. The node runs EulerOS 2.5 for Docker containers. The sizes of the system disk and data disk of the node are 50 GB and 100 GB, respectively. Both the disks are of the high I/O type.

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.cce.v3.region.CceRegion;
    import com.huaweicloud.sdk.cce.v3.*;
    import com.huaweicloud.sdk.cce.v3.model.*;
    import com.huaweicloud.sdk.cce.v3.model.Runtime;
    
    import java.util.List;
    import java.util.ArrayList;
    
    public class CreateNodeSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            CceClient client = CceClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(CceRegion.valueOf("<YOUR REGION>"))
                    .build();
            CreateNodeRequest request = new CreateNodeRequest();
            request.withClusterId("{cluster_id}");
            NodeCreateRequest body = new NodeCreateRequest();
            NodeExtendParam extendParamSpec = new NodeExtendParam();
            extendParamSpec.withMaxPods(110);
            Runtime runtimeSpec = new Runtime();
            runtimeSpec.withName(Runtime.NameEnum.fromValue("docker"));
            NicSpec primaryNicNodeNicSpec = new NicSpec();
            primaryNicNodeNicSpec.withSubnetId("ca964acf-8468-4735-8229-97940ef6c881");
            NodeNicSpec nodeNicSpecSpec = new NodeNicSpec();
            nodeNicSpecSpec.withPrimaryNic(primaryNicNodeNicSpec);
            List<VirtualSpace> listStorageGroupsVirtualSpaces = new ArrayList<>();
            listStorageGroupsVirtualSpaces.add(
                new VirtualSpace()
                    .withName("runtime")
                    .withSize("90%")
            );
            listStorageGroupsVirtualSpaces.add(
                new VirtualSpace()
                    .withName("kubernetes")
                    .withSize("10%")
            );
            List<String> listStorageGroupsSelectorNames = new ArrayList<>();
            listStorageGroupsSelectorNames.add("cceUse");
            List<StorageGroups> listStorageStorageGroups = new ArrayList<>();
            listStorageStorageGroups.add(
                new StorageGroups()
                    .withName("vgpaas")
                    .withCceManaged(true)
                    .withSelectorNames(listStorageGroupsSelectorNames)
                    .withVirtualSpaces(listStorageGroupsVirtualSpaces)
            );
            StorageSelectorsMatchLabels matchLabelsStorageSelectors = new StorageSelectorsMatchLabels();
            matchLabelsStorageSelectors.withSize("100")
                .withVolumeType("SAS")
                .withCount("1");
            List<StorageSelectors> listStorageStorageSelectors = new ArrayList<>();
            listStorageStorageSelectors.add(
                new StorageSelectors()
                    .withName("cceUse")
                    .withStorageType("evs")
                    .withMatchLabels(matchLabelsStorageSelectors)
            );
            Storage storageSpec = new Storage();
            storageSpec.withStorageSelectors(listStorageStorageSelectors)
                .withStorageGroups(listStorageStorageGroups);
            List<Volume> listSpecDataVolumes = new ArrayList<>();
            listSpecDataVolumes.add(
                new Volume()
                    .withSize(100)
                    .withVolumetype("SAS")
            );
            Volume rootVolumeSpec = new Volume();
            rootVolumeSpec.withSize(50)
                .withVolumetype("SAS");
            Login loginSpec = new Login();
            loginSpec.withSshKey("KeyPair-001");
            NodeSpec specbody = new NodeSpec();
            specbody.withFlavor("c7.large.2")
                .withAz("******")
                .withOs("EulerOS 2.5")
                .withLogin(loginSpec)
                .withRootVolume(rootVolumeSpec)
                .withDataVolumes(listSpecDataVolumes)
                .withStorage(storageSpec)
                .withNodeNicSpec(nodeNicSpecSpec)
                .withCount(1)
                .withBillingMode(0)
                .withRuntime(runtimeSpec)
                .withExtendParam(extendParamSpec);
            NodeMetadata metadatabody = new NodeMetadata();
            metadatabody.withName("test-83790");
            body.withSpec(specbody);
            body.withMetadata(metadatabody);
            body.withApiVersion("v3");
            body.withKind("Node");
            request.withBody(body);
            try {
                CreateNodeResponse response = client.createNode(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • Create a pay-per-usenode with the flavor of 2 vCPUs and 4 GiB of memory. The node runs Huawei Cloud EulerOS 2.0 and uses Docker. The sizes of the system disk and data disk of the node are 50 GB and 100 GB, respectively. The data disk uses the shared disk space mode.

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    package com.huaweicloud.sdk.test;
    
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.auth.BasicCredentials;
    import com.huaweicloud.sdk.core.exception.ConnectionException;
    import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
    import com.huaweicloud.sdk.core.exception.ServiceResponseException;
    import com.huaweicloud.sdk.cce.v3.region.CceRegion;
    import com.huaweicloud.sdk.cce.v3.*;
    import com.huaweicloud.sdk.cce.v3.model.*;
    import com.huaweicloud.sdk.cce.v3.model.Runtime;
    
    import java.util.List;
    import java.util.ArrayList;
    
    public class CreateNodeSolution {
    
        public static void main(String[] args) {
            // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
            // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
            String ak = System.getenv("CLOUD_SDK_AK");
            String sk = System.getenv("CLOUD_SDK_SK");
            String projectId = "{project_id}";
    
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
    
            CceClient client = CceClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(CceRegion.valueOf("<YOUR REGION>"))
                    .build();
            CreateNodeRequest request = new CreateNodeRequest();
            request.withClusterId("{cluster_id}");
            NodeCreateRequest body = new NodeCreateRequest();
            NodeExtendParam extendParamSpec = new NodeExtendParam();
            extendParamSpec.withMaxPods(110);
            Runtime runtimeSpec = new Runtime();
            runtimeSpec.withName(Runtime.NameEnum.fromValue("docker"));
            NicSpec primaryNicNodeNicSpec = new NicSpec();
            primaryNicNodeNicSpec.withSubnetId("ca964acf-8468-4735-8229-97940ef6c881");
            NodeNicSpec nodeNicSpecSpec = new NodeNicSpec();
            nodeNicSpecSpec.withPrimaryNic(primaryNicNodeNicSpec);
            List<VirtualSpace> listStorageGroupsVirtualSpaces = new ArrayList<>();
            listStorageGroupsVirtualSpaces.add(
                new VirtualSpace()
                    .withName("share")
                    .withSize("100%")
            );
            List<String> listStorageGroupsSelectorNames = new ArrayList<>();
            listStorageGroupsSelectorNames.add("cceUse");
            List<StorageGroups> listStorageStorageGroups = new ArrayList<>();
            listStorageStorageGroups.add(
                new StorageGroups()
                    .withName("vgpaas")
                    .withCceManaged(true)
                    .withSelectorNames(listStorageGroupsSelectorNames)
                    .withVirtualSpaces(listStorageGroupsVirtualSpaces)
            );
            StorageSelectorsMatchLabels matchLabelsStorageSelectors = new StorageSelectorsMatchLabels();
            matchLabelsStorageSelectors.withSize("100")
                .withVolumeType("SAS")
                .withCount("1");
            List<StorageSelectors> listStorageStorageSelectors = new ArrayList<>();
            listStorageStorageSelectors.add(
                new StorageSelectors()
                    .withName("cceUse")
                    .withStorageType("evs")
                    .withMatchLabels(matchLabelsStorageSelectors)
            );
            Storage storageSpec = new Storage();
            storageSpec.withStorageSelectors(listStorageStorageSelectors)
                .withStorageGroups(listStorageStorageGroups);
            List<Volume> listSpecDataVolumes = new ArrayList<>();
            listSpecDataVolumes.add(
                new Volume()
                    .withSize(100)
                    .withVolumetype("SAS")
            );
            Volume rootVolumeSpec = new Volume();
            rootVolumeSpec.withSize(50)
                .withVolumetype("SAS");
            Login loginSpec = new Login();
            loginSpec.withSshKey("KeyPair-001");
            NodeSpec specbody = new NodeSpec();
            specbody.withFlavor("c7.large.2")
                .withAz("******")
                .withOs("Huawei Cloud EulerOS 2.0")
                .withLogin(loginSpec)
                .withRootVolume(rootVolumeSpec)
                .withDataVolumes(listSpecDataVolumes)
                .withStorage(storageSpec)
                .withNodeNicSpec(nodeNicSpecSpec)
                .withCount(1)
                .withBillingMode(0)
                .withRuntime(runtimeSpec)
                .withExtendParam(extendParamSpec);
            NodeMetadata metadatabody = new NodeMetadata();
            metadatabody.withName("test-66909");
            body.withSpec(specbody);
            body.withMetadata(metadatabody);
            body.withApiVersion("v3");
            body.withKind("Node");
            request.withBody(body);
            try {
                CreateNodeResponse response = client.createNode(request);
                System.out.println(response.toString());
            } catch (ConnectionException e) {
                e.printStackTrace();
            } catch (RequestTimeoutException e) {
                e.printStackTrace();
            } catch (ServiceResponseException e) {
                e.printStackTrace();
                System.out.println(e.getHttpStatusCode());
                System.out.println(e.getRequestId());
                System.out.println(e.getErrorCode());
                System.out.println(e.getErrorMsg());
            }
        }
    }
    
  • Create a yearly/monthly node with the flavor of 2 vCPUs and 4 GiB of memory. The node runs EulerOS 2.5 for Docker containers. The sizes of the system disk and data disk of the node are 50 GB and 100 GB, respectively. Both the disks are of the high I/O type.

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdkcce.v3.region.cce_region import CceRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdkcce.v3 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = CceClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(CceRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = CreateNodeRequest()
            request.cluster_id = "{cluster_id}"
            extendParamSpec = NodeExtendParam(
                max_pods=110,
                period_type="month",
                period_num=1,
                is_auto_renew="false",
                is_auto_pay="false"
            )
            runtimeSpec = Runtime(
                name="docker"
            )
            primaryNicNodeNicSpec = NicSpec(
                subnet_id="ca964acf-8468-4735-8229-97940ef6c881"
            )
            nodeNicSpecSpec = NodeNicSpec(
                primary_nic=primaryNicNodeNicSpec
            )
            listVirtualSpacesStorageGroups = [
                VirtualSpace(
                    name="runtime",
                    size="90%"
                ),
                VirtualSpace(
                    name="kubernetes",
                    size="10%"
                )
            ]
            listSelectorNamesStorageGroups = [
                "cceUse"
            ]
            listStorageGroupsStorage = [
                StorageGroups(
                    name="vgpaas",
                    cce_managed=True,
                    selector_names=listSelectorNamesStorageGroups,
                    virtual_spaces=listVirtualSpacesStorageGroups
                )
            ]
            matchLabelsStorageSelectors = StorageSelectorsMatchLabels(
                size="100",
                volume_type="SAS",
                count="1"
            )
            listStorageSelectorsStorage = [
                StorageSelectors(
                    name="cceUse",
                    storage_type="evs",
                    match_labels=matchLabelsStorageSelectors
                )
            ]
            storageSpec = Storage(
                storage_selectors=listStorageSelectorsStorage,
                storage_groups=listStorageGroupsStorage
            )
            listDataVolumesSpec = [
                Volume(
                    size=100,
                    volumetype="SAS"
                )
            ]
            rootVolumeSpec = Volume(
                size=50,
                volumetype="SAS"
            )
            loginSpec = Login(
                ssh_key="KeyPair-001"
            )
            specbody = NodeSpec(
                flavor="c7.large.2",
                az="******",
                os="EulerOS 2.5",
                login=loginSpec,
                root_volume=rootVolumeSpec,
                data_volumes=listDataVolumesSpec,
                storage=storageSpec,
                node_nic_spec=nodeNicSpecSpec,
                count=1,
                billing_mode=1,
                runtime=runtimeSpec,
                extend_param=extendParamSpec
            )
            metadatabody = NodeMetadata(
                name="test-67235"
            )
            request.body = NodeCreateRequest(
                spec=specbody,
                metadata=metadatabody,
                api_version="v3",
                kind="Node"
            )
            response = client.create_node(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • Create a pay-per-use node with the flavor of 2 vCPUs and 4 GiB of memory. The node runs EulerOS 2.5 for Docker containers. The sizes of the system disk and data disk of the node are 50 GB and 100 GB, respectively. Both the disks are of the high I/O type.

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdkcce.v3.region.cce_region import CceRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdkcce.v3 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = CceClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(CceRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = CreateNodeRequest()
            request.cluster_id = "{cluster_id}"
            extendParamSpec = NodeExtendParam(
                max_pods=110
            )
            runtimeSpec = Runtime(
                name="docker"
            )
            primaryNicNodeNicSpec = NicSpec(
                subnet_id="ca964acf-8468-4735-8229-97940ef6c881"
            )
            nodeNicSpecSpec = NodeNicSpec(
                primary_nic=primaryNicNodeNicSpec
            )
            listVirtualSpacesStorageGroups = [
                VirtualSpace(
                    name="runtime",
                    size="90%"
                ),
                VirtualSpace(
                    name="kubernetes",
                    size="10%"
                )
            ]
            listSelectorNamesStorageGroups = [
                "cceUse"
            ]
            listStorageGroupsStorage = [
                StorageGroups(
                    name="vgpaas",
                    cce_managed=True,
                    selector_names=listSelectorNamesStorageGroups,
                    virtual_spaces=listVirtualSpacesStorageGroups
                )
            ]
            matchLabelsStorageSelectors = StorageSelectorsMatchLabels(
                size="100",
                volume_type="SAS",
                count="1"
            )
            listStorageSelectorsStorage = [
                StorageSelectors(
                    name="cceUse",
                    storage_type="evs",
                    match_labels=matchLabelsStorageSelectors
                )
            ]
            storageSpec = Storage(
                storage_selectors=listStorageSelectorsStorage,
                storage_groups=listStorageGroupsStorage
            )
            listDataVolumesSpec = [
                Volume(
                    size=100,
                    volumetype="SAS"
                )
            ]
            rootVolumeSpec = Volume(
                size=50,
                volumetype="SAS"
            )
            loginSpec = Login(
                ssh_key="KeyPair-001"
            )
            specbody = NodeSpec(
                flavor="c7.large.2",
                az="******",
                os="EulerOS 2.5",
                login=loginSpec,
                root_volume=rootVolumeSpec,
                data_volumes=listDataVolumesSpec,
                storage=storageSpec,
                node_nic_spec=nodeNicSpecSpec,
                count=1,
                billing_mode=0,
                runtime=runtimeSpec,
                extend_param=extendParamSpec
            )
            metadatabody = NodeMetadata(
                name="test-83790"
            )
            request.body = NodeCreateRequest(
                spec=specbody,
                metadata=metadatabody,
                api_version="v3",
                kind="Node"
            )
            response = client.create_node(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • Create a pay-per-usenode with the flavor of 2 vCPUs and 4 GiB of memory. The node runs Huawei Cloud EulerOS 2.0 and uses Docker. The sizes of the system disk and data disk of the node are 50 GB and 100 GB, respectively. The data disk uses the shared disk space mode.

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    # coding: utf-8
    
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdkcce.v3.region.cce_region import CceRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdkcce.v3 import *
    
    if __name__ == "__main__":
        # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak = os.environ["CLOUD_SDK_AK"]
        sk = os.environ["CLOUD_SDK_SK"]
        projectId = "{project_id}"
    
        credentials = BasicCredentials(ak, sk, projectId)
    
        client = CceClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(CceRegion.value_of("<YOUR REGION>")) \
            .build()
    
        try:
            request = CreateNodeRequest()
            request.cluster_id = "{cluster_id}"
            extendParamSpec = NodeExtendParam(
                max_pods=110
            )
            runtimeSpec = Runtime(
                name="docker"
            )
            primaryNicNodeNicSpec = NicSpec(
                subnet_id="ca964acf-8468-4735-8229-97940ef6c881"
            )
            nodeNicSpecSpec = NodeNicSpec(
                primary_nic=primaryNicNodeNicSpec
            )
            listVirtualSpacesStorageGroups = [
                VirtualSpace(
                    name="share",
                    size="100%"
                )
            ]
            listSelectorNamesStorageGroups = [
                "cceUse"
            ]
            listStorageGroupsStorage = [
                StorageGroups(
                    name="vgpaas",
                    cce_managed=True,
                    selector_names=listSelectorNamesStorageGroups,
                    virtual_spaces=listVirtualSpacesStorageGroups
                )
            ]
            matchLabelsStorageSelectors = StorageSelectorsMatchLabels(
                size="100",
                volume_type="SAS",
                count="1"
            )
            listStorageSelectorsStorage = [
                StorageSelectors(
                    name="cceUse",
                    storage_type="evs",
                    match_labels=matchLabelsStorageSelectors
                )
            ]
            storageSpec = Storage(
                storage_selectors=listStorageSelectorsStorage,
                storage_groups=listStorageGroupsStorage
            )
            listDataVolumesSpec = [
                Volume(
                    size=100,
                    volumetype="SAS"
                )
            ]
            rootVolumeSpec = Volume(
                size=50,
                volumetype="SAS"
            )
            loginSpec = Login(
                ssh_key="KeyPair-001"
            )
            specbody = NodeSpec(
                flavor="c7.large.2",
                az="******",
                os="Huawei Cloud EulerOS 2.0",
                login=loginSpec,
                root_volume=rootVolumeSpec,
                data_volumes=listDataVolumesSpec,
                storage=storageSpec,
                node_nic_spec=nodeNicSpecSpec,
                count=1,
                billing_mode=0,
                runtime=runtimeSpec,
                extend_param=extendParamSpec
            )
            metadatabody = NodeMetadata(
                name="test-66909"
            )
            request.body = NodeCreateRequest(
                spec=specbody,
                metadata=metadatabody,
                api_version="v3",
                kind="Node"
            )
            response = client.create_node(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • Create a yearly/monthly node with the flavor of 2 vCPUs and 4 GiB of memory. The node runs EulerOS 2.5 for Docker containers. The sizes of the system disk and data disk of the node are 50 GB and 100 GB, respectively. Both the disks are of the high I/O type.

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        cce "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cce/v3"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cce/v3/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cce/v3/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := cce.NewCceClient(
            cce.CceClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.CreateNodeRequest{}
    	request.ClusterId = "{cluster_id}"
    	maxPodsExtendParam:= int32(110)
    	periodTypeExtendParam:= "month"
    	periodNumExtendParam:= int32(1)
    	isAutoRenewExtendParam:= "false"
    	isAutoPayExtendParam:= "false"
    	extendParamSpec := &model.NodeExtendParam{
    		MaxPods: &maxPodsExtendParam,
    		PeriodType: &periodTypeExtendParam,
    		PeriodNum: &periodNumExtendParam,
    		IsAutoRenew: &isAutoRenewExtendParam,
    		IsAutoPay: &isAutoPayExtendParam,
    	}
    	nameRuntime:= model.GetRuntimeNameEnum().DOCKER
    	runtimeSpec := &model.Runtime{
    		Name: &nameRuntime,
    	}
    	subnetIdPrimaryNic:= "ca964acf-8468-4735-8229-97940ef6c881"
    	primaryNicNodeNicSpec := &model.NicSpec{
    		SubnetId: &subnetIdPrimaryNic,
    	}
    	nodeNicSpecSpec := &model.NodeNicSpec{
    		PrimaryNic: primaryNicNodeNicSpec,
    	}
    	var listVirtualSpacesStorageGroups = []model.VirtualSpace{
            {
                Name: "runtime",
                Size: "90%",
            },
            {
                Name: "kubernetes",
                Size: "10%",
            },
        }
    	var listSelectorNamesStorageGroups = []string{
            "cceUse",
        }
    	cceManagedStorageGroups:= true
    	var listStorageGroupsStorage = []model.StorageGroups{
            {
                Name: "vgpaas",
                CceManaged: &cceManagedStorageGroups,
                SelectorNames: listSelectorNamesStorageGroups,
                VirtualSpaces: listVirtualSpacesStorageGroups,
            },
        }
    	sizeMatchLabels:= "100"
    	volumeTypeMatchLabels:= "SAS"
    	countMatchLabels:= "1"
    	matchLabelsStorageSelectors := &model.StorageSelectorsMatchLabels{
    		Size: &sizeMatchLabels,
    		VolumeType: &volumeTypeMatchLabels,
    		Count: &countMatchLabels,
    	}
    	var listStorageSelectorsStorage = []model.StorageSelectors{
            {
                Name: "cceUse",
                StorageType: "evs",
                MatchLabels: matchLabelsStorageSelectors,
            },
        }
    	storageSpec := &model.Storage{
    		StorageSelectors: listStorageSelectorsStorage,
    		StorageGroups: listStorageGroupsStorage,
    	}
    	var listDataVolumesSpec = []model.Volume{
            {
                Size: int32(100),
                Volumetype: "SAS",
            },
        }
    	rootVolumeSpec := &model.Volume{
    		Size: int32(50),
    		Volumetype: "SAS",
    	}
    	sshKeyLogin:= "KeyPair-001"
    	loginSpec := &model.Login{
    		SshKey: &sshKeyLogin,
    	}
    	osSpec:= "EulerOS 2.5"
    	countSpec:= int32(1)
    	billingModeSpec:= int32(1)
    	specbody := &model.NodeSpec{
    		Flavor: "c7.large.2",
    		Az: "******",
    		Os: &osSpec,
    		Login: loginSpec,
    		RootVolume: rootVolumeSpec,
    		DataVolumes: listDataVolumesSpec,
    		Storage: storageSpec,
    		NodeNicSpec: nodeNicSpecSpec,
    		Count: &countSpec,
    		BillingMode: &billingModeSpec,
    		Runtime: runtimeSpec,
    		ExtendParam: extendParamSpec,
    	}
    	nameMetadata:= "test-67235"
    	metadatabody := &model.NodeMetadata{
    		Name: &nameMetadata,
    	}
    	request.Body = &model.NodeCreateRequest{
    		Spec: specbody,
    		Metadata: metadatabody,
    		ApiVersion: "v3",
    		Kind: "Node",
    	}
    	response, err := client.CreateNode(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • Create a pay-per-use node with the flavor of 2 vCPUs and 4 GiB of memory. The node runs EulerOS 2.5 for Docker containers. The sizes of the system disk and data disk of the node are 50 GB and 100 GB, respectively. Both the disks are of the high I/O type.

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        cce "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cce/v3"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cce/v3/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cce/v3/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := cce.NewCceClient(
            cce.CceClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.CreateNodeRequest{}
    	request.ClusterId = "{cluster_id}"
    	maxPodsExtendParam:= int32(110)
    	extendParamSpec := &model.NodeExtendParam{
    		MaxPods: &maxPodsExtendParam,
    	}
    	nameRuntime:= model.GetRuntimeNameEnum().DOCKER
    	runtimeSpec := &model.Runtime{
    		Name: &nameRuntime,
    	}
    	subnetIdPrimaryNic:= "ca964acf-8468-4735-8229-97940ef6c881"
    	primaryNicNodeNicSpec := &model.NicSpec{
    		SubnetId: &subnetIdPrimaryNic,
    	}
    	nodeNicSpecSpec := &model.NodeNicSpec{
    		PrimaryNic: primaryNicNodeNicSpec,
    	}
    	var listVirtualSpacesStorageGroups = []model.VirtualSpace{
            {
                Name: "runtime",
                Size: "90%",
            },
            {
                Name: "kubernetes",
                Size: "10%",
            },
        }
    	var listSelectorNamesStorageGroups = []string{
            "cceUse",
        }
    	cceManagedStorageGroups:= true
    	var listStorageGroupsStorage = []model.StorageGroups{
            {
                Name: "vgpaas",
                CceManaged: &cceManagedStorageGroups,
                SelectorNames: listSelectorNamesStorageGroups,
                VirtualSpaces: listVirtualSpacesStorageGroups,
            },
        }
    	sizeMatchLabels:= "100"
    	volumeTypeMatchLabels:= "SAS"
    	countMatchLabels:= "1"
    	matchLabelsStorageSelectors := &model.StorageSelectorsMatchLabels{
    		Size: &sizeMatchLabels,
    		VolumeType: &volumeTypeMatchLabels,
    		Count: &countMatchLabels,
    	}
    	var listStorageSelectorsStorage = []model.StorageSelectors{
            {
                Name: "cceUse",
                StorageType: "evs",
                MatchLabels: matchLabelsStorageSelectors,
            },
        }
    	storageSpec := &model.Storage{
    		StorageSelectors: listStorageSelectorsStorage,
    		StorageGroups: listStorageGroupsStorage,
    	}
    	var listDataVolumesSpec = []model.Volume{
            {
                Size: int32(100),
                Volumetype: "SAS",
            },
        }
    	rootVolumeSpec := &model.Volume{
    		Size: int32(50),
    		Volumetype: "SAS",
    	}
    	sshKeyLogin:= "KeyPair-001"
    	loginSpec := &model.Login{
    		SshKey: &sshKeyLogin,
    	}
    	osSpec:= "EulerOS 2.5"
    	countSpec:= int32(1)
    	billingModeSpec:= int32(0)
    	specbody := &model.NodeSpec{
    		Flavor: "c7.large.2",
    		Az: "******",
    		Os: &osSpec,
    		Login: loginSpec,
    		RootVolume: rootVolumeSpec,
    		DataVolumes: listDataVolumesSpec,
    		Storage: storageSpec,
    		NodeNicSpec: nodeNicSpecSpec,
    		Count: &countSpec,
    		BillingMode: &billingModeSpec,
    		Runtime: runtimeSpec,
    		ExtendParam: extendParamSpec,
    	}
    	nameMetadata:= "test-83790"
    	metadatabody := &model.NodeMetadata{
    		Name: &nameMetadata,
    	}
    	request.Body = &model.NodeCreateRequest{
    		Spec: specbody,
    		Metadata: metadatabody,
    		ApiVersion: "v3",
    		Kind: "Node",
    	}
    	response, err := client.CreateNode(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • Create a pay-per-usenode with the flavor of 2 vCPUs and 4 GiB of memory. The node runs Huawei Cloud EulerOS 2.0 and uses Docker. The sizes of the system disk and data disk of the node are 50 GB and 100 GB, respectively. The data disk uses the shared disk space mode.

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    package main
    
    import (
    	"fmt"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        cce "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cce/v3"
    	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cce/v3/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cce/v3/region"
    )
    
    func main() {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        ak := os.Getenv("CLOUD_SDK_AK")
        sk := os.Getenv("CLOUD_SDK_SK")
        projectId := "{project_id}"
    
        auth := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            Build()
    
        client := cce.NewCceClient(
            cce.CceClientBuilder().
                WithRegion(region.ValueOf("<YOUR REGION>")).
                WithCredential(auth).
                Build())
    
        request := &model.CreateNodeRequest{}
    	request.ClusterId = "{cluster_id}"
    	maxPodsExtendParam:= int32(110)
    	extendParamSpec := &model.NodeExtendParam{
    		MaxPods: &maxPodsExtendParam,
    	}
    	nameRuntime:= model.GetRuntimeNameEnum().DOCKER
    	runtimeSpec := &model.Runtime{
    		Name: &nameRuntime,
    	}
    	subnetIdPrimaryNic:= "ca964acf-8468-4735-8229-97940ef6c881"
    	primaryNicNodeNicSpec := &model.NicSpec{
    		SubnetId: &subnetIdPrimaryNic,
    	}
    	nodeNicSpecSpec := &model.NodeNicSpec{
    		PrimaryNic: primaryNicNodeNicSpec,
    	}
    	var listVirtualSpacesStorageGroups = []model.VirtualSpace{
            {
                Name: "share",
                Size: "100%",
            },
        }
    	var listSelectorNamesStorageGroups = []string{
            "cceUse",
        }
    	cceManagedStorageGroups:= true
    	var listStorageGroupsStorage = []model.StorageGroups{
            {
                Name: "vgpaas",
                CceManaged: &cceManagedStorageGroups,
                SelectorNames: listSelectorNamesStorageGroups,
                VirtualSpaces: listVirtualSpacesStorageGroups,
            },
        }
    	sizeMatchLabels:= "100"
    	volumeTypeMatchLabels:= "SAS"
    	countMatchLabels:= "1"
    	matchLabelsStorageSelectors := &model.StorageSelectorsMatchLabels{
    		Size: &sizeMatchLabels,
    		VolumeType: &volumeTypeMatchLabels,
    		Count: &countMatchLabels,
    	}
    	var listStorageSelectorsStorage = []model.StorageSelectors{
            {
                Name: "cceUse",
                StorageType: "evs",
                MatchLabels: matchLabelsStorageSelectors,
            },
        }
    	storageSpec := &model.Storage{
    		StorageSelectors: listStorageSelectorsStorage,
    		StorageGroups: listStorageGroupsStorage,
    	}
    	var listDataVolumesSpec = []model.Volume{
            {
                Size: int32(100),
                Volumetype: "SAS",
            },
        }
    	rootVolumeSpec := &model.Volume{
    		Size: int32(50),
    		Volumetype: "SAS",
    	}
    	sshKeyLogin:= "KeyPair-001"
    	loginSpec := &model.Login{
    		SshKey: &sshKeyLogin,
    	}
    	osSpec:= "Huawei Cloud EulerOS 2.0"
    	countSpec:= int32(1)
    	billingModeSpec:= int32(0)
    	specbody := &model.NodeSpec{
    		Flavor: "c7.large.2",
    		Az: "******",
    		Os: &osSpec,
    		Login: loginSpec,
    		RootVolume: rootVolumeSpec,
    		DataVolumes: listDataVolumesSpec,
    		Storage: storageSpec,
    		NodeNicSpec: nodeNicSpecSpec,
    		Count: &countSpec,
    		BillingMode: &billingModeSpec,
    		Runtime: runtimeSpec,
    		ExtendParam: extendParamSpec,
    	}
    	nameMetadata:= "test-66909"
    	metadatabody := &model.NodeMetadata{
    		Name: &nameMetadata,
    	}
    	request.Body = &model.NodeCreateRequest{
    		Spec: specbody,
    		Metadata: metadatabody,
    		ApiVersion: "v3",
    		Kind: "Node",
    	}
    	response, err := client.CreateNode(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

201

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

Error Codes

See Error Codes.