Updated on 2023-07-03 GMT+08:00

Deleting a Node

Function

This API is used to delete a specified node.

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.

URI

DELETE /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes/{node_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

cluster_id

Yes

String

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

node_id

Yes

String

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

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

nodepoolScaleDown

No

String

Whether the request is delivered by the node pool. If the value is not NoScaleDown, 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

Message body type (format).

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, see Obtaining a User Token.

Response Parameters

Status code: 200

Table 4 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 5 NodeMetadata

Parameter

Type

Description

name

String

Node name.

NOTE:

Enter 1 to 56 characters starting with a letter and not ending with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed. If name is not specified or empty, the node name is generated based on the default rule. The default rule is Cluster name-Random characters. Only the first 36 characters are kept for a too 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. The default rule is User-defined name-Random characters. Only the first 50 characters in the user-defined name are kept, followed by some random characters.

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.

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.

Table 6 NodeSpec

Parameter

Type

Description

flavor

String

Node specifications. For details about the node specifications supported by CCE, see Node Flavor Description.

az

String

Name of the AZ where the node to be created is located. . .

os

String

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

NOTE:
  • The system automatically selects the supported OS based on the cluster version. If the current cluster version does not support the OS, an error will be reported.
  • If alpha.cce/NodeImageID in extendParam is specified during node creation, you do not need to set this field.

login

Login object

Node login mode.

rootVolume

Volume object

Information about disks on the node

dataVolumes

Array of Volume objects

Data disk parameters of the node. Currently, you can add the second data disk for your node on the CCE console. This data disk is used by the container runtime and kubelet. Do not uninstall this disk. Otherwise, the node will become unavailable. For DeC nodes, the parameter description is the same as that for rootVolume.

storage

Storage object

Disk initialization management parameter.

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

If this parameter retains its default, disks are managed based on the DockerLVMConfigOverride (discarded) parameter in extendParam. This parameter is supported by clusters of version 1.15.11 and later.

NOTE:

If a node specification involves local disks and EVS disks at the same time, do not retain the default value of this parameter to prevent unexpected disk partitions.

publicIP

NodePublicIP object

EIP of a node.

NOTE:

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

nodeNicSpec

NodeNicSpec object

NIC of the node

count

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 parameter can be left blank when it is used for a node pool.

billingMode

Integer

Node billing mode.

  • 0: pay-per-use

taints

Array of Taint objects

You can add taints to created nodes to configure anti-affinity. A maximum of 20 taints can be added. Each taint contains the following parameters:

  • Key: A key must contain 1 to 63 characters starting with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. A DNS subdomain name can be used as the prefix of a key.
  • Value: A value must start with a letter or digit and can contain a maximum of 63 characters, including letters, digits, hyphens (-), underscores (_), and periods (.).
  • 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 using 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"
}]

k8sTags

Map<String,String>

Defined in key-value pairs. A maximum of 20 key-value pairs are allowed.

  • Key: Enter 1 to 63 characters, starting with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. A DNS subdomain can be prefixed to a key and contain a maximum of 253 characters. Example DNS subdomain: example.com/my-key
  • Value: The value can be left blank or contain 1 to 63 characters that start with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed in the character string. When creating a node, you can specify the initial value for this parameter and this field is not returned during query. In using 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"
}

ecsGroupId

String

Cloud server group ID. If this field is specified, the node is created in the specified cloud server group.

dedicatedHostId

String

ID of the DeH to which the node is scheduled.

NOTE:

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

userTags

Array of UserTag objects

Cloud server tag. The key of a tag must be unique. The maximum number of custom tags supported by CCE depends on the region and cannot exceed 8. When creating a node, you can specify the initial value for this parameter and this field is not returned during query. In using 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.

runtime

Runtime object

Container runtime:

  • Clusters of v1.25 or earlier: docker.
  • Clusters of v1.25 or later: Container runtime varies with the OS. For nodes running EulerOS 2.5, the default container runtime is docker. For nodes running other OSs, the default container runtime is containerd.

initializedConditions

Array of strings

Custom initialization flag.

Before CCE nodes are initialized, they are tainted with node.cloudprovider.kubernetes.io/uninitialized to prevent pods from being scheduled to them.

CCE supports custom initialization flags. After receiving the initializedConditions parameter, CCE converts the parameter value into a node label and provisions the label with the node, for example, cloudprovider.openvessel.io/inject-initialized-conditions=CCEInitial_CustomedInitial.

After the node is labeled, its status.Conditions is polled to check whether the type of conditions has a flag name, such as CCEInitial and CustomedInitial. If all input flags exist and their status is True, the node initialization is complete and the initialization taint is removed.

  • Use only letters and digits. Max. characters: 20.
  • Max. flags: 2.

extendParam

NodeExtendParam object

Extended parameters for creating a node.

Table 7 Login

