Reviewed-by: gtema <artem.goncharov@gmail.com> Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com> Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
123 KiB
Creating a Node
Function
This API is used to create a node in a specified cluster.
URI
POST /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes
Table 1 describes the parameters of the API.
Parameter |
Mandatory |
Description |
---|---|---|
project_id |
Yes |
Project ID. For details about how to obtain the project ID, see How to Obtain Parameters in the API URI. |
cluster_id |
Yes |
Cluster ID. For details about how to obtain the cluster ID, see How to Obtain Parameters in the API URI. |
Request
Request parameters:
Table 2 and Table 3 describe the request parameters.
Parameter |
Mandatory |
Description |
---|---|---|
Content-Type |
Yes |
Message body type (format). Possible values:
|
X-Auth-Token |
Yes |
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 on how to obtain a user token, see API Usage Guidelines. |
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 |
Yes |
metadata object |
Node's metadata, which is a collection of attributes. |
spec |
Yes |
spec object |
Detailed description of the node targeted by this API. CCE creates or updates objects by defining or updating its spec. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
No |
String |
Node name. NOTE:
Enter 0 to 56 characters starting with a letter and not ending with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed. If no node name is specified, the system automatically generates a node name in the format of Cluster Name-*****. |
labels |
No |
Object |
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" } NOTE:
Users can not use this field to define the native Kubernetes labels. |
annotations |
No |
Object |
CCE node annotation in key-value pair format (not the native Kubernetes annotations). Example: "annotations": { "key1" : "value1", "key2" : "value2" } NOTE:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
flavor |
Yes |
String |
Node specifications. For details, see the description of the flavorRef parameter in Creating an ECS. NOTE:
When adding a BMS node, check whether the flavor of the node to be added supports local disks. If local disks are not supported, add at least one 100 GB EVS disk. |
az |
Yes |
String |
AZ of the node. For details, see the description of the availability_zone parameter in Creating an ECS. |
os |
No |
String |
Node OS.
NOTE:
If the alpha.cce/NodeImageID parameter in extendParam is specified during node creation, you do not need to set this field. |
dedicatedHostId |
No |
String |
ID of the dedicated host to which nodes will be scheduled. |
login |
Yes |
login object |
Node login mode, which can be key pair or password. |
rootVolume |
Yes |
Volume object |
System disk parameters of the node. |
dataVolumes |
Yes |
Array of Volume object |
Data disk parameters of the node. Currently, you can add the second data disk for your node on the CCE console. |
publicIP |
No |
publicIP object |
EIP used by the node to access public networks. |
billingMode |
No |
Integer |
Billing mode of a node. NOTE:
This field is not supported for the current version. |
count |
Yes |
Integer |
Number of nodes to be created in a batch. The value must be a positive integer greater than or equal to 1 and less than or equal to the defined limit. NOTE:
This fielder can be set to 0 for a node pool. |
nodeNicSpec |
No |
nodeNicSpec object |
Description about the node NIC. |
extendParam |
No |
extendParam object |
Extended parameter. Format: Key-value pair. |
userTags |
No |
Object |
Tag of a VM. The format is key-value pair. The number of key-value pairs cannot exceed 20.
Example: "userTags": [ { "key": "tag1", "value": "aaaa" }, { "key": "tag2", "value": "bbbb" } ] |
k8sTags |
No |
Object |
Tag of a Kubernetes node. The format is key-value pair. The number of key-value pairs cannot exceed 20.
Example: "k8sTags": { "key": "value" } |
taints |
No |
Object |
You can add taints to created nodes to configure anti-affinity. Each taint contains the following parameters:
Example: "taints": [{ "key": "status", "value": "unavailable", "effect": "NoSchedule" }, { "key": "looks", "value": "bad", "effect": "NoSchedule" }] |
ecsGroupId |
No |
String |
ECS group ID. If this parameter is specified, the node is created in the specified ECS group. NOTE:
This parameter is not supported when you add a node to a node pool or use CCE Turbo cluster. |
dedicatedHostId |
No |
String |
ID of the DeH host. If this parameter is specified, the node is scheduled to its own DeH host. NOTE:
This parameter is not supported when you add a node to a node pool. |
offloadNode |
No |
Boolean |
Whether the node belongs to a CCE Turbo cluster. NOTE:
This parameter is not supported when you add a node to a node pool. |
faultDomain |
No |
String |
Cloud server fault domain. The node is created in the fault domain specified by this parameter. NOTE:
You must specify the ECS to which the fault domain policy applies and enable the fault domain feature. |
runtime |
No |
Runtime object |
Container runtime. The default value is docker. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
primaryNic |
No |
primaryNic object |
Description about the primary NIC. |
extNics |
No |
Array of extNics objects |
Extension NIC. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
subnetId |
No |
String |
Network ID of the subnet to which the NIC belongs. |
fixedIps |
No |
Array of strings |
The IP address of the primary NIC is specified by fixedIps. The number of IP addresses cannot be greater than the number of created nodes. fixedIps and ipBlock cannot be specified at the same time. |
ipBlock |
No |
String |
CIDR format of the IP address segment. The IP address of the created node falls in this IP address segment. fixedIps and ipBlock cannot be specified at the same time. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
maxPods |
No |
Integer |
Maximum number of pods on the node. |
agency_name |
No |
String |
Specifies the IAM agency name. |
dockerBaseSize |
No |
Integer |
Available disk space of a single Docker container on the node using the device mapper. |
alpha.cce/preInstall |
No |
String |
Script required before the installation. NOTE:
The input value must be encoded using Base64. (Command: echo -n "Content to be encoded" | base64) |
alpha.cce/postInstall |
No |
String |
Script required after the installation. NOTE:
The input value must be encoded using Base64. (Command: echo -n "Content to be encoded" | base64) |
alpha.cce/NodeImageID |
No |
String |
Mandatory if a custom image is used in creating a bare metal node. |
DockerLVMConfigOverride |
No |
String |
ConfigMap of the Docker data disk. The following is an example configuration:
"DockerLVMConfigOverride":"dockerThinpool=vgpaas/90%VG;kubernetesLV=vgpaas/10%VG;diskType=evs;lvType=linear" In this example:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
sshKey |
No |
String |
Name of the key pair used for node login. For details on how to create a key pair, see Creating a Key Pair. |
userPassword |
No |
String |
Password used for node login. NOTE:
This field is not supported for the current version. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
volumetype |
No |
String |
Disk type. For details, see the description of root_volume in Creating an ECS.
|
size |
No |
Integer |
Specifies the system disk size, in GB. The value ranges from 40 to 1024. |
extendParam |
No |
Map<String,Object> |
Disk extension parameter. For details, see the description of the extendparam parameter in Creating an ECS. |
hw:passthrough |
No |
Boolean |
|
metadata |
No |
dataVolumeMetadata object |
Data disk encryption information. This parameter is mandatory only when the data disk of the node to be created needs to be encrypted. If data disks are created using a data disk image, this parameter cannot be used. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
__system__encrypted |
No |
String |
Whether an EVS disk is encrypted.
If this parameter is not specified, EVS disks will not be encrypted by default. |
__system__cmkid |
Yes |
String |
CMK ID used for encryption. This parameter is used with __system__encrypted. NOTE:
You can obtain the ID through HTTPS requests. For details, see Querying the List of CMKs. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
ids |
No |
Array of strings |
List of IDs of the existing EIPs. NOTICE:
If ids is set, you do not need to set count and eip. |
count |
No |
Integer |
Number of EIPs to be dynamically created. NOTICE:
The count and eip parameters must be set simultaneously. |
eip |
No |
eip object |
EIP. NOTICE:
The count and eip parameters must be set simultaneously. |

