All Products
Search
Document Center

:Query nodes in a cluster

更新时间:Aug 31, 2023

You can call the DescribeClusterNodes operation to query information about the nodes in a specified Container Service for Kubernetes (ACK) cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request syntax

GET /clusters/ClusterId/nodes?instanceIds=String&nodepool_id=String&state=String&pageSize=String&pageNumber=String HTTP/1.1
Content-Type:application/json

Request parameters

Table 1. Request path parameters
ParameterTypeRequiredExampleDescription
ClusterIdStringYesc82e6987e2961451182edacd74faf****

The ID of the cluster that you want to query.

Table 2. Request query parameters
ParameterTypeRequiredExamplesDescription
instanceIdsStringNo"i-bp11xjhwkj8k966u****,i-bp1dmhc2bu5igkyq****"

The IDs of the nodes that you want to query. Separate multiple node IDs with commas (,).

nodepool_idStringNonp****

The ID of the node pool.

stateStringNorunning

The node state that you want to use to filter nodes. Valid values:

  • all: query nodes in the following four states.
  • running: query nodes in the running state.
  • removing: query nodes that are being removed.
  • initial: query nodes that are being initialized.
  • failed: query nodes that fail to be created.

Default value: all.

pageSizeStringNo10

The number of entries to return on each page. Valid values: 1 to 100.

Default value: 10.

pageNumberStringNo1

The number of the page to return.

Default value: 1.

Response syntax

HTTP/1.1 200 OK
Content-Type:application/json

{
  "nodes" : [ {
    "creation_time" : "String",
    "error_message" : "String",
    "expired_time" : "String",
    "host_name" : "String",
    "image_id" : "String",
    "instance_charge_type" : "String",
    "instance_id" : "String",
    "instance_name" : "String",
    "instance_role" : "String",
    "instance_status" : "String",
    "instance_type" : "String",
    "instance_type_family" : "String",
    "ip_address" : [ "String" ],
    "is_aliyun_node" : Boolean,
    "node_name" : "String",
    "node_status" : "String",
    "nodepool_id" : "String",
    "source" : "String",
    "state" : "String"
  } ],
  "page" : {
    "page_number" : Integer,
    "page_size" : Integer,
    "total_count" : Integer
  }
}

Response parameters

Table 3. Response body parameters
ParameterTypeExampleDescription
nodesArray of node

The details of the nodes that are returned.

creation_timeString2020-08-25T11:25:35+08:00

The time when the node was created.

error_messageStringerror***

The error message that was generated when the node was created.

expired_timeString2099-12-31T23:59:00+08:00

The expiration time of the node.

host_nameStringiZ2vcckdmxp7u0urj2k****

The name of the host.

image_idStringaliyun_2_1903_x64_20G_alibase_20200529.vhd

The ID of the system image that is used by the node.

instance_charge_typeStringPostPaid

The billing method of the instance on which the node is deployed. Valid values:

  • PrePaid: the subscription billing method. If the value is PrePaid, make sure that you have a sufficient balance or credit in your account. Otherwise, an InvalidPayMethod error is returned.
  • PostPaid: the pay-as-you-go billing method.
instance_idStringi-2vcckdmxp7u0urj2****

The ID of the instance on which the node is deployed.

instance_nameStringworker-k8s-for-cs-c5cdf7e3938bc4f8eb0e44b21a80f****

The name of the instance on which the node is deployed.

instance_roleStringWorker

The role of the node. Valid values:

  • Master: master node
  • Worker: worker node
instance_statusStringRunning

The status of the node.

instance_typeStringecs.c5.xlarge

The instance type of the node.

instance_type_familyStringecs.c5

The Elastic Compute Service (ECS) instance family of the node.

ip_addressArray of String192.168.0.36

The IP address of the node.

is_aliyun_nodeBooleantrue

Indicates whether the instance on which the node is deployed is provided by Alibaba Cloud. Valid values:

  • true: The instance is provided by Alibaba Cloud.
  • false: The instance is not provided by Alibaba Cloud.
node_nameStringcn-chengdu.192.168.0.36

The name of the node. This name is the identifier of the node in the cluster.

node_statusStringReady

