126 KiB
- original_name
cce_02_0354.html
Creating a Node Pool
Function
This API is used to create a node pool in a specified cluster.
URI
POST /api/v3/projects/{project_id}/clusters/{cluster_id}/nodepools
Table 1 <cce_02_0354__table2027961241820>
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 <cce_02_0271> . |
cluster_id | Yes | Cluster ID. For details about how to obtain the cluster ID, see How to Obtain Parameters in the API URI <cce_02_0271> . |
Request
Request parameters:
Table 2 <cce_02_0354__table13796145119241>
and Table 3 <cce_02_0354__table1644211019>
describe the request parameters.
Parameter | Mandatory | String | Description |
---|---|---|---|
Content-Type | Yes | String | Message body type (format). Default: application/json |
X-Auth-Token | Yes | String | 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 <cce_02_0344> . |
Parameter | Mandatory | Type | Description |
---|---|---|---|
kind | Yes | String | API type, which is fixed at NodePool. |
apiVersion | Yes | String | API version, which is fixed at v3. |
metadata | Yes | metadata <cce_02_0354__table13456192212> object |
Metadata of the node pool. |
spec | Yes | spec <cce_02_0354__table620623542313> object |
Parameters of the node pool. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
name | Yes | String | Node pool name. Naming rule: Enter 1 to 50 characters that starts with a lowercase letter and cannot end with a hyphen (-). Lowercase letters, digits, and hyphens (-) are allowed. The value cannot be DefaultPool. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
type | No | String | Node pool type. If this parameter is left blank, the value vm is used by default.
|
nodeTemplate | Yes | nodeTemplate <cce_02_0354__table3150105216225> object |
Parameters of the node pool template. If az is set to random, when you create a node pool or update the number of nodes in a node pool, a scaling task is triggered. The system selects an AZ from all AZs where scaling is allowed to add nodes based on priorities. AZs with a smaller number of existing nodes have a higher priority. If AZs have the same number of nodes, the system selects the AZ based on the AZ sequence. Example:
|
initialNodeCount | Yes | Integer | Expected number of nodes in this node pool. The value cannot be greater than the maximum number of nodes allowed for the cluster. |
autoscaling | No | autoscaling <cce_02_0354__table1472543502018> object |
Auto scaling parameters. |
nodeManagement | No | nodeManagement <cce_02_0354__table978201612141> object |
Node management parameters. |
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 |
Note If the alpha.cce/NodeImageID parameter in extendParam is specified during node creation, you do not need to set this field. |
login | Yes | login <cce_02_0354__table10946114617286> object |
Node login mode, which can be key pair or password. |
rootVolume | Yes | Volume <cce_02_0354__table1359314517> object |
System disk parameters of the node. |
dataVolumes | Yes | Array of Volume <cce_02_0354__table1359314517> object |
Data disk parameters of the node. |
publicIP | No | publicIP <cce_02_0354__table139179586343> 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. This field can be set to 0 for a node pool. |
extendParam | No | extendParam <cce_02_0354__table153332427337> 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:
|
k8sTags | No | Object | Tag of a Kubernetes node. The format is key-value pair. The number of key-value pairs cannot exceed 20.
Example:
|
taints | No | Object | You can add taints to created nodes to configure anti-affinity. Each taint contains the following parameters:
Example:
|
nodeNicSpec | No | nodeNicSpec <cce_02_0354__table322873620312> object |
Description about the node NIC. |
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 <cce_02_0101> . |
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 <cce_02_0354__table15849123210415> 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. Important NOTICE: If ids is set, you do not need to set count and eip. |
count | No | Integer | Number of EIPs to be dynamically created. Important NOTICE: The count and eip parameters must be set simultaneously. |
eip | No | eip <cce_02_0354__table135065714419> object |
EIP. Important NOTICE: The count and eip parameters must be set simultaneously. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
iptype | Yes | String | Type of the EIP. |
bandwidth | Yes | bandwidth <cce_02_0354__table16381121974213> object |
Bandwidth parameters of the EIP. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
chargemode | No | String | Bandwidth billing mode.
|
size | Yes | Integer | Bandwidth size. |
sharetype | Yes | String | Bandwidth sharing type. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
maxPods | No | Integer | Maximum number of pods on the node. |
agency_name | No | String | Specifies the IAM agency name. |
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:
In this example:
|
publicKey | No | String | Public key of the node. Used when creating a key pair. |
nicMultiqueue | No | String | ENI queue settings, the default setting is:
|
nicThreshold | No | String | ENI pre-binding thresholds, the default setting is:
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
primaryNic | No | primaryNic <cce_02_0354__request_nicspec> object |
Description about the primary NIC. |
extNics | No | Array of extNics <cce_02_0354__request_nicspec> 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 |
---|---|---|---|
enable | No | Boolean | Whether to enable auto scaling. |
minNodeCount | No | Integer | Minimum number of nodes after a scale-down if auto scaling is enabled. |
maxNodeCount | No | Integer | Maximum number of nodes after a scale-up if auto scaling is enabled. The value of this parameter must be greater than or equal to that of minNodeCount and does not exceed the maximum number of nodes for the cluster. |
scaleDownCooldownTime | No | Integer | Interval during which nodes added after a scale-up will not be deleted, in minutes. |
priority | No | Integer | Node pool weight. A higher weight indicates a higher priority in scale-up. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
serverGroupReference | No | String | ECS group ID. If this parameter is specified, all nodes in the node pool will be created in this ECS group. |
Example Request
CCE cluster:
{
"kind": "NodePool",
"apiVersion": "v3",
"metadata": {
"name": "wyr-17-nodepool-53042"
},
"spec": {
"initialNodeCount": 0,
"type": "vm",
"autoscaling": {
"enable": true,
"minNodeCount": 1,
"maxNodeCount": 3,
"scaleDownCooldownTime": 10,
"priority": 1
},
"nodeManagement": {
"serverGroupReference": "2129f95a-f233-4cd8-a1b2-9c0acdf918d3"
},
"nodeTemplate": {
"flavor": "s6.large.2",
"az": "eu-de-01",
"os": "EulerOS 2.5",
"login": {
"sshKey": "KeyPair-nodepool"
},
"rootVolume": {
"volumetype": "SATA",
"size": 40
},
"dataVolumes": [
{
"volumetype": "SATA",
"size": 100,
"extendParam": {
"useType": "docker"
}
}
],
"billingMode": 0,
"extendParam": {
"alpha.cce/preInstall": "bHMgLWw=",
"alpha.cce/postInstall": "bHMgLWwK",
"alpha.cce/NodeImageID": "85bd7ec5-bca4-4f5f-947b-6c1bf02599d3",
"maxPods": 110,
"DockerLVMConfigOverride": "dockerThinpool=vgpaas/90%VG;kubernetesLV=vgpaas/10%VG;diskType=evs;lvType=linear"
},
"k8sTags": {
"tag1": "value1",
"tag2": "value2"
},
"taints": [
{
"key": "aaa",
"value": "bbb",
"effect": "NoSchedule"
},
{
"key": "ccc",
"value": "ddd",
"effect": "NoSchedule"
}
],
"userTags": [
{
"key": "resource-tag1",
"value": "value1"
},
{
"key": "resource-tag2",
"value": "value2"
}
],
"nodeNicSpec": {
"primaryNic": {
"subnetId": "31be174a-0c7f-4b71-bb0d-d325fecb90ef"
}
}
}
}
}
CCE Turbo cluster:
{
"kind": "NodePool",
"apiVersion": "v3",
"metadata": {
"name": "turbo-cluster-nodepool1"
},
"spec": {
"initialNodeCount": 0,
"type": "ElasticBMS",
"nodeTemplate": {
"flavor": "cce.c4.22xlarge.4.physical.129nic",
"az": "eu-de-01",
"login": {
"sshKey":"id_rsa"
},
"rootVolume": {
"volumetype": "SAS",
"size": 40,
"hw:passthrough": true},
"dataVolumes": [
{
"volumetype": "SAS",
"size": 100,
"hw:passthrough": true
}
],
"runtime": {
"name":"containerd"
},
"extendParam": {
"alpha.cce/NodeImageID":"0fea78c3-1b31-4653-8859-ac151ccadcd4"
}
}
}
}
Response
Response parameters:
Table 18 <cce_02_0354__table835415466262>
describes the response parameters.
Parameter | Type | Description |
---|---|---|
kind | String | API type. The value is fixed to NodePool. |
apiVersion | String | API version. The value is fixed to v3. |
metadata | metadata <cce_02_0354__table173551146152616> object |
Node pool metadata. |
spec | spec <cce_02_0354__table1735515465260> object |
Detailed node pool parameters. |
status | status <cce_02_0354__table19851129411> object |
Node pool status. |
Parameter | Type | Description |
---|---|---|
name | String | Name of the node pool. |
uid | String | ID of the node pool. |
Parameter | Type | Description |
---|---|---|
type | String | Node type. Currently, only VM nodes are supported. |
initialNodeCount | Integer | Initial number of nodes for the node pool. |
nodeTemplate | nodeTemplate <cce_02_0354__table3150105216225> object |
Detailed parameters of the node pool template. |
autoscaling | autoscaling <cce_02_0354__table14356154632610> object |
Auto scaling parameters. |
nodeManagement | nodeManagement <cce_02_0354__table1778609171919> object |
Node management parameters. |
Parameter | Type | Description |
---|---|---|
enable | Boolean | Whether to enable auto scaling. |
minNodeCount | Integer | Minimum number of nodes allowed if auto scaling is enabled. The value cannot be greater than the maximum number of nodes allowed by the cluster specifications. Minimum: 0 |
maxNodeCount | Integer | Maximum number of nodes allowed if auto scaling is enabled. This value must be greater than or equal to the value of minNodeCount and cannot exceed the maximum number of nodes in the cluster specifications. Minimum: 0 |
scaleDownCooldownTime | Integer | Interval between two scaling operations, in minutes. During this period, nodes added after a scale-up will not be deleted. Minimum: 0 Maximum: 2147483647 |
priority | Integer | Weight of a node pool. A node pool with a higher weight has a higher priority during scaling. |
Parameter | Type | Description |
---|---|---|
serverGroupReference | String | ECS group ID. If this parameter is specified, all nodes in the node pool will be created in this ECS group. |
Parameter | Type | Description |
---|---|---|
currentNode | Integer | Number of nodes in the node pool. |
deletingNode | Integer | Number of nodes being deleted in the node pool. |
creatingNode | Integer | Number of nodes being created in the node pool. |
phase | String | Node pool status.
Enumeration values:
Note If the status is blank, the status is normal. |
jobId | String | ID of the job to delete the node pool. |
Example response:
CCE cluster:
{
"kind": "NodePool",
"apiVersion": "v3",
"metadata": {
"name": "wyr-17-nodepool-53042",
"uid": "feec6013-cd7e-11ea-8c7a-0255ac100be7"
},
"spec": {
"initialNodeCount": 0,
"type": "vm",
"nodeTemplate": {
"flavor": "s6.large.2",
"az": "eu-de-01",
"os": "EulerOS 2.5",
"login": {
"sshKey": "KeyPair-nodepool",
"userPassword": {}
},
"rootVolume": {
"volumetype": "SATA",
"size": 40
},
"dataVolumes": [
{
"volumetype": "SATA",
"size": 100,
"extendParam": {
"useType": "docker"
}
}
],
"publicIP": {
"eip": {
"bandwidth": {}
}
},
"nodeNicSpec": {
"primaryNic": {
"subnetId": "31be174a-0c7f-4b71-bb0d-d325fecb90ef"
}
},
"billingMode": 0,
"taints": [
{
"key": "aaa",
"value": "bbb",
"effect": "NoSchedule"
},
{
"key": "ccc",
"value": "ddd",
"effect": "NoSchedule"
}
],
"k8sTags": {
"cce.cloud.com/cce-nodepool": "wyr-17-nodepool-53042",
"tag1": "value1",
"tag2": "value2"
},
"userTags": [
{
"key": "resource-tag1",
"value": "value1"
},
{
"key": "resource-tag2",
"value": "value2"
}
],
"extendParam": {
"DockerLVMConfigOverride": "dockerThinpool=vgpaas/90%VG;kubernetesLV=vgpaas/10%VG;diskType=evs;lvType=linear",
"alpha.cce/NodeImageID": "85bd7ec5-bca4-4f5f-947b-6c1bf02599d3",
"alpha.cce/postInstall": "bHMgLWwK",
"alpha.cce/preInstall": "bHMgLWw=",
"maxPods": 110,
"publicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQA***d-by-Nova\n"
}
},
"autoscaling": {
"enable": true,
"minNodeCount": 1,
"maxNodeCount": 3,
"scaleDownCooldownTime": 10,
"priority": 1
},
"nodeManagement": {
"serverGroupReference": "2129f95a-f233-4cd8-a1b2-9c0acdf918d3"
}
},
"status": {
"currentNode": 0,
"deletingNode": 0,
"creatingNode": 0,
"phase": ""
}
}
CCE Turbo cluster:
{
"kind": "NodePool",
"apiVersion": "v3",
"metadata": {
"name": "turbo-cluster-nodepool1",
"uid": "99addaa2-69eb-11ea-a592-0255ac1001bb"
},
"spec": {
"initialNodeCount": 0,
"type": "ElasticBMS",
"nodeTemplate": {
"flavor": "cce.c4.22xlarge.4.physical.129nic",
"az": "eu-de-01",
"os": "EulerOS 2.9",
"login": {
"sshKey":"id_rsa"
},
"rootVolume": {
"volumetype": "SAS",
"size": 40,
"hw:passthrough": true},
"dataVolumes": [
{
"volumetype": "SAS",
"size": 100,
"hw:passthrough": true
}
],
"runtime": {
"name":"containerd"
},
"extendParam": {
"alpha.cce/NodeImageID":"0fea78c3-1b31-4653-8859-ac151ccadcd4"
}
}
},
"status": {
"phase": ""
}
}
Status Code
Table 24 <cce_02_0354__zh-cn_topic_0079614900_table46761928>
describes the status code of this API.
Status Code | Description |
---|---|
201 | The job for creating a node in a specified cluster is successfully delivered. |
For the description about error status codes, see Status Code <cce_02_0084>
.