Listing All Nodes
Function
This API is used to obtain a node list.
URI
GET /api/v1/nodes
Table 1 describes the parameters of this API.
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
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. |
Request
N/A
Response
Response parameters:
For the description about response parameters, see Table 4.
Example response:
{
"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", #This field will not be returned if the cluster version is 1.13 or later.
"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"
}
}
Status Code
Table 2 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
200 |
This operation succeeds, and the JSONs of a group of Node objects are returned. |
For the description about error status codes, see Status Code.
Last Article: Reading a Specified Node
Next Article: Updating a Specified Node
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.