open-nomad/website/source/api/nodes.html.md

1030 lines
27 KiB
Markdown
Raw Normal View History

2017-05-26 23:17:07 +00:00
---
layout: api
page_title: Nodes - HTTP API
sidebar_current: api-nodes
description: |-
The /node endpoints are used to query for and interact with client nodes.
---
# Nodes HTTP API
The `/node` endpoints are used to query for and interact with client nodes.
## List Nodes
2017-05-26 23:17:07 +00:00
This endpoint lists all nodes registered with Nomad.
| Method | Path | Produces |
| ------ | ------------------------- | -------------------------- |
| `GET` | `/v1/nodes` | `application/json` |
The table below shows this endpoint's support for
2017-05-31 01:08:23 +00:00
[blocking queries](/api/index.html#blocking-queries) and
2017-05-26 23:17:07 +00:00
[required ACLs](/api/index.html#acls).
2017-05-31 00:31:16 +00:00
| Blocking Queries | ACL Required |
| ---------------- | ------------ |
2017-09-15 05:01:18 +00:00
| `YES` | `node:read` |
2017-05-26 23:17:07 +00:00
### Parameters
- `prefix` `(string: "")`- Specifies a string to filter nodes based on an ID
prefix. Because the value is decoded to bytes, the prefix must have an even
number of hexadecimal characters (0-9a-f). This is specified as a query
string parameter.
2017-05-26 23:17:07 +00:00
### Sample Request
```text
$ curl \
2018-04-12 18:34:01 +00:00
http://localhost:4646/v1/nodes
2017-05-26 23:17:07 +00:00
```
```text
$ curl \
http://localhost:4646/v1/nodes?prefix=f7476465
2017-05-26 23:17:07 +00:00
```
### Sample Response
```json
[
{
2018-04-12 18:34:01 +00:00
"Address": "10.138.0.5",
"CreateIndex": 6,
2017-05-26 23:17:07 +00:00
"Datacenter": "dc1",
"Drain": false,
"Drivers": {
"java": {
"Attributes": {
"driver.java.runtime": "OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-1~deb9u1-b12)",
"driver.java.vm": "OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)",
"driver.java.version": "openjdk version \"1.8.0_162"
},
"Detected": true,
"HealthDescription": "",
"Healthy": true,
"UpdateTime": "2018-04-11T23:33:48.781948669Z"
},
"qemu": {
"Attributes": null,
"Detected": false,
"HealthDescription": "",
"Healthy": false,
"UpdateTime": "2018-04-11T23:33:48.7819898Z"
},
"rkt": {
"Attributes": {
"driver.rkt.appc.version": "0.8.11",
"driver.rkt.volumes.enabled": "1",
"driver.rkt.version": "1.29.0"
},
"Detected": true,
"HealthDescription": "Driver rkt is detected: true",
"Healthy": true,
"UpdateTime": "2018-04-11T23:34:48.81079772Z"
},
"docker": {
"Attributes": {
"driver.docker.bridge_ip": "172.17.0.1",
"driver.docker.version": "18.03.0-ce",
"driver.docker.volumes.enabled": "1"
},
"Detected": true,
"HealthDescription": "Driver is available and responsive",
"Healthy": true,
"UpdateTime": "2018-04-11T23:34:48.713720323Z"
},
"exec": {
"Attributes": {},
"Detected": true,
"HealthDescription": "Driver exec is detected: true",
"Healthy": true,
"UpdateTime": "2018-04-11T23:34:48.711026521Z"
},
"raw_exec": {
"Attributes": {},
"Detected": true,
"HealthDescription": "",
"Healthy": true,
"UpdateTime": "2018-04-11T23:33:48.710448534Z"
}
},
2018-04-12 18:34:01 +00:00
"ID": "f7476465-4d6e-c0de-26d0-e383c49be941",
"ModifyIndex": 2526,
"Name": "nomad-4",
"NodeClass": "",
"SchedulingEligibility": "eligible",
2017-05-26 23:17:07 +00:00
"Status": "ready",
"StatusDescription": "",
2018-04-12 18:34:01 +00:00
"Version": "0.8.0-rc1"
2017-05-26 23:17:07 +00:00
}
]
```
## Read Node
This endpoint queries the status of a client node.
| Method | Path | Produces |
| ------ | ------------------------- | -------------------------- |
| `GET` | `/v1/node/:node_id` | `application/json` |
The table below shows this endpoint's support for
2017-05-31 01:08:23 +00:00
[blocking queries](/api/index.html#blocking-queries) and
2017-05-26 23:17:07 +00:00
[required ACLs](/api/index.html#acls).
2017-09-15 03:59:18 +00:00
| Blocking Queries | ACL Required |
| ---------------- | ----------------- |
| `YES` | `node:read` |
2017-05-26 23:17:07 +00:00
### Parameters
- `:node_id` `(string: <required>)`- Specifies the ID of the node. This must be
the full UUID, not the short 8-character one. This is specified as part of the
path.
### Sample Request
```text
$ curl \
2018-04-12 18:34:01 +00:00
http://localhost:4646/v1/node/f7476465-4d6e-c0de-26d0-e383c49be941
2017-05-26 23:17:07 +00:00
```
### Sample Response
```json
{
"Attributes": {
2019-08-26 12:09:14 +00:00
"consul.datacenter": "dc1",
"consul.revision": "d2adfc0bd",
2019-08-26 12:09:14 +00:00
"consul.server": "true",
"consul.version": "1.5.2",
"cpu.arch": "amd64",
"cpu.frequency": "4000",
"cpu.modelname": "Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz",
2019-08-26 12:09:14 +00:00
"cpu.numcores": "8",
"cpu.totalcompute": "32000",
"driver.docker": "1",
2018-04-12 18:34:01 +00:00
"driver.docker.bridge_ip": "172.17.0.1",
2019-08-26 12:09:14 +00:00
"driver.docker.os_type": "linux",
"driver.docker.runtimes": "runc",
"driver.docker.version": "18.09.6",
"driver.docker.volumes.enabled": "true",
"driver.mock": "true",
"driver.mock_driver": "1",
2018-04-12 18:34:01 +00:00
"driver.raw_exec": "1",
"kernel.name": "linux",
"kernel.version": "4.19.56",
2019-08-26 12:09:14 +00:00
"memory.totalbytes": "16571674624",
"nomad.advertise.address": "127.0.0.1:4646",
"nomad.revision": "30da2b8f6c3aa860113c9d313c695a05eff5bb97+CHANGES",
"nomad.version": "0.10.0-dev",
"os.name": "nixos",
2019-08-26 12:09:14 +00:00
"os.signals": "SIGTTOU,SIGTTIN,SIGSTOP,SIGSYS,SIGXCPU,SIGBUS,SIGKILL,SIGTERM,SIGIOT,SIGILL,SIGIO,SIGQUIT,SIGSEGV,SIGUSR1,SIGXFSZ,SIGCHLD,SIGUSR2,SIGURG,SIGFPE,SIGHUP,SIGINT,SIGPROF,SIGCONT,SIGALRM,SIGPIPE,SIGTRAP,SIGTSTP,SIGWINCH,SIGABRT",
"os.version": "\"19.03.173017.85f820d6e41 (Koi)\"",
"unique.cgroup.mountpoint": "/sys/fs/cgroup",
"unique.consul.name": "mew",
"unique.hostname": "mew",
2019-08-26 12:09:14 +00:00
"unique.network.ip-address": "127.0.0.1",
"unique.storage.bytesfree": "8273698816",
"unique.storage.bytestotal": "8285835264",
"unique.storage.volume": "tmpfs"
2018-04-12 18:34:01 +00:00
},
"ComputedClass": "v1:390058673753570317",
2018-04-12 18:34:01 +00:00
"CreateIndex": 6,
"Datacenter": "dc1",
"Drain": false,
"DrainStrategy": null,
"Drivers": {
2019-08-26 12:09:14 +00:00
"docker": {
"Attributes": {
"driver.docker": "true",
"driver.docker.bridge_ip": "172.17.0.1",
"driver.docker.os_type": "linux",
"driver.docker.runtimes": "runc",
"driver.docker.version": "18.09.6",
"driver.docker.volumes.enabled": "true"
},
"Detected": true,
"HealthDescription": "Healthy",
"Healthy": true,
"UpdateTime": "2019-08-26T12:22:50.762716458+02:00"
},
"exec": {
"Attributes": null,
"Detected": false,
"HealthDescription": "Driver must run as root",
"Healthy": false,
"UpdateTime": "2019-08-26T12:22:50.6873373+02:00"
},
2019-08-26 12:09:14 +00:00
"java": {
2018-04-12 18:34:01 +00:00
"Attributes": null,
"Detected": false,
"HealthDescription": "Driver must run as root",
2018-04-12 18:34:01 +00:00
"Healthy": false,
2019-08-26 12:09:14 +00:00
"UpdateTime": "2019-08-26T12:22:50.687274359+02:00"
2018-04-12 18:34:01 +00:00
},
"mock_driver": {
2018-04-12 18:34:01 +00:00
"Attributes": {
"driver.mock": "true"
2018-04-12 18:34:01 +00:00
},
"Detected": true,
"HealthDescription": "Healthy",
2018-04-12 18:34:01 +00:00
"Healthy": true,
"UpdateTime": "2019-08-26T12:22:50.687978919+02:00"
},
"qemu": {
"Attributes": null,
"Detected": false,
"HealthDescription": "",
"Healthy": false,
"UpdateTime": "2019-08-26T12:22:50.688023782+02:00"
2018-04-12 18:34:01 +00:00
},
2019-08-26 12:09:14 +00:00
"raw_exec": {
2018-04-12 18:34:01 +00:00
"Attributes": {
2019-08-26 12:09:14 +00:00
"driver.raw_exec": "true"
2018-04-12 18:34:01 +00:00
},
"Detected": true,
"HealthDescription": "Healthy",
2018-04-12 18:34:01 +00:00
"Healthy": true,
2019-08-26 12:09:14 +00:00
"UpdateTime": "2019-08-26T12:22:50.687733347+02:00"
},
"rkt": {
"Attributes": null,
"Detected": false,
"HealthDescription": "Driver must run as root",
"Healthy": false,
"UpdateTime": "2019-08-26T12:22:50.68796043+02:00"
2018-04-12 18:34:01 +00:00
}
},
"Events": [
{
"CreateIndex": 0,
"Details": null,
2018-05-12 00:26:25 +00:00
"Message": "Node registered",
2018-04-12 18:34:01 +00:00
"Subsystem": "Cluster",
"Timestamp": "2019-08-26T12:22:50+02:00"
2018-04-12 18:34:01 +00:00
}
],
"HTTPAddr": "127.0.0.1:4646",
"HostVolumes": {
"certificates": {
"Name": "certificates",
"Path": "/etc/ssl/certs",
"ReadOnly": true
2019-08-26 12:09:14 +00:00
},
"prod-mysql-a": {
"Name": "prod-mysql-a",
"Path": "/data/mysql",
"ReadOnly": false
}
},
"ID": "1ac61e33-a465-2ace-f63f-cffa1285e7eb",
2018-04-12 18:34:01 +00:00
"Links": {
"consul": "dc1.mew"
},
"Meta": {
2019-08-26 12:09:14 +00:00
"connect.log_level": "info",
"connect.sidecar_image": "envoyproxy/envoy:v1.11.1"
2018-04-12 18:34:01 +00:00
},
"ModifyIndex": 9,
"Name": "mew",
2018-04-12 18:34:01 +00:00
"NodeClass": "",
"NodeResources": {
"Cpu": {
"CpuShares": 32000
},
"Devices": null,
"Disk": {
"DiskMB": 7890
},
"Memory": {
"MemoryMB": 15803
},
"Networks": [
{
"CIDR": "127.0.0.1/32",
"Device": "lo",
"DynamicPorts": null,
"IP": "127.0.0.1",
"MBits": 1000,
"Mode": "",
"ReservedPorts": null
},
{
"CIDR": "::1/128",
"Device": "lo",
"DynamicPorts": null,
"IP": "::1",
"MBits": 1000,
"Mode": "",
"ReservedPorts": null
}
]
},
2018-04-12 18:34:01 +00:00
"Reserved": {
"CPU": 0,
"Devices": null,
2018-04-12 18:34:01 +00:00
"DiskMB": 0,
"IOPS": 0,
2018-04-12 18:34:01 +00:00
"MemoryMB": 0,
"Networks": null
2017-05-26 23:17:07 +00:00
},
"ReservedResources": {
"Cpu": {
"CpuShares": 0
},
"Disk": {
"DiskMB": 0
},
"Memory": {
"MemoryMB": 0
},
"Networks": {
"ReservedHostPorts": ""
}
},
2017-05-26 23:17:07 +00:00
"Resources": {
"CPU": 32000,
"Devices": null,
"DiskMB": 7890,
"IOPS": 0,
"MemoryMB": 15803,
2017-05-26 23:17:07 +00:00
"Networks": [
{
"CIDR": "127.0.0.1/32",
"Device": "lo",
"DynamicPorts": null,
"IP": "127.0.0.1",
"MBits": 1000,
"Mode": "",
"ReservedPorts": null
},
{
"CIDR": "::1/128",
"Device": "lo",
2018-04-12 18:34:01 +00:00
"DynamicPorts": null,
"IP": "::1",
2017-05-26 23:17:07 +00:00
"MBits": 1000,
"Mode": "",
2018-04-12 18:34:01 +00:00
"ReservedPorts": null
2017-05-26 23:17:07 +00:00
}
]
},
2018-04-12 18:34:01 +00:00
"SchedulingEligibility": "eligible",
"SecretID": "",
2017-05-26 23:17:07 +00:00
"Status": "ready",
"StatusDescription": "",
"StatusUpdatedAt": 1566814982,
2018-04-12 18:34:01 +00:00
"TLSEnabled": false
2017-05-26 23:17:07 +00:00
}
```
## List Node Allocations
This endpoint lists all of the allocations for the given node. This can be used to
determine what allocations have been scheduled on the node, their current status,
and the values of dynamically assigned resources, like ports.
| Method | Path | Produces |
| ------- | ------------------------------- | -------------------------- |
| `GET` | `/v1/node/:node_id/allocations` | `application/json` |
The table below shows this endpoint's support for
[blocking queries](/api/index.html#blocking-queries) and
[required ACLs](/api/index.html#acls).
2017-09-15 04:42:19 +00:00
| Blocking Queries | ACL Required |
| ---------------- | ------------------------------ |
| `YES` | `node:read,namespace:read-job` |
### Parameters
- `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must
be the full UUID, not the short 8-character one. This is specified as part of
the path.
### Sample Request
```text
$ curl \
2018-04-12 18:34:01 +00:00
http://localhost:4646/v1/node/e02b6169-83bd-9df6-69bd-832765f333eb/allocations
```
### Sample Response
2017-08-07 21:34:18 +00:00
```json
[
{
2018-04-12 18:34:01 +00:00
"AllocModifyIndex": 2555,
"ClientDescription": "",
"ClientStatus": "running",
"CreateIndex": 2555,
"CreateTime": 1523490066575461000,
"DeploymentID": "",
"DeploymentStatus": {
"Healthy": true,
"ModifyIndex": 0
},
"DesiredDescription": "",
"DesiredStatus": "run",
"DesiredTransition": {
"Migrate": null
},
"EvalID": "5129bc74-9785-c39a-08da-bddc8aa778b1",
"FollowupEvalID": "",
"ID": "fefe81d0-08b2-4eca-fae6-6560cde46d31",
"Job": {
"AllAtOnce": false,
2018-04-12 18:34:01 +00:00
"Constraints": null,
"CreateIndex": 2553,
"Datacenters": [
"dc1"
],
2018-04-12 18:34:01 +00:00
"ID": "webapp",
"JobModifyIndex": 2553,
"Meta": null,
"ModifyIndex": 2554,
"Name": "webapp",
"Namespace": "default",
"ParameterizedJob": null,
"ParentID": "",
"Payload": null,
"Periodic": null,
"Priority": 50,
"Region": "global",
"Stable": false,
"Status": "pending",
"StatusDescription": "",
"Stop": false,
"SubmitTime": 1523490066563405000,
"TaskGroups": [
{
2018-04-12 18:34:01 +00:00
"Constraints": null,
"Count": 9,
"EphemeralDisk": {
"Migrate": false,
"SizeMB": 300,
"Sticky": false
},
"Meta": null,
"Migrate": {
"HealthCheck": "checks",
"HealthyDeadline": 300000000000,
2018-04-12 18:34:01 +00:00
"MaxParallel": 2,
"MinHealthyTime": 15000000000
},
"Name": "webapp",
"ReschedulePolicy": {
"Attempts": 0,
"Delay": 30000000000,
"DelayFunction": "exponential",
"Interval": 0,
"MaxDelay": 3600000000000,
"Unlimited": true
},
"RestartPolicy": {
2018-04-12 18:34:01 +00:00
"Attempts": 2,
"Delay": 15000000000,
"Interval": 1800000000000,
"Mode": "fail"
},
"Tasks": [
{
2018-04-12 18:34:01 +00:00
"Artifacts": null,
"Config": {
2018-04-12 18:34:01 +00:00
"args": [
"-text",
"ok4"
],
"image": "hashicorp/http-echo:0.2.3",
"port_map": [
{
2018-04-12 18:34:01 +00:00
"http": 5678
}
]
},
"Constraints": null,
2018-04-12 18:34:01 +00:00
"DispatchPayload": null,
"Driver": "docker",
"Env": null,
"KillSignal": "",
"KillTimeout": 5000000000,
"Leader": false,
"LogConfig": {
"MaxFileSizeMB": 10,
"MaxFiles": 10
},
"Meta": null,
"Name": "webapp",
"Resources": {
2018-04-12 18:34:01 +00:00
"CPU": 100,
"DiskMB": 0,
2018-04-12 18:34:01 +00:00
"MemoryMB": 300,
"Networks": [
{
"CIDR": "",
2018-04-12 18:34:01 +00:00
"Device": "",
"DynamicPorts": [
{
2018-04-12 18:34:01 +00:00
"Label": "http",
"Value": 0
}
2018-04-12 18:34:01 +00:00
],
"IP": "",
"MBits": 10,
"ReservedPorts": null
}
]
},
2018-04-12 18:34:01 +00:00
"Services": [
{
"AddressMode": "auto",
"Checks": [
{
"AddressMode": "",
"Args": null,
"CheckRestart": null,
"Command": "",
"Header": null,
"InitialStatus": "",
"Interval": 10000000000,
"Method": "",
"Name": "http-ok",
"Path": "/",
"PortLabel": "",
"Protocol": "",
"TLSSkipVerify": false,
"Timeout": 2000000000,
"Type": "http"
}
],
"Name": "webapp",
"PortLabel": "http",
"Tags": null
}
],
"ShutdownDelay": 0,
"Templates": null,
"User": "",
"Vault": null
}
],
2018-04-12 18:34:01 +00:00
"Update": null
}
],
2018-04-12 18:34:01 +00:00
"Type": "service",
"Update": {
2018-04-12 18:34:01 +00:00
"AutoRevert": false,
"Canary": 0,
"HealthCheck": "",
"HealthyDeadline": 0,
2018-04-12 18:34:01 +00:00
"MaxParallel": 0,
"MinHealthyTime": 0,
"Stagger": 0
},
"VaultToken": "",
2018-04-12 18:34:01 +00:00
"Version": 0
},
2018-04-12 18:34:01 +00:00
"JobID": "webapp",
"Metrics": {
"AllocationTime": 63337,
"ClassExhausted": null,
"ClassFiltered": null,
"CoalescedFailures": 0,
"ConstraintFiltered": null,
"DimensionExhausted": null,
"NodesAvailable": {
"dc1": 2
},
"NodesEvaluated": 2,
"NodesExhausted": 0,
"NodesFiltered": 0,
"QuotaExhausted": null,
"Scores": {
"46f1c6c4-a0e5-21f6-fd5c-d76c3d84e806.binpack": 2.6950883117541586,
"f7476465-4d6e-c0de-26d0-e383c49be941.binpack": 2.6950883117541586
}
},
"ModifyIndex": 2567,
"ModifyTime": 1523490089807324000,
"Name": "webapp.webapp[0]",
"Namespace": "default",
"NextAllocation": "",
"NodeID": "f7476465-4d6e-c0de-26d0-e383c49be941",
"PreviousAllocation": "",
"RescheduleTracker": null,
"Resources": {
2018-04-12 18:34:01 +00:00
"CPU": 100,
"DiskMB": 300,
2018-04-12 18:34:01 +00:00
"MemoryMB": 300,
"Networks": [
{
"CIDR": "",
2018-04-12 18:34:01 +00:00
"Device": "eth0",
"DynamicPorts": [
{
2018-04-12 18:34:01 +00:00
"Label": "http",
"Value": 25920
}
2018-04-12 18:34:01 +00:00
],
"IP": "10.138.0.5",
"MBits": 10,
"ReservedPorts": null
}
]
},
"SharedResources": {
"CPU": 0,
"DiskMB": 300,
2018-04-12 18:34:01 +00:00
"MemoryMB": 0,
"Networks": null
},
2018-04-12 18:34:01 +00:00
"TaskGroup": "webapp",
"TaskResources": {
2018-04-12 18:34:01 +00:00
"webapp": {
"CPU": 100,
"DiskMB": 0,
2018-04-12 18:34:01 +00:00
"MemoryMB": 300,
"Networks": [
{
"CIDR": "",
2018-04-12 18:34:01 +00:00
"Device": "eth0",
"DynamicPorts": [
{
2018-04-12 18:34:01 +00:00
"Label": "http",
"Value": 25920
}
2018-04-12 18:34:01 +00:00
],
"IP": "10.138.0.5",
"MBits": 10,
"ReservedPorts": null
}
]
}
},
"TaskStates": {
2018-04-12 18:34:01 +00:00
"webapp": {
"Events": [
{
2018-04-12 18:34:01 +00:00
"Details": {},
"DiskLimit": 0,
"DisplayMessage": "Task received by client",
"DownloadError": "",
"DriverError": "",
2018-04-12 18:34:01 +00:00
"DriverMessage": "",
"ExitCode": 0,
2018-04-12 18:34:01 +00:00
"FailedSibling": "",
"FailsTask": false,
"GenericSource": "",
"KillError": "",
"KillReason": "",
2018-04-12 18:34:01 +00:00
"KillTimeout": 0,
"Message": "",
"RestartReason": "",
"SetupError": "",
"Signal": 0,
"StartDelay": 0,
"TaskSignal": "",
2018-04-12 18:34:01 +00:00
"TaskSignalReason": "",
"Time": 1523490066712543500,
"Type": "Received",
"ValidationError": "",
"VaultError": ""
},
{
2018-04-12 18:34:01 +00:00
"Details": {
"message": "Building Task Directory"
},
"DiskLimit": 0,
"DisplayMessage": "Building Task Directory",
"DownloadError": "",
"DriverError": "",
2018-04-12 18:34:01 +00:00
"DriverMessage": "",
"ExitCode": 0,
2018-04-12 18:34:01 +00:00
"FailedSibling": "",
"FailsTask": false,
"GenericSource": "",
"KillError": "",
"KillReason": "",
2018-04-12 18:34:01 +00:00
"KillTimeout": 0,
"Message": "Building Task Directory",
"RestartReason": "",
"SetupError": "",
"Signal": 0,
"StartDelay": 0,
"TaskSignal": "",
2018-04-12 18:34:01 +00:00
"TaskSignalReason": "",
"Time": 1523490066715208000,
"Type": "Task Setup",
"ValidationError": "",
"VaultError": ""
},
{
2018-04-12 18:34:01 +00:00
"Details": {},
"DiskLimit": 0,
"DisplayMessage": "Task started by client",
"DownloadError": "",
"DriverError": "",
2018-04-12 18:34:01 +00:00
"DriverMessage": "",
"ExitCode": 0,
2018-04-12 18:34:01 +00:00
"FailedSibling": "",
"FailsTask": false,
"GenericSource": "",
"KillError": "",
"KillReason": "",
2018-04-12 18:34:01 +00:00
"KillTimeout": 0,
"Message": "",
"RestartReason": "",
"SetupError": "",
"Signal": 0,
"StartDelay": 0,
"TaskSignal": "",
2018-04-12 18:34:01 +00:00
"TaskSignalReason": "",
"Time": 1523490068433051100,
"Type": "Started",
"ValidationError": "",
"VaultError": ""
}
2018-04-12 18:34:01 +00:00
],
"Failed": false,
"FinishedAt": "0001-01-01T00:00:00Z",
"LastRestart": "0001-01-01T00:00:00Z",
"Restarts": 0,
"StartedAt": "2018-04-11T23:41:08.445128764Z",
"State": "running"
}
2018-04-12 18:34:01 +00:00
}
}
]
```
2017-05-26 23:17:07 +00:00
## Create Node Evaluation
This endpoint creates a new evaluation for the given node. This can be used to
force a run of the scheduling logic.
| Method | Path | Produces |
| ------- | ---------------------------- | -------------------------- |
| `POST` | `/v1/node/:node_id/evaluate` | `application/json` |
The table below shows this endpoint's support for
2017-05-31 01:08:23 +00:00
[blocking queries](/api/index.html#blocking-queries) and
2017-05-26 23:17:07 +00:00
[required ACLs](/api/index.html#acls).
2017-09-15 03:41:44 +00:00
| Blocking Queries | ACL Required |
| ---------------- | ------------------ |
| `NO` | `node:write` |
2017-05-26 23:17:07 +00:00
### Parameters
- `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must
be the full UUID, not the short 8-character one. This is specified as part of
the path.
### Sample Request
```text
$ curl \
2018-04-12 18:34:01 +00:00
http://localhost:4646/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/evaluate
2017-05-26 23:17:07 +00:00
```
### Sample Response
```json
{
2018-04-12 18:34:01 +00:00
"EvalCreateIndex": 3671,
2017-05-26 23:17:07 +00:00
"EvalIDs": [
2018-04-12 18:34:01 +00:00
"4dfc2db7-b481-c53b-3072-14479aa44be3"
2017-05-26 23:17:07 +00:00
],
2018-04-12 18:34:01 +00:00
"HeartbeatTTL": 0,
"Index": 3671,
"KnownLeader": false,
"LastContact": 0,
"LeaderRPCAddr": "10.138.0.2:4647",
2017-05-26 23:17:07 +00:00
"NodeModifyIndex": 0,
2018-04-12 18:34:01 +00:00
"NumNodes": 3,
2017-05-26 23:17:07 +00:00
"Servers": [
{
2018-04-12 18:34:01 +00:00
"Datacenter": "dc1",
"RPCAdvertiseAddr": "10.138.0.2:4647",
2017-05-26 23:17:07 +00:00
"RPCMajorVersion": 1,
2018-04-12 18:34:01 +00:00
"RPCMinorVersion": 1
},
{
"Datacenter": "dc1",
"RPCAdvertiseAddr": "10.138.0.3:4647",
"RPCMajorVersion": 1,
"RPCMinorVersion": 1
},
{
"Datacenter": "dc1",
"RPCAdvertiseAddr": "10.138.0.4:4647",
"RPCMajorVersion": 1,
"RPCMinorVersion": 1
2017-05-26 23:17:07 +00:00
}
2018-04-12 18:34:01 +00:00
]
2017-05-26 23:17:07 +00:00
}
2018-04-12 18:34:01 +00:00
2017-05-26 23:17:07 +00:00
```
## Drain Node
This endpoint toggles the drain mode of the node. When draining is enabled, no
further allocations will be assigned to this node, and existing allocations will
2018-06-22 20:42:58 +00:00
be migrated to new nodes. See the [Workload Migration
Guide](/guides/operations/node-draining.html) for suggested usage.
2017-05-26 23:17:07 +00:00
| Method | Path | Produces |
| ------- | ------------------------- | -------------------------- |
| `POST` | `/v1/node/:node_id/drain` | `application/json` |
The table below shows this endpoint's support for
2017-05-31 01:08:23 +00:00
[blocking queries](/api/index.html#blocking-queries) and
2017-05-26 23:17:07 +00:00
[required ACLs](/api/index.html#acls).
2017-09-15 03:33:31 +00:00
| Blocking Queries | ACL Required |
| ---------------- | ------------------ |
| `NO` | `node:write` |
2017-05-26 23:17:07 +00:00
### Parameters
- `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must
be the full UUID, not the short 8-character one. This is specified as part of
the path.
2018-04-12 18:34:01 +00:00
- `DrainSpec` `(object: <optional>)` - Specifies if drain mode should be
enabled. A missing or null value disables an existing drain.
- `Deadline` `(int: <required>)` - Specifies how long to wait in nanoseconds
for allocations to finish migrating before they are force stopped. This is
also how long batch jobs are given to complete before being migrated.
- `IgnoreSystemJobs` `(bool: false)` - Specifies whether or not to stop system
jobs as part of a drain. By default system jobs will be stopped after all
other allocations have migrated or the deadline is reached. Setting this to
`true` means system jobs are always left running.
- `MarkEligible` `(bool: false)` - Specifies whether to mark a node as eligible
for scheduling again when _disabling_ a drain.
### Sample Payload
```json
{
"DrainSpec": {
2018-10-08 17:06:39 +00:00
"Deadline": 3600000000000,
2018-04-12 18:34:01 +00:00
"IgnoreSystemJobs": true
}
}
```
2017-05-26 23:17:07 +00:00
### Sample Request
```text
$ curl \
2018-04-12 18:34:01 +00:00
-XPOST \
--data @drain.json \
http://localhost:4646/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/drain
2017-05-26 23:17:07 +00:00
```
### Sample Response
```json
{
2018-04-12 18:34:01 +00:00
"EvalCreateIndex": 0,
"EvalIDs": null,
"Index": 3742,
"NodeModifyIndex": 3742
2017-05-26 23:17:07 +00:00
}
```
2017-10-26 21:18:34 +00:00
## Purge Node
This endpoint purges a node from the system. Nodes can still join the cluster if
they are alive.
| Method | Path | Produces |
| ------- | ------------------------- | -------------------------- |
| `POST` | `/v1/node/:node_id/purge` | `application/json` |
The table below shows this endpoint's support for
[blocking queries](/api/index.html#blocking-queries) and
[required ACLs](/api/index.html#acls).
| Blocking Queries | ACL Required |
| ---------------- | ------------------ |
| `NO` | `node:write` |
### Parameters
- `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must
be the full UUID, not the short 8-character one. This is specified as part of
the path.
### Sample Request
```text
$ curl \
2018-04-12 18:34:01 +00:00
-XPOST http://localhost:4646/v1/node/f7476465-4d6e-c0de-26d0-e383c49be941/purge
2017-10-26 21:18:34 +00:00
```
### Sample Response
```json
{
2018-04-12 18:34:01 +00:00
"EvalCreateIndex": 3817,
2017-10-26 21:18:34 +00:00
"EvalIDs": [
2018-04-12 18:34:01 +00:00
"71bad787-5ab1-9939-be02-4809441583cd"
2017-10-26 21:18:34 +00:00
],
2018-04-12 18:34:01 +00:00
"HeartbeatTTL": 0,
"Index": 3816,
"KnownLeader": false,
2017-10-26 21:18:34 +00:00
"LastContact": 0,
2018-04-12 18:34:01 +00:00
"LeaderRPCAddr": "",
"NodeModifyIndex": 3816,
"NumNodes": 0,
"Servers": null
2017-10-26 21:18:34 +00:00
}
```
2018-03-23 21:12:19 +00:00
## Toggle Node Eligibility
This endpoint toggles the scheduling eligibility of the node.
| Method | Path | Produces |
| ------- | ------------------------------- | -------------------------- |
| `POST` | `/v1/node/:node_id/eligibility` | `application/json` |
The table below shows this endpoint's support for
[blocking queries](/api/index.html#blocking-queries) and
[required ACLs](/api/index.html#acls).
| Blocking Queries | ACL Required |
| ---------------- | ------------------ |
| `NO` | `node:write` |
### Parameters
- `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must
be the full UUID, not the short 8-character one. This is specified as part of
the path.
- `Eligibility` `(string: <required>)` - Either `eligible` or `ineligible`.
### Sample Payload
```json
{
"Eligibility": "ineligible"
}
```
### Sample Request
```text
$ curl \
-XPOST \
--data @eligibility.json \
http://localhost:4646/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/eligibility
```
### Sample Response
```json
{
"EvalCreateIndex": 0,
"EvalIDs": null,
"Index": 3742,
"NodeModifyIndex": 3742
}
```
2018-03-23 21:12:19 +00:00
#### Field Reference
- Events - A list of the last 10 node events for this node. A node event is a
high level concept of noteworthy events for a node.
Each node event has the following fields:
- `Message` - The specific message for the event, detailing what occurred.
- `Subsystem` - The subsystem where the node event took place. Subsystems
2018-03-23 21:12:19 +00:00
include:
- `Drain` - The Nomad server draining subsystem.
2018-03-23 21:12:19 +00:00
- `Driver` - The Nomad client driver subsystem.
2018-03-23 21:12:19 +00:00
- `Heartbeat` - Either Nomad client or server heartbeating subsystem.
2018-03-23 21:12:19 +00:00
- `Cluster` - Nomad server cluster management subsystem.
2018-03-23 21:12:19 +00:00
- `Details` - Any further details about the event, formatted as a key/value
pair.
- `Timestamp` - Each node event has an ISO 8601 timestamp.
2018-03-23 21:12:19 +00:00
- `CreateIndex` - The Raft index at which the event was committed.