首页 / API 文档 / 平台管理 / 集群管理 / 节点管理 / 查看节点列表

查看节点列表

请求信息

请求行

GET /kubernetes/{cluster}/api/v1/nodes

查看节点列表。

请求参数

名称 类型 是否必填项 描述
allowWatchBookmarks boolean allowWatchBookmarks 请求查看类型为“BOOKMARK”的事件。 不实施书签的服务器可能会忽略此标志,并且书签由服务器自行决定发送。 客户端不应假定书签会在任何特定时间间隔返回,也不应假定服务器将在会话期间发送任何 BOOKMARK 事件。 如果这不是手表,则忽略此字段。 如果 apiserver 中未启用功能门 WatchBookmarks,则忽略此字段。该字段为测试版。
continue string 服务器定义的值,⽤于从服务器中查询更多的返回结果。客户端只能从上⼀个查询结果中获取该值。当查询列表时设置了limit 参数,返回结果未包含服务器上可以查询到的所有数据,此时,会返回 continue 参数,并为 continue 参数赋值⼀个 Token。需要查询更多返回结果时,可将 continue 参数及其值作为查询参数查询更多结果。 说明:如果列表配置发⽣变化或查询过期,输⼊此查询参数后,会返回 410 错误码,如果继续输⼊该查询参数进⾏查询,返回的查询结果可能不是最新的数据。
fieldSelector string 字段选择器,可通过资源对象的字段过滤、筛选资源对象,默认返回所有资源对象。
labelSelector string 标签选择器,可通过标签过滤、筛选资源对象,默认返回所有资源对象。
limit integer limit 是查询列表请求返回的最大响应数。 如果存在更多项,则服务器会将列表元数据上的 “continue” 字段设置为一个值,该值可与相同的初始查询一起使用用来检索下一组结果。如果所有请求的对象都被过滤掉了,则设置的限制返回的项目数可能少于请求的项目数(最多为零),并且客户端应仅使用 continue 字段的存在来确定是否有更多结果可用。服务器可能选择不支持 limit 参数,并将返回所有可用结果。如果指定了限制,并且 continue 字段为空,则客户端可能会认为没有更多结果可用。如果 watch 为 true,则不支持此字段。 服务器保证使用 continue 时返回的对象与发出单个列表调用无限制地相同,也就是说,在发出第一个请求后,任何创建、修改或删除的对象都不会包含在任何后续的继续请求中。有时这被称为一致快照,并确保使用限制接收非常大结果的较小块的客户端可以确保它们看到所有可能的对象。如果在分块列表期间更新对象,则将返回在计算第一个列表结果时存在的对象版本。
resourceVersion string 当指定使用 watch 请求时,将显示在资源的特定版本之后发生的更改。默认从历史开始更改。当为 list 指定时:-如果未设置,则基于 quora -read 标志从远程存储返回结果;-如果它是 0,那么我们只是返回我们目前在缓存,没有保证;-如果设置为非零,那么结果至少与给定的 resourceVersion 一样为最新的值。
timeoutSeconds integer list/watch 方法的调用超时时长。这限制了调用的持续时间,不管是否活跃。
watch boolean 观察对所描述的资源的更改,并将其作为添加、更新和删除通知的流返回。需要指定 resourceVersion。
pretty string 如果为 true,则会将返回结果输出成适合打印的格式。

返回信息

Content-Type application/json, application/yaml, application/vnd.kubernetes.protobuf, application/json;stream=watch, application/vnd.kubernetes.protobuf;stream=watch

状态码: 200

OK

返回体示例

NodeList 是已注册到 master 的所有节点的完整列表。

