tencent cloud

Feedback

DescribeClusterInstances

Last updated: 2024-11-25 12:07:30

1. API Description

Domain name for API request: tke.intl.tencentcloudapi.com.

This API is used to query the information of node instances in a cluster.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: DescribeClusterInstances.
Version Yes String Common Params. The value used for this API: 2022-05-01.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
ClusterId Yes String Cluster ID
Offset No Integer Offset. Default value: 0. For more information on Offset, see the relevant sections in API Overview.
Limit No Integer Number of returned results. Default value: 20, maximum value: 100. For more information on Limit, see the relevant sections in API Overview.
Filters.N No Array of Filter Filter criteria list:
InstanceIds (Instance ID), InstanceType (Instance type: Regular, Native, Virtual, External), VagueIpAddress (Fuzzy matching IP), Labels (k8s node label), NodePoolNames (Node pool name), VagueInstanceName (Fuzzy matching node name), InstanceStates (Node status), Unschedulable (Cordoning status), NodePoolIds (Node pool ID)
SortBy No SortBy Sorting information

3. Output Parameters

Parameter Name Type Description
TotalCount Integer Total number of instances in the cluster
InstanceSet Array of Instance List of instances in the cluster
Errors Array of String Error information collection
Note: This field may return "null", indicating that no valid value can be obtained.
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Querying the information of instances in a cluster

This example shows you how to query the information of instances in a cluster.

Input Example

POST / HTTP/1.1
Host: tke.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeClusterInstances
<Common request parameters>

{
    "ClusterId": "cls-7ph3twqe"
}

Output Example

{
    "Response": {
        "TotalCount": 4,
        "InstanceSet": [
            {
                "CreatedTime": "2023-08-17 13:17:57 +0000 UTC",
                "External": {
                    "CPU": 2,
                    "K8SVersion": "v1.26.1-tke.1",
                    "Memory": 1,
                    "Name": "node-10.0.6.x"
                },
                "FailedReason": "",
                "InstanceId": "node-10.0.6.x",
                "InstanceRole": "WORKER",
                "InstanceState": "running",
                "LanIP": "10.0.6.x",
                "Native": null,
                "NodePoolId": "np-xxxxx",
                "NodeType": "External",
                "Regular": null,
                "Super": null,
                "Unschedulable": false
            },
            {
                "CreatedTime": "2023-08-17 20:47:35 +0800 CST",
                "External": null,
                "FailedReason": null,
                "InstanceId": "eklet-subnet-xxxx-yyyy",
                "InstanceRole": "WORKER",
                "InstanceState": "running",
                "LanIP": "a.b.c.d",
                "Native": null,
                "NodePoolId": "np-yyyyy",
                "NodeType": "Super",
                "Regular": null,
                "Super": {
                    "ActiveAt": null,
                    "AutoRenewFlag": null,
                    "CPU": null,
                    "ExpireAt": null,
                    "InstanceAttribute": null,
                    "MaxCPUScheduledPod": null,
                    "Memory": null,
                    "Name": "",
                    "ResourceType": null,
                    "SubnetId": "subnet-xxxxx",
                    "UsedCPU": null,
                    "UsedMemory": null,
                    "VpcId": null,
                    "Zone": null
                },
                "Unschedulable": false
            },
            {
                "CreatedTime": "2023-08-17 12:46:40 +0000 UTC",
                "External": null,
                "FailedReason": "=",
                "InstanceId": "np-xxxx-yyyy",
                "InstanceRole": "WORKER",
                "InstanceState": "running",
                "LanIP": "10.0.0.x",
                "Native": {
                    "CPU": 2,
                    "CreatedAt": "2023-08-17 20:46:39",
                    "DisplayName": "tke-np-xxxx-worker",
                    "ExpiredTime": "",
                    "GPU": 0,
                    "InstanceChargeType": "POSTPAID_BY_HOUR",
                    "InstanceFamily": "S2",
                    "InstanceType": "S2.MEDIUM2",
                    "InternetAccessible": {
                        "BandwidthPackageId": "",
                        "ChargeType": "",
                        "MaxBandwidthOut": 0
                    },
                    "IsProtectedFromScaleIn": false,
                    "LanIp": "10.0.0.x",
                    "LoginStatus": "Opened",
                    "MachineName": "np-xxxx-yyyy",
                    "MachineState": "Running",
                    "Memory": 2,
                    "OsImage": "TencentOS Server 3.1 (Final)",
                    "PayMode": "POSTPAID_BY_HOUR",
                    "RenewFlag": "",
                    "SecurityGroupIDs": [
                        "sg-ccccc"
                    ],
                    "SubnetId": "subnet-nqx1ymwm",
                    "VpcId": "vpc-zzzzz",
                    "Zone": "ap-guangzhou-3"
                },
                "NodePoolId": "np-xxxx",
                "NodeType": "Native",
                "Regular": null,
                "Super": null,
                "Unschedulable": false
            },
            {
                "CreatedTime": "2023-08-17 12:35:42 +0000 UTC",
                "External": null,
                "FailedReason": "=Ready:True",
                "InstanceId": "ins-aaaaaa",
                "InstanceRole": "WORKER",
                "InstanceState": "running",
                "LanIP": "10.0.0.x",
                "Native": null,
                "NodePoolId": "",
                "NodeType": "Regular",
                "Regular": {
                    "AutoscalingGroupId": "",
                    "InstanceAdvancedSettings": {
                        "DesiredPodNumber": 64,
                        "ExtraArgs": {
                            "Kubelet": null
                        },
                        "PreStartUserScript": null,
                        "RuntimeConfig": null,
                        "UserScript": ""
                    }
                },
                "Super": null,
                "Unschedulable": false
            }
        ],
        "Errors": [],
        "RequestId": "42c27fd7-e2ca-48b2-9f4e-acdb9eef6ee7"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
InternalError Internal error.
InternalError.Db db error.
InternalError.DbAffectivedRows DB error.
InternalError.InitMasterFailed Initializing Master failed.
InternalError.Param Param error.
InternalError.PublicClusterOpNotSupport Public clusters do not support node expansion.
InternalError.UnexceptedInternal Internal error.
InternalError.UnexpectedInternal Unknown internal error.
InvalidParameter.ClusterNotFound The cluster ID does not exist.
InvalidParameter.Param Parameter error.
ResourceNotFound The resource does not exist.
ResourceUnavailable.ClusterState The cluster status does not support this operation.