调用DescribeClusterNodes查询集群节点。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求语法

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

请求参数

表 1. 请求Path参数
参数名称 类型 是否必选 示例 说明
ClusterId String c82e6987e2961451182edacd74faf****

集群ID。

表 2. 请求Query参数
参数名称 类型 是否必选 示例 说明
instanceIds String "i-bp11xjhwkj8k966u****,i-bp1dmhc2bu5igkyq****"

节点实例ID列表,多值使用英文逗号(,)分隔。

nodepool_id String np****

节点池ID。

state String running

集群节点状态,按照集群节点运行状态进行过滤,取值:

  • all:以下4种状态的集群节点。
  • running:正在运行的集群节点。
  • removing:正在删除的集群节点。
  • initial:正在初始化的集群节点。
  • failed:创建失败的集群节点。

默认值:all

pageSize String 10

每页显示的记录数。取值范围为1,100

默认值:10。

pageNumber String 1

页码。

默认值:1。

响应体语法

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
  }
}

响应参数

表 3. 响应Body参数
参数名称 类型 示例 说明
nodes Array of node

节点详情列表。

creation_time String 2020-08-25T11:25:35+08:00

节点创建时间。

error_message String error***

节点创建时错误信息。

expired_time String 2099-12-31T23:59:00+08:00

节点到期时间。

host_name String iZ2vcckdmxp7u0urj2k****

节点主机名。

image_id String aliyun_2_1903_x64_20G_alibase_20200529.vhd

节点使用的系统镜像ID。

instance_charge_type String PostPaid

节点付费类型。取值:

  • PrePaid:预付费,包年包月。选择该类付费方式时,您必须确认自己的账号支持余额支付或信用支付,否则将返回InvalidPayMethod的错误提示。
  • PostPaid:按量付费。
instance_id String i-2vcckdmxp7u0urj2****

节点实例ID。

instance_name String worker-k8s-for-cs-c5cdf7e3938bc4f8eb0e44b21a80f****

节点在集群中的名称。

instance_role String Worker

节点角色类型:

  • Master:集群Master节点。
  • Worker:集群Worker节点。
instance_status String Running

节点运行状态。

instance_type String ecs.c5.xlarge

节点类型。

instance_type_family String ecs.c5

节点所属ECS族名称。

ip_address Array of String 192.168.0.36

IP地址。

is_aliyun_node Boolean true

是否为阿里云实例。取值:

  • true:是阿里云实例。
  • false:不是阿里云实例。
node_name String cn-chengdu.192.168.0.36

节点名称,集群内节点标识。

node_status String Ready

节点是否就绪。取值:

  • Ready:节点已就绪。
  • NotReady:节点未就绪。
  • Unknown:未知。
  • Offline:离线中。
nodepool_id String np0794239424a84eb7a95327369d56****

节点池ID。

source String ess_attach

节点通过何种方式初始化,例如:手动创建或ROS创建。

state String running

节点运行状态。取值:

  • pending:创建中。
  • running:运行中。
  • starting:启动中。
  • stopping:停止中。
  • stopped:已停止。
spot_strategy String NoSpot

抢占式实例类型,取值:

  • NoSpot:非抢占式实例。
  • SpotWithPriceLimit:设置抢占实例价格上限。
  • SpotAsPriceGo:系统自动出价,跟随当前市场实际价格。
page Object

分页信息。

page_number Integer 1

页码。

page_size Integer 10

每页显示的记录数。

total_count Integer 5

结果总数。

查询集群节点示例

请求示例

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

正常返回示例

XML格式

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>
        <spot_strategy>NoSpot</spot_strategy>
    </nodes>
    <page>
        <page_number>1</page_number>
        <page_size>10</page_size>
        <total_count>5</total_count>
    </page>
</DescribeClusterNodesResponse>

JSON格式

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",
    "spot_strategy" : "NoSpot"
  } ],
  "page" : {
    "page_number" : 1,
    "page_size" : 10,
    "total_count" : 5
  }
}

错误码

访问错误中心查看更多错误码。

开发者资源

  • SDK

    阿里云为您提供多种语言的SDK,帮助您快速通过API集成阿里云的产品和服务,推荐您使用SDK调用API,已免除您手动签名验证。

  • OpenAPI Explorer

    快速检索,可视化调试API,在线命令行工具,同步动态生成可执行的SDK代码示例。

  • 阿里云CLI

    阿里云资产管理和配置工具,可通过命令方式同时管理多个阿里云产品和服务,简单快捷,是您上云好帮手。