文档首页 > > API参考> Kubernetes API> Node> 列出指定的Node

列出指定的Node

分享
更新时间:2020/06/23 GMT+08:00

功能介绍

This API is used to obtain a Node list.

URI

GET /api/v1/nodes

表1描述该API的参数。

表1 参数解释

参数

是否必选

描述

pretty

No

If 'true', then the output is pretty printed.

labelSelector

No

A selector to restrict the list of returned objects by their labels. Defaults to everything.

includeUninitialized

No

If true, partially initialized resources are included in the response.

fieldSelector

No

A selector to restrict the list of returned objects by their fields. Defaults to everything.

watch

No

Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.

resourceVersion

No

When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.

timeoutSeconds

No

Timeout for the list/watch call.

请求消息

N/A

响应消息

响应参数:

响应参数的详细描述请参见表4

响应示例:

{
    "kind": "NodeList",
    "apiVersion": "v1",
    "metadata": {
        "selfLink": "/api/v1/nodes",
        "resourceVersion": "153893"
    },
    "items": [
        {
            "metadata": {
                "name": "192.168.0.123",
                "namespace": "default",
                "selfLink": "/api/v1/namespaces/default/nodes/192.168.0.123",
                "uid": "8c7357aa-4ed8-11e8-ac4b-fa163e28d367",
                "resourceVersion": "153881",
                "creationTimestamp": "2018-05-03T13:47:41Z",
                "labels": {
                    "beta.kubernetes.io/arch": "amd64",
                    "beta.kubernetes.io/os": "linux",
                    "failure-domain.beta.kubernetes.io/region": "southchina",
                    "failure-domain.beta.kubernetes.io/zone": "az1.dc1",
                    "kubernetes.io/availablezone": "az1.dc1",
                    "kubernetes.io/hostname": "192.168.0.123",
                    "os.architecture": "amd64",
                    "os.name": "EulerOS_2.0_SP2",
                    "os.version": "3.10.0-327.59.59.46.h38.x86_64",
                    "supportContainer": "true"
                },
                "annotations": {
                    "alpha.kubernetes.io/provided-node-ip": "192.168.0.123",
                    "node.alpha.kubernetes.io/ttl": "0"
                },
                "enable": true
            },
            "spec": {
                "externalID": "192.168.0.123",
                "loginSecret": {},
                "schedulerHints": {}
            },
            "status": {
                "capacity": {
                    "nvidia.com/gpu": "4",
                    "cpu": "2",
                    "memory": "3744164Ki",
                    "pods": "110"
                },
                "allocatable": {
                    "nvidia.com/gpu": "4",
                    "cpu": "1930m",
                    "memory": "2705828Ki",
                    "pods": "110"
                },
                "phase": "Running",   # 1.13 及以上版本集群已经废弃,不会再返回此字段
                "conditions": [
                    {
                        "type": "OutOfDisk",
                        "status": "False",
                        "lastHeartbeatTime": "2018-05-04T07:38:14Z",
                        "lastTransitionTime": "2018-05-03T13:47:41Z",
                        "reason": "KubeletHasSufficientDisk",
                        "message": "kubelet has sufficient disk space available"
                    },
                    {
                        "type": "MemoryPressure",
                        "status": "False",
                        "lastHeartbeatTime": "2018-05-04T07:38:14Z",
                        "lastTransitionTime": "2018-05-03T13:47:41Z",
                        "reason": "KubeletHasSufficientMemory",
                        "message": "kubelet has sufficient memory available"
                    },
                    {
                        "type": "NetworkCardNotFound",
                        "status": "False",
                        "lastHeartbeatTime": "2018-05-04T07:38:14Z",
                        "lastTransitionTime": "2018-05-03T13:47:41Z",
                        "reason": "NetworkCardFound",
                        "message": "network card has found"
                    },
                    {
                        "type": "DiskPressure",
                        "status": "False",
                        "lastHeartbeatTime": "2018-05-04T07:38:14Z",
                        "lastTransitionTime": "2018-05-03T13:47:41Z",
                        "reason": "KubeletHasNoDiskPressure",
                        "message": "kubelet has no disk pressure"
                    },
                    {
                        "type": "Ready",
                        "status": "True",
                        "lastHeartbeatTime": "2018-05-04T07:38:14Z",
                        "lastTransitionTime": "2018-05-03T13:47:41Z",
                        "reason": "KubeletReady",
                        "message": "kubelet is posting ready status"
                    }
                ],
                "addresses": [
                    {
                        "type": "InternalIP",
                        "address": "192.168.0.123"
                    },
                    {
                        "type": "Hostname",
                        "address": "192.168.0.123"
                    },
                    {
                        "type": "DataIP",
                        "address": "192.168.0.123"
                    }
                ],
                "daemonEndpoints": {
                    "kubeletEndpoint": {
                        "Port": 10250
                    }
                },
                "nodeInfo": {
                    "machineID": "ca7caac8-f192-4a29-8ad5-64e287b39ea9",
                    "systemUUID": "7D7F913C-6E32-44C4-BDAE-782D859E7A0B",
                    "bootID": "1b89eab6-92f3-4352-9613-61c2edf6ee4b",
                    "kernelVersion": "3.10.0-327.59.59.46.h38.x86_64",
                    "osImage": "EulerOS 2.0 (SP2)",
                    "containerRuntimeVersion": "docker://1.11.2",
                    "kubeletVersion": "v1.7.3-CCE2.0.7-B003",
                    "kubeProxyVersion": "v1.7.3-CCE2.0.7-B003",
                    "operatingSystem": "linux",
                    "architecture": "amd64"
                },
                "images": [
                    {
                        "names": [
                            "canal-agent:2.5.T8.B020",
                            "canal-agent:latest"
                        ],
                        "sizeBytes": 479214058
                    },
                    {
                        "names": [
                            "cfe-kubedns-amd64:3.7.6"
                        ],
                        "sizeBytes": 335112956
                    },
                    {
                        "names": [
                            "cfe-exechealthz-amd64:3.7.6"
                        ],
                        "sizeBytes": 326813281
                    },
                    {
                        "names": [
                            "cfe-kube-dnsmasq-amd64:3.7.6"
                        ],
                        "sizeBytes": 325716517
                    },
                    {
                        "names": [
                            "euleros:2.2.5"
                        ],
                        "sizeBytes": 288596478
                    },
                    {
                        "names": [
                            "10.125.5.235:20202/test/apache-php:latest"
                        ],
                        "sizeBytes": 244663227
                    },
                    {
                        "names": [
                            "10.125.5.235:20202/test/redis:latest"
                        ],
                        "sizeBytes": 182837415
                    },
                    {
                        "names": [
                            "10.125.5.235:20202/test/redis:v1"
                        ],
                        "sizeBytes": 109208225
                    },
                    {
                        "names": [
                            "cfe-pause:3.7.6"
                        ],
                        "sizeBytes": 350164
                    }
                ],
                "nodeState": {},
                "hostname": "wj53-64095.novalocal"
            }
        }
    ],
    "httpcode": 200,
    "header": {
        "Transfer-Encoding": "chunked",
        "X-Frame-Options": "SAMEORIGIN",
        "Strict-Transport-Security": "max-age=31536000; includeSubdomains;",
        "Server": "Web Server",
        "X-Content-Type-Options": "nosniff",
        "Connection": "keep-alive",
        "X-Download-Options": "noopen",
        "Set-Cookie": "937fe3f5c57648aa8fb270f46ce19b3d=WyIxODE0MTc3NzEwIl0; Expires=Sat, 05-May-18 07:38:19 GMT; Domain=192.145.50.250; Path=/; Secure; HttpOnly",
        "X-XSS-Protection": "1; mode=block;",
        "Date": "Fri, 04 May 2018 07:38:19 GMT",
        "Content-Type": "application/json"
    }
}

状态码

表2描述API的状态码。

表2 状态码

状态码

描述

200

This operation succeeds, and the JSONs of a group of Node objects are returned.

异常状态码请参见状态码

分享:

    相关文档

    相关产品

文档是否有解决您的问题?

提交成功!非常感谢您的反馈,我们会继续努力做到更好!
反馈提交失败,请稍后再试!

*必选

请至少选择或填写一项反馈信息

字符长度不能超过200

提交反馈 取消

如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨

智能客服提问云社区提问