{
   "apiVersion": "v1",
   "items": [
     {
       "apiVersion": "v1",
       "kind": "Node",
       "metadata": {
         "annotations": {
           "cpaas.io/display-name": "",
           "kubeadm.alpha.kubernetes.io/cri-socket": "/var/run/dockershim.sock",
           "node.alpha.kubernetes.io/ttl": "0",
           "ovn.kubernetes.io/allocated": "true",
           "ovn.kubernetes.io/chassis": "8a13eb92-aee5-46ba-b569-ae6b88535ad8",
           "ovn.kubernetes.io/cidr": "100.64.0.0/16",
           "ovn.kubernetes.io/gateway": "100.64.0.1",
           "ovn.kubernetes.io/ip_address": "100.64.0.4",
           "ovn.kubernetes.io/logical_switch": "join",
           "ovn.kubernetes.io/mac_address": "00:00:00:26:9C:BD",
           "ovn.kubernetes.io/port_name": "node-192.168.0.104",
           "volumes.kubernetes.io/controller-managed-attach-detach": "true"
         },
         "creationTimestamp": "2022-04-10T07:10:25Z",
         "labels": {
           "alertmanager": "true",
           "beta.kubernetes.io/arch": "amd64",
           "beta.kubernetes.io/os": "linux",
           "cpaas-system-alb": "",
           "kube-ovn/role": "master",
           "kubernetes.io/arch": "amd64",
           "kubernetes.io/hostname": "192.168.0.104",
           "kubernetes.io/os": "linux",
           "node-role.kubernetes.io/control-plane": "",
           "node-role.kubernetes.io/master": "",
           "node.kubernetes.io/exclude-from-external-load-balancers": "",
           "nvidia-device-enable": "false",
           "platform.tkestack.io/machine-ip": "192.168.0.104"
         },
         "name": "192.168.0.104",
         "resourceVersion": "3883789",
         "uid": "66657421-cd82-43f1-b527-386be0cfa9be"
       },
       "spec": {
         "podCIDR": "172.199.0.0/24",
         "podCIDRs": [
           "172.199.0.0/24"
         ]
       },
       "status": {
         "addresses": [
           {
             "address": "192.168.0.104",
             "type": "InternalIP"
           },
           {
             "address": "192.168.0.104",
             "type": "Hostname"
           }
         ],
         "allocatable": {
           "cpu": "23800m",
           "ephemeral-storage": "193000915035",
           "hugepages-1Gi": "0",
           "hugepages-2Mi": "0",
           "memory": "48164932Ki",
           "pods": "110"
         },
         "capacity": {
           "cpu": "24",
           "ephemeral-storage": "209419396Ki",
           "hugepages-1Gi": "0",
           "hugepages-2Mi": "0",
           "memory": "49291332Ki",
           "pods": "110"
         },
         "conditions": [
           {
             "lastHeartbeatTime": "2022-04-12T08:09:37Z",
             "lastTransitionTime": "2022-04-10T07:29:09Z",
             "message": "Kubelet has sufficient FileDescriptor available",
             "reason": "NodeHasSufficientFD",
             "status": "False",
             "type": "NodeHasInsufficientFD"
           },
           {
             "lastHeartbeatTime": "2022-04-12T08:09:37Z",
             "lastTransitionTime": "2022-04-10T07:29:09Z",
             "message": "kernel has no deadlock",
             "reason": "KernelHasNoDeadlock",
             "status": "False",
             "type": "KernelDeadlock"
           },
           {
             "lastHeartbeatTime": "2022-04-12T08:05:45Z",
             "lastTransitionTime": "2022-04-10T07:10:25Z",
             "message": "kubelet has sufficient memory available",
             "reason": "KubeletHasSufficientMemory",
             "status": "False",
             "type": "MemoryPressure"
           },
           {
             "lastHeartbeatTime": "2022-04-12T08:05:45Z",
             "lastTransitionTime": "2022-04-10T07:10:25Z",
             "message": "kubelet has no disk pressure",
             "reason": "KubeletHasNoDiskPressure",
             "status": "False",
             "type": "DiskPressure"
           },
           {
             "lastHeartbeatTime": "2022-04-12T08:05:45Z",
             "lastTransitionTime": "2022-04-10T07:10:25Z",
             "message": "kubelet has sufficient PID available",
             "reason": "KubeletHasSufficientPID",
             "status": "False",
             "type": "PIDPressure"
           },
           {
             "lastHeartbeatTime": "2022-04-12T08:05:45Z",
             "lastTransitionTime": "2022-04-10T07:15:58Z",
             "message": "kubelet is posting ready status",
             "reason": "KubeletReady",
             "status": "True",
             "type": "Ready"
           }
         ],
         "daemonEndpoints": {
           "kubeletEndpoint": {
             "Port": 10250
           }
         },
         "images": [
           {
             "names": [
               "registry.alauda.cn:60080/tkestack/kube-apiserver@sha256:eb81528afdbd996242cfbf6f6d53ec3529da43e0a1970b61a7454d8dc910ba19",
               "registry.alauda.cn:60080/tkestack/kube-apiserver:v1.21.10"
             ],
             "sizeBytes": 137667869
           },
           {
             "names": [
               "registry.alauda.cn:60080/tkestack/kube-controller-manager@sha256:1db444412ada7729572f9cdb155ab7ba891520e09524093a2eeb0d28096f2dbd",
               "registry.alauda.cn:60080/tkestack/kube-controller-manager:v1.21.10"
             ],
             "sizeBytes": 131876125
           },
           {
             "names": [
               "registry.alauda.cn:60080/tkestack/provider-res@sha256:9504457bff6f0682e7493f94de2a4fa9d6e526a8978159cecf7b416af343010b",
               "registry.alauda.cn:60080/tkestack/provider-res:v1.21.10-1"
             ],
             "sizeBytes": 491112019
           }
         ],
         "nodeInfo": {
           "architecture": "amd64",
           "bootID": "7fe24634-a4f3-4428-84ca-bfaa8b2b9c98",
           "containerRuntimeVersion": "docker://20.10.7",
           "kernelVersion": "3.10.0-1127.el7.x86_64",
           "kubeProxyVersion": "v1.21.10",
           "kubeletVersion": "v1.21.10",
           "machineID": "bd6671f674d549828e2eb9967e126403",
           "operatingSystem": "linux",
           "osImage": "CentOS Linux 7 (Core)",
           "systemUUID": "4AF1EFAB-FBC0-4CBE-B91D-54119CE8A6AF"
         }
       }
     }
   ],
   "kind": "List",
   "metadata": {
     "resourceVersion": "",
     "selfLink": ""
   }
 }