If no EIP has been created, configure count and eip. The system will automatically create EIPs based on count and eip.
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
iptype |
Yes |
String |
EIP type. For details, see the description of the iptype parameter in the eip field in Data Structure for Creating ECSs. |
bandwidth |
Yes |
bandwidth object |
Bandwidth parameters of the EIP. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
chargemode |
No |
String |
The value is traffic, indicating that the billing is based on traffic. |
size |
Yes |
Integer |
Bandwidth size. For details, see the description of the size parameter in the bandwidth field in Data Structure for Creating ECSs. |
sharetype |
Yes |
String |
Shared bandwidth type. For details, see the description of the sharetype parameter in the bandwidth field in Data Structure for Creating ECSs. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
No |
String |
Container runtime. The default value is docker. Enumeration values:
|
Example request:
CCE cluster:
{ "kind": "Node", "apiVersion": "v3", "metadata": { "name": "myhost", "labels": { "foo": "bar" }, "annotations": { "annotation1": "abc" } }, "spec": { "flavor": "s1.medium", "az": "eu-de-01", "login": { "sshKey": "Keypair-demo" }, "rootVolume": { "size": 40, "volumetype": "SAS" }, "dataVolumes": [ { "size": 100, "volumetype": "SAS" } ], "userTags": [ { "key": "tag1", "value": "aaaa" }, { "key": "tag2", "value": "bbbb" } ], "k8sTags": { "label-test": "test" }, "publicIP": { "count": 2, "eip": { "iptype": "5_bgp", "bandwidth": { "chargemode": "traffic", "size": 10, "sharetype": "PER" } } }, "count": 2, "nodeNicSpec": { "primaryNic": { "subnetId": "bbfc0a20-d66c-4f36-b4c1-265d669b8c62" } }, "extendParam": { "alpha.cce/postInstall": "IyEvYml******C50eHQ=" } } }
CCE Turbo cluster:
{ "kind": "Node", "apiversion": "v3", "metadata": { "name": "turbo-cluster-node" }, "spec": { "flavor": "cce.c4.22xlarge.4.physical.129nic", "az": "eu-de-01", "login": { "sshKey": "id_rsa" }, "rootVolume": { "size": 40, "volumetype": "SAS", "hw:passthrough": true }, "dataVolumes": [ { "size": 100, "volumetype": "SAS", "hw:passthrough": true } ], "count": 1, "runtime": { "name": "containerd" }, "extendParam": { "alpha.cce/NodeImageID":"0fea78c3-1b31-4653-8859-ac151ccadcd4" } } }
Response
Response parameters:
Table 16 describes the response 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 |
metadata object |
Node's metadata, which is a collection of attributes. |
spec |
spec object |
Detailed description of the node targeted by this API. CCE creates or updates objects by defining or updating its spec. |
status |
status object |
Node status and jobID of the node creation job. |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Node name. |
uid |
String |
Node ID. |
labels |
Object |
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" } NOTE:
Users can not use this field to define the native Kubernetes labels. |
annotations |
Object |
CCE node annotation in key-value pair format (not the native Kubernetes annotations). Example: "annotations": { "key1" : "value1", "key2" : "value2" } NOTE:
|
Parameter |
Type |
Description |
---|---|---|
flavor |
String |
Node specifications. For details, see the description of the flavorRef parameter in Creating an ECS. |
az |
String |
AZ of the node. For details, see the description of the availability_zone parameter in Creating an ECS. |
os |
String |
Node OS.
|
login |
login object |
Node login mode, which can only be key pair. |
rootVolume |
Volume object |
System disk parameters of the node. |
dataVolumes |
Array of Volume object |
Data disk parameters of the node. |
publicIP |
publicIP object |
EIP parameters of a node. |
nodeNicSpec |
nodeNicSpec object |
Description about the node NIC. |
count |
Integer |
Number of nodes to be created in a batch. The value must be a positive integer greater than or equal to 1. NOTE:
This parameter can be set to 0 for a node pool. |
billingMode |
Integer |
Billing mode of a node. NOTE:
This field is not supported for the current version. |
userTags |
Object |
The format is key-value pair. It is recommended that you use TMS's predefined tag function to add the same tag to different cloud resources.
Example: "userTags": [ { "key": "tag1", "value": "aaaa" }, { "key": "tag2", "value": "bbbb" }] |
k8sTags |
Object |
The format is key-value pair. The number of key-value pairs cannot exceed 20.
NOTE:
If a node is created using a node pool, a label whose key is cce.cloud.com/cce-nodepool is automatically added to the node, and the label value is the node name. Example: "k8sTags": { "key": "value" } |
taints |
Object |
You can add taints to created nodes to configure anti-affinity. Each taint contains the following parameters:
Example: "taints": [{ "key": "status", "value": "unavailable", "effect": "NoSchedule" }, { "key": "looks", "value": "bad", "effect": "NoSchedule" }] |
ecsGroupId |
String |
ECS group ID. If this parameter is specified, the node is created in the specified ECS group. NOTE:
This parameter is not supported when you add a node to a node pool or use CCE Turbo cluster. |
dedicatedHostId |
String |
ID of the DeH host. If this parameter is specified, the node is scheduled to its own DeH host. NOTE:
This parameter is not supported when you add a node to a node pool. |
offloadNode |
Boolean |
Whether the node belongs to a CCE Turbo cluster. NOTE:
This parameter is not supported when you add a node to a node pool. |
faultDomain |
String |
Cloud server fault domain. The node is created in the fault domain specified by this parameter. NOTE:
You must specify the ECS to which the fault domain policy applies and enable the fault domain feature. |
extendParam |
extendParam object |
Extended parameter. Format: Key-value pair. |
runtime |
Runtime object |
Container runtime. The default value is docker. |
Parameter |
Type |
Description |
---|---|---|
primaryNic |
primaryNic object |
Description about the primary NIC. |
extNics |
Array of extNics objects |
Extension NIC. |
Parameter |
Type |
Description |
---|---|---|
subnetId |
String |
Network ID of the subnet to which the NIC belongs. |
fixedIps |
Array of strings |
The IP address of the primary NIC is specified by fixedIps. The number of IP addresses cannot be greater than the number of created nodes. fixedIps and ipBlock cannot be specified at the same time. |
ipBlock |
String |
CIDR format of the IP address segment. The IP address of the created node falls in this IP address segment. fixedIps and ipBlock cannot be specified at the same time. |
Parameter |
Type |
Description |
---|---|---|
chargingMode |
Integer |
Billing mode of a node. NOTE:
This field is not supported for the current version. |
ecs:performancetype |
String |
Type of the ECS specifications. |
orderID |
String |
Order ID. NOTE:
This field is not supported for the current version. |
productID |
String |
Product ID. NOTE:
This field is not supported for the current version. |
publicKey |
String |
Key pair used to log in to the node. Used when creating a key pair. |
maxPods |
Integer |
Maximum number of pods on the node. |
dockerBaseSize |
Integer |
Available disk space of a single Docker container on the node using the device mapper. |
agency_name |
String |
Specifies the IAM agency name. |
DockerLVMConfigOverride |
String |
Docker data disk configurations. The following is the default configuration: "DockerLVMConfigOverride":"dockerThinpool=vgpaas/90%VG;kubernetesLV=vgpaas/10%VG;diskType=evs;lvType=linear" The configuration contains the following fields:
|
Parameter |
Type |
Description |
---|---|---|
jobID |
String |
ID of the node creation job. You can query job progress by job ID to keep updated on node creation progress. |
phase |
String |
Node status.
|
serverId |
String |
ID of the underlying ECS 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. |
privateIP |
String |
IP address in the private network segment of the primary NIC on the node. |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Container runtime. The default value is docker. Enumeration values:
|
Example response:
{ "kind": "Node", "apiVersion": "v3", "metadata": { "name": "myhost", "uid": "4d1ecb2c-229a-11e8-9c75-0255ac100ceb", "labels": { "foo": "bar" }, "annotations": { "annotation1": "abc" } }, "spec": { "flavor": "s1.medium", "az": "eu-de-01", "os": "EulerOS 2.5", "login": { "sshKey": "Keypai-demo" }, "rootVolume": { "volumetype": "SAS", "size": 40 }, "dataVolumes": [ { "volumetype": "SAS", "size": 100 } ], "publicIP": { "count": 2, "eip": { "iptype": "5_bgp", "bandwidth": { "size": 10, "sharetype": "PER", "chargemode": "traffic" } } }, "nodeNicSpec": { "primaryNic": { "subnetId": "2afc3d7f-07d1-4c25-ba2e-8ee48d253d9f" } }, "count": 2, "extendParam": { "chargingMode": 0, "ecs:performancetype": "normal", "init-node-password": "", "orderID": "", "productID": "" } }, "status": { "jobID": "2ec9b78d-9368-46f3-8f29-d1a95622a568" } }
CCE Turbo cluster:
{ "kind": "Node", "apiversion": "v3", "metadata": { "name": "turbo-cluster-node", "uid": "5ecfddfe-87db-11ec-b5e5-0255ac101514" }, "spec": { "flavor": "cce.c4.22xlarge.4.physical.129nic", "az": "eu-de-01", "login": { "sshKey": "id_rsa" }, "rootVolume": { "size": 40, "volumetype": "SAS", "hw:passthrough": true }, "dataVolumes": [ { "size": 100, "volumetype": "SAS", "hw:passthrough": true } ], "count": 1, "runtime": { "name": "containerd" }, "extendParam": { "alpha.cce/NodeImageID":"0fea78c3-1b31-4653-8859-ac151ccadcd4" } }, "status": { "jobID": "5ec1518c-87db-11ec-b5e5-0255ac101514" } }
Status Code
Table 24 describes the status codes of this API.
Status Code |
Description |
---|---|
201 |
The job for creating a node in a specified cluster is successfully issued. |
For the description about error status codes, see Status Code.