Parameter

Type

Description

sshKey

String

Name of the key pair used for login.

Table 8 UserPassword

Parameter

Type

Description

username

String

Login account. Defaults to root.

password

String

If a username and a password are used to create a node, this field is shielded in the response body. A password must meet the following complexity requirements:

  • Contains 8 to 26 characters.
  • Contains at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters (!@$%^-_=+[{}]:,./?~#*)
  • Cannot contain the username or the username spelled backwards. The password field must be salted during node creation. For details, see Adding a Salt in the password Field When Creating a Node.
Table 9 Volume

Parameter

Type

Description

size

Integer

Disk size, in GB.

  • System disk: 40 to 1024

volumetype

String

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

  • SAS: high I/O disk
  • SSD: ultra-high I/O disk
  • SATA: common I/O disk SATA disks have been removed from EVS. You can find them attached only on existing nodes.

extendParam

Map<String,Object>

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

cluster_id

String

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

cluster_type

String

Storage class of the cloud server system disk. The value is always dss. This field is used only for DeC clusters.

hw:passthrough

Boolean

  • Pay attention to this field if your ECS is SDI-compliant. If the value of this field is true, an SCSI disk will be created.
  • If the node pool type is ElasticBMS, this field must be set to true.
  • If a node specification involves local disks and EVS disks at the same time, set the disk initialization parameters. For details, see Attaching Disks to a Node.

metadata

VolumeMetadata object

EVS disk encryption information. This field is mandatory only when you need to encrypt the system disk or data disks of the node to be created.

Table 10 VolumeMetadata

Parameter

Type

Description

__system__encrypted

String

Whether the 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.

If this parameter is not specified, EVS disks will not be encrypted by default.

__system__cmkid

String

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

Table 11 Storage

Parameter

Type

Description

storageSelectors

Array of StorageSelectors objects

Disk selection. Matched disks are managed according to matchLabels and storageType.

storageGroups

Array of StorageGroups objects

A storage group consists of multiple storage devices. It is used to divide storage space.

Table 12 StorageSelectors

Parameter

Type

Description

name

String

Selector name, used as the index of selectorNames in storageGroup. Therefore, the name of each selector must be unique.

storageType

String

Specifies the storage type. Currently, only evs (EVS volumes) and local (local volumes) are supported. The local storage does not support disk selection. All local disks will form a VG. Therefore, only one storageSelector of the local type is allowed.

matchLabels

matchLabels object

Matching field of an EVS volume. The size, volumeType, metadataEncrypted, metadataCmkid and count fields are supported.

Table 13 matchLabels

Parameter

Type

Description

size

String

Matched disk size. If this parameter is left unspecified, the disk size is not limited. Example: 100

volumeType

String

EVS disk type. Currently, SSD, GPSSD and SAS are supported.

metadataEncrypted

String

Disk encryption identifier. 0 indicates that the disk is not encrypted, and 1 indicates that the disk is encrypted.

metadataCmkid

String

Customer master key ID of an encrypted disk. The value is a 36-byte string.

count

String

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

Table 14 StorageGroups

Parameter

Type

Description

name

String

Name of a virtual storage group, which must be unique.

cceManaged

Boolean

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

selectorNames

Array of strings

This parameter corresponds to name in storageSelectors. A group can match multiple selectors, but a selector can match only one group.

virtualSpaces

Array of VirtualSpace objects

Detailed management of space configuration in a group.

Table 15 VirtualSpace

Parameter

Type

Description

name

String

Name of a virtualSpace.

  • 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.

size

String

Size of a virtualSpace. The value must be an integer in percentage. Example: 90%.

NOTE:

The sum of the percentages of all virtualSpaces in a group cannot exceed 100%.

lvmConfig

LVMConfig object

LVM configurations, applicable to kubernetes and user spaces. Note that one virtual space supports only one config.

runtimeConfig

RuntimeConfig object

runtime configurations, applicable to the runtime space. Note that one virtual space supports only one config.

Table 16 LVMConfig

Parameter

Type

Description

lvType

String

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.

path

String

Path to which the disk is attached. This parameter takes effect only in user configuration. The value is an absolute path. Digits, letters, periods (.), hyphens (-), and underscores (_) are allowed.

Table 17 RuntimeConfig

Parameter

Type

Description

lvType

String

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.

Table 18 NodePublicIP

Parameter

Type

Description

ids

Array of strings

IDs of existing EIPs. The quantity cannot be greater than the number of nodes to be created.

NOTE:

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

count

Integer

Number of EIPs to be dynamically created.

NOTE:

count and eip must be set at the same time.

eip

NodeEIPSpec object

EIP configuration.

Table 19 NodeEIPSpec

Parameter

Type

Description

iptype

String

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

bandwidth

NodeBandwidth object

Bandwidth parameters of the EIP

Table 20 NodeBandwidth

Parameter

Type

Description

chargemode

String

Bandwidth billing mode.

  • If this field is not specified, the billing is based on bandwidth. - If the field is null, 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.
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%.

size

Integer

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

sharetype

String

Bandwidth sharing type. Value options: PER (exclusive bandwidth)

Table 21 NodeNicSpec

Parameter

Type

Description

primaryNic

NicSpec object

Description of the primary NIC.

extNics

Array of NicSpec objects

Extension NIC

NOTE:

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

Table 22 NicSpec

Parameter

Type

Description

subnetId

String

ID of the subnet to which the NIC belongs. If subnetId is not specified when creating the primary NIC, the cluster subnet is used. When creating a secondary NIC, you must specify subnetId.

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 primary NIC IP range. The IP address of the created node falls in this range. fixedIps and ipBlock cannot be specified at the same time.

Table 23 Taint

Parameter

Type

Description

key

String

Key.

value

String

Value.

effect

String

Effect.

Table 24 UserTag

Parameter

Type

Description

key

String

Key of the cloud server label. The value cannot start with CCE- or __type_baremetal.

value

String

Value of the cloud server label.

Table 25 Runtime

Parameter

Type

Description

name

String

Container runtime:

  • Clusters of v1.25 or earlier: docker.
  • Clusters of v1.25 or later: Container runtime varies with the OS. For nodes running EulerOS 2.5, the default container runtime is docker. For nodes running other OSs, the default container runtime is containerd.
Table 26 NodeExtendParam

Parameter

Type

Description

ecs:performancetype

String

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

maxPods

Integer

Maximum number of pods that can be created on a node, including the default system pods. Value range: 16 to 256.

This limit prevents the node from being overloaded of 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.

DockerLVMConfigOverride

String

Docker data disk configuration item. (This parameter has been discarded. Use the storage field instead.) Example 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. Set diskType based on the actual drive letter type. 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. Currently, 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.

dockerBaseSize

Integer

Available disk space of a single container on a node, in GB.

If this parameter is left blank or is set to 0, the default value is used. In Device Mapper mode, the default value is 10. In OverlayFS mode, the available space of a single container is not limited by default, and the dockerBaseSize setting takes effect only on EulerOS nodes in the cluster of the new version.

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

When Device Mapper is used, you are advised to set dockerBaseSize to a value less than or equal to 80 GB. 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.

publicKey

String

Public key of a node.

alpha.cce/preInstall

String

Pre-installation script.

NOTE:

The input value must be Base64-encoded. (Command: echo -n "Content to be encoded" | base64)

alpha.cce/postInstall

String

Post-installation script.

NOTE:

The input value must be Base64-encoded. (Command: echo -n "Content to be encoded" | base64)

alpha.cce/NodeImageID

String

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

enterprise_project_id

String

ID of the enterprise project to which the node belongs

chargingMode

Integer

Billing mode of a node. This parameter has been deprecated. Use the billingMode parameter in NodeSpec.

agency_name

String

Name of an agency

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.

Table 27 NodeStatus

Parameter

Type

Description

phase

String

Node status: node resource lifecycle management (such as installation and uninstallation) status and Kubernetes node status in a cluster.

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.

Table 28 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

None

Example Responses

Status code: 200

The job for deleting a node is successfully delivered.

{
  "kind" : "Node",
  "apiVersion" : "v3",
  "metadata" : {
    "name" : "new-hostname",
    "uid" : "cc697ad9-9563-11e8-8ea7-0255ac106311",
    "creationTimestamp" : "2018-08-01 08:20:49.944664515 +0000 UTC",
    "updateTimestamp" : "2018-08-01 09:20:05.644032347 +0000 UTC",
    "annotations" : {
      "kubernetes.io/node-pool.id" : "az1.dc1#s1.medium#EulerOS 2.2"
    }
  },
  "spec" : {
    "flavor" : "s1.medium",
    "az" : "az1.dc1",
    "os" : "EulerOS 2.2",
    "login" : {
      "sshKey" : "KeyPair-001"
    },
    "rootVolume" : {
      "volumetype" : "SAS",
      "size" : 40
    },
    "dataVolumes" : [ {
      "volumetype" : "SAS",
      "size" : 100
    } ],
    "publicIP" : {
      "eip" : {
        "bandwidth" : { }
      }
    },
    "billingMode" : 0
  },
  "status" : {
    "phase" : "Active",
    "jobID" : "661f6f7d-956c-11e8-a916-0255ac10575d",
    "serverId" : "5b504f8d-33f1-4ab7-a600-b62dac967d72",
    "privateIP" : "192.168.0.69",
    "publicIP" : "10.154.194.59"
  }
}

Status Codes

Status Code

Description

200

The job for deleting a node is successfully delivered.

Error Codes

See Error Codes.