返回体说明

名称 类型 描述
apiVersion string 查看公共参数
items array 节点列表。
字段路径:items
items[] object Node 是 Kubernetes 中的工作节点。 每个节点在缓存中都有一个唯一的标识符(即在 etcd 中)。
字段路径:items[]
items[].apiVersion string 查看公共参数
items[].kind string 查看公共参数
items[].metadata object 查看公共参数
items[].spec object NodeSpec 描述了创建节点时使用的属性。
字段路径:items[].spec
spec.podCIDR string PodCIDR 表示分配给节点的 pod IP 范围。
字段路径:items[].spec.podCIDR
spec.podCIDRs array podCIDRs 表示分配给节点以供该节点上的 Pod 使用的 IP 范围。 如果指定了该字段,则第 0 个条目必须与 podCIDR 字段匹配。 对于 IPv4 和 IPv6,它最多可以包含 1 个值。
字段路径:items[].spec.podCIDRs
spec.podCIDRs[] string
字段路径:items[].spec.podCIDRs[]
items[].status object NodeStatus 是有关节点当前状态的信息。
字段路径:items[].status
status.addresses array 节点可到达的地址列表。 从云提供商处查询(如果有)。 更多信息:https://kubernetes.io/docs/concepts/nodes/node/#addresses 注意:该字段声明为可合并,但合并键不够唯一,合并时可能导致数据损坏。 调用者应改为使用完全替换补丁。 有关示例,请参见 http://pr.k8s.io/79391。
字段路径:items[].status.addresses
status.addresses[] object NodeAddress 包含了节点的地址信息。
字段路径:items[].status.addresses[]
addresses[].address string 节点地址。
字段路径:items[].status.addresses[].address
addresses[].type string 节点地址类型,可选 Hostname、ExternalIP、InternalIP。
字段路径:items[].status.addresses[].type
status.allocatable object Allocatable 表示节点的可用于调度的资源。 默认为容量。
字段路径:items[].status.allocatable
status.capacity object 容量代表一个节点的总资源。 更多信息:https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity
字段路径:items[].status.capacity
status.conditions array 条件是当前观察到的节点条件的数组。 更多信息:https://kubernetes.io/docs/concepts/nodes/node/#condition
字段路径:items[].status.conditions
status.conditions[] object NodeCondition 包含节点的条件信息。
字段路径:items[].status.conditions[]
conditions[].lastHeartbeatTime string (date-time) Time 是时间的包装。Time 支持正确的封送到 YAML 和 JSON。时间包提供方的许多工厂方法都提供了包装器。
字段路径:items[].status.conditions[].lastHeartbeatTime
conditions[].lastTransitionTime string (date-time) Time 是时间的包装。Time 支持正确的封送到 YAML 和 JSON。时间包提供方的许多工厂方法都提供了包装器。
字段路径:items[].status.conditions[].lastTransitionTime
conditions[].message string 状态转换的详细可读信息。
字段路径:items[].status.conditions[].message
conditions[].reason string (简要)条件最后一次转换的原因。
字段路径:items[].status.conditions[].reason
conditions[].status string 条件的状态,包括:True、False、Unknown。
字段路径:items[].status.conditions[].status
conditions[].type string 节点条件的类型。
字段路径:items[].status.conditions[].type
status.daemonEndpoints object NodeDaemonEndpoints 列出了节点上运行的守护进程打开的端口。
字段路径:items[].status.daemonEndpoints
daemonEndpoints.kubeletEndpoint object DaemonEndpoint 包含有关单个 Daemon 端点的信息。
字段路径:items[].status.daemonEndpoints.kubeletEndpoint
kubeletEndpoint.Port integer (int32) 给定端点的端口号。
字段路径:items[].status.daemonEndpoints.kubeletEndpoint.Port
status.images array 该节点上的容器镜像列表。
字段路径:items[].status.images
status.images[] object 描述了一个容器镜像。
字段路径:items[].status.images[]
images[].names array 已知的此镜像的名称。 例如 ["k8s.gcr.io/hyperkube:v1.0.7", "dockerhub.io/google_containers/hyperkube:v1.0.7"]
字段路径:items[].status.images[].names
images[].names[] string
字段路径:items[].status.images[].names[]
images[].sizeBytes integer (int64) 镜像的大小(以字节为单位)。
字段路径:items[].status.images[].sizeBytes
status.nodeInfo object NodeSystemInfo 是一组用于唯一标识节点的 ids/uuids。
字段路径:items[].status.nodeInfo
nodeInfo.architecture string 节点记录的架构。
字段路径:items[].status.nodeInfo.architecture
nodeInfo.bootID string 节点记录的 Boot id。
字段路径:items[].status.nodeInfo.bootID
nodeInfo.containerRuntimeVersion string 节点通过运行时远程 API 报告的 ContainerRuntime 版本(例如 docker://1.5.0)。
字段路径:items[].status.nodeInfo.containerRuntimeVersion
nodeInfo.kernelVersion string 节点从“uname -r”报告的内核版本(例如 3.16.0-0.bpo.4-amd64)。
字段路径:items[].status.nodeInfo.kernelVersion
nodeInfo.kubeProxyVersion string 节点记录的 KubeProxy 版本。
字段路径:items[].status.nodeInfo.kubeProxyVersion
nodeInfo.kubeletVersion string 节点记录的 Kubelet 版本。
字段路径:items[].status.nodeInfo.kubeletVersion
nodeInfo.machineID string 节点记录的 MachineID。作为集群中唯一的节点识别,此字段是首选的。更多信息:http://man7.org/linux/man-pages/man5/machine-id.5.html
字段路径:items[].status.nodeInfo.machineID
nodeInfo.operatingSystem string 节点记录的操作系统。
字段路径:items[].status.nodeInfo.operatingSystem
nodeInfo.osImage string 节点从 /etc/os-release 报告的操作系统镜像(例如 Debian GNU/Linux 7 (wheezy))。
字段路径:items[].status.nodeInfo.osImage
nodeInfo.systemUUID string 节点记录的 SystemUUID。作为唯一的节点识别,此字段是首选的。更多信息:https://access.redhat.com/documentation/en-US/Red_Hat_Subscription_Management/1/html/RHSM/getting-system-uuid.html
字段路径:items[].status.nodeInfo.systemUUID
kind string 查看公共参数
metadata object 查看公共参数

其他状态码

状态码: 401

Unauthorized