Indicates whether the node is ready. Valid values:

  • Ready: The node is ready.
  • NotReady: The node is not ready.
  • Unknown: The status of the node is unknown.
  • Offline: The node is offline.
nodepool_idStringnp0794239424a84eb7a95327369d56****

The ID of the node pool.

sourceStringess_attach

Indicates how the node is initialized. A node can be manually created or created by using Resource Orchestration Service (ROS).

stateStringrunning

The status of the node. Valid values:

  • pending: The node is being created.
  • running: The node is running.
  • starting: The node is being started.
  • stopping: The node is being stopped.
  • stopped: The node is stopped.
spot_strategyStringNoSpot

The type of the preemptible instance. Valid values:

  • NoSpot: a non-preemptible instance.
  • SpotWithPriceLimit: a preemptible instance that is configured with the highest bid price.
  • SpotAsPriceGo: a preemptible instance for which the system automatically bids based on the current market price.
pageObject

The pagination details.

page_numberInteger1

The page number of the returned page.

page_sizeInteger10

The number of entries returned per page.

total_countInteger5

The total number of entries returned.

Examples

Sample requests

GET /clusters/c82e6987e2961451182edacd74faf****/nodes?instanceIds="i-bp11xjhwkj8k966u****,i-bp1dmhc2bu5igkyq****"&nodepool_id=np****&state=running&pageSize=3&pageNumber=50 HTTP/1.1
Host:cs.aliyuncs.com
Content-Type:application/json

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeClusterNodesResponse>
    <nodes>
        <creation_time>2020-08-25T11:25:35+08:00</creation_time>
        <error_message>error***</error_message>
        <expired_time>2099-12-31T23:59:00+08:00</expired_time>
        <host_name>iZ2vcckdmxp7u0urj2k****</host_name>
        <image_id>aliyun_2_1903_x64_20G_alibase_20200529.vhd</image_id>
        <instance_charge_type>PostPaid</instance_charge_type>
        <instance_id>i-2vcckdmxp7u0urj2****</instance_id>
        <instance_name>worker-k8s-for-cs-c5cdf7e3938bc4f8eb0e44b21a80f****</instance_name>
        <instance_role>Worker</instance_role>
        <instance_status>Running</instance_status>
        <instance_type>ecs.c5.xlarge</instance_type>
        <instance_type_family>ecs.c5</instance_type_family>
        <ip_address>192.168.0.36</ip_address>
        <is_aliyun_node>true</is_aliyun_node>
        <node_name>cn-chengdu.192.168.0.36</node_name>
        <node_status>Ready</node_status>
        <nodepool_id>np0794239424a84eb7a95327369d56****</nodepool_id>
        <source>ess_attach</source>
        <state>running</state>
    </nodes>
    <page>
        <page_number>1</page_number>
        <page_size>10</page_size>
        <total_count>5</total_count>
    </page>
</DescribeClusterNodesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "nodes" : [ {
    "creation_time" : "2020-08-25T11:25:35+08:00",
    "error_message" : "error***",
    "expired_time" : "2099-12-31T23:59:00+08:00",
    "host_name" : "iZ2vcckdmxp7u0urj2k****",
    "image_id" : "aliyun_2_1903_x64_20G_alibase_20200529.vhd",
    "instance_charge_type" : "PostPaid",
    "instance_id" : "i-2vcckdmxp7u0urj2****",
    "instance_name" : "worker-k8s-for-cs-c5cdf7e3938bc4f8eb0e44b21a80f****",
    "instance_role" : "Worker",
    "instance_status" : "Running",
    "instance_type" : "ecs.c5.xlarge",
    "instance_type_family" : "ecs.c5",
    "ip_address" : [ "192.168.0.36" ],
    "is_aliyun_node" : true,
    "node_name" : "cn-chengdu.192.168.0.36",
    "node_status" : "Ready",
    "nodepool_id" : "np0794239424a84eb7a95327369d56****",
    "source" : "ess_attach",
    "state" : "running"
  } ],
  "page" : {
    "page_number" : 1,
    "page_size" : 10,
    "total_count" : 5
  }
}

Error codes

For a list of error codes, visit the API Error Center.