214 lines
5.8 KiB
Plaintext
214 lines
5.8 KiB
Plaintext
---
|
|
layout: api
|
|
page_title: Node Pools - HTTP API
|
|
description: The /node/pool endpoints are used to query for and interact with node pools.
|
|
---
|
|
|
|
# Node Pools HTTP API
|
|
|
|
The `/node/pool` endpoints are used to query for and interact with node pools.
|
|
|
|
## List Node Pools
|
|
|
|
This endpoint list all node pools.
|
|
|
|
| Method | Path | Produces |
|
|
| ------ | ---------------- | ------------------ |
|
|
| `GET` | `/v1/node/pools` | `application/json` |
|
|
|
|
The table below shows this endpoint's support for
|
|
[blocking queries](/nomad/api-docs#blocking-queries) and
|
|
[required ACLs](/nomad/api-docs#acls).
|
|
|
|
| Blocking Queries | ACL Required |
|
|
| ---------------- | ----------------- |
|
|
| `YES` | `node_pool:read` |
|
|
|
|
### Parameters
|
|
|
|
- `prefix` `(string: "")`- Specifies a string to filter node pools based on a
|
|
name prefix. This is specified as a query string parameter.
|
|
|
|
- `next_token` `(string: "")` - This endpoint supports paging. The `next_token`
|
|
parameter accepts a string which identifies the next expected node pool. This
|
|
value can be obtained from the `X-Nomad-NextToken` header from the previous
|
|
response.
|
|
|
|
- `per_page` `(int: 0)` - Specifies a maximum number of node pools to return
|
|
for this request. If omitted, the response is not paginated. The value of the
|
|
`X-Nomad-NextToken` header of the last response can be used as the
|
|
`next_token` of the next request to fetch additional pages.
|
|
|
|
- `filter` `(string: "")` - Specifies the [expression](/nomad/api-docs#filtering)
|
|
used to filter the results. Consider using pagination to reduce resource used
|
|
to serve the request.
|
|
|
|
### Sample Request
|
|
|
|
```shell-session
|
|
$ nomad operator api '/v1/node/pools'
|
|
```
|
|
|
|
```shell-session
|
|
$ nomad operator api '/v1/node/pools?prefix=prod'
|
|
```
|
|
|
|
```shell-session
|
|
$ nomad operator api -filter 'Meta.env == "production"' '/v1/node/pools?per_page=5'
|
|
```
|
|
|
|
### Sample Response
|
|
|
|
```json
|
|
[
|
|
{
|
|
"CreateIndex": 11,
|
|
"Description": "Production workloads",
|
|
"Meta": {
|
|
"env": "production",
|
|
"team": "engineering"
|
|
},
|
|
"ModifyIndex": 11,
|
|
"Name": "prod-eng",
|
|
"SchedulerConfiguration": {
|
|
"SchedulerAlgorithm": "spread"
|
|
}
|
|
}
|
|
]
|
|
```
|
|
|
|
## Read Node Pool
|
|
|
|
This endpoint queries information about a node pool.
|
|
|
|
| Method | Path | Produces |
|
|
| ------ | -------------------------- | ------------------ |
|
|
| `GET` | `/v1/node/pool/:node_pool` | `application/json` |
|
|
|
|
The table below shows this endpoint's support for
|
|
[blocking queries](/nomad/api-docs#blocking-queries) and
|
|
[required ACLs](/nomad/api-docs#acls).
|
|
|
|
| Blocking Queries | ACL Required |
|
|
| ---------------- | ----------------- |
|
|
| `YES` | `node_pool:read` |
|
|
|
|
### Parameters
|
|
|
|
- `:node_pool` `(string: <required>)`- Specifies the node pool to query.
|
|
|
|
### Sample Request
|
|
|
|
```shell-session
|
|
$ nomad operator api /v1/node/pool/prod-eng
|
|
```
|
|
|
|
### Sample Response
|
|
|
|
```json
|
|
{
|
|
"CreateIndex": 11,
|
|
"Description": "Production workloads",
|
|
"Meta": {
|
|
"env": "production",
|
|
"team": "engineering"
|
|
},
|
|
"ModifyIndex": 11,
|
|
"Name": "prod-eng",
|
|
"SchedulerConfiguration": {
|
|
"SchedulerAlgorithm": "spread"
|
|
}
|
|
}
|
|
```
|
|
|
|
## Create or Update Node Pool
|
|
|
|
This endpoint is used to create or update a node pool.
|
|
|
|
| Method | Path | Produces |
|
|
| ------ | ------------------------------------------------- | ------------------ |
|
|
| `POST` | `/v1/node/pool/:node_pool` <br /> `/v1/node/pool` | `application/json` |
|
|
|
|
The table below shows this endpoint's support for
|
|
[blocking queries](/nomad/api-docs#blocking-queries) and
|
|
[required ACLs](/nomad/api-docs#acls).
|
|
|
|
| Blocking Queries | ACL Required |
|
|
| ---------------- | ----------------- |
|
|
| `NO` | `node_pool:write` |
|
|
|
|
|
|
### Parameters
|
|
|
|
- `Name` `(string: <required>)` - Specifies the node pool to create or update.
|
|
Must have fewer than 128 characters. Only alphanumeric, `-`, and `_` are
|
|
allowed.
|
|
|
|
- `Description` `(string: "")` - Specifies the optional human-readable
|
|
description of the node pool. Must have fewer than 256 characters.
|
|
|
|
- `Meta` `(object: null)` - Optional object with string keys and values of
|
|
metadata to attach to the node pool. Node pool metadata is not used by
|
|
Nomad and is intended for use by operators and third party tools.
|
|
|
|
- `SchedulerConfiguration` `(SchedulerConfiguration: <optional>)` - Specifies
|
|
custom configuration applied when scheduling allocations in the node pool.
|
|
|
|
- `SchedulerAlgorithm` `(string: ""`) - The algorithm used by the scheduler
|
|
when scoring nodes. Possible values are `binpack` or `spread`. If not
|
|
specified the [global cluster configuration value][api_scheduler_algo] is used.
|
|
|
|
### Sample Payload
|
|
|
|
```json
|
|
{
|
|
"Name": "prod-eng",
|
|
"Description": "Production workloads",
|
|
"Meta": {
|
|
"env": "production",
|
|
"team": "engineering"
|
|
},
|
|
"SchedulerConfiguration": {
|
|
"SchedulerAlgorithm": "spread"
|
|
}
|
|
}
|
|
```
|
|
|
|
### Sample Request
|
|
|
|
```shell-session
|
|
$ cat pool.json | nomad operator api /v1/node/pools
|
|
```
|
|
|
|
```shell-session
|
|
$ cat pool.json | nomad operator api /v1/node/pool/prod-eng
|
|
```
|
|
|
|
## Delete Node Pool
|
|
|
|
This endpoint is used to delete a node pool.
|
|
|
|
| Method | Path | Produces |
|
|
| -------- | -------------------------- | ------------------ |
|
|
| `DELETE` | `/v1/node/pool/:node_pool` | `application/json` |
|
|
|
|
The table below shows this endpoint's support for
|
|
[blocking queries](/nomad/api-docs#blocking-queries) and
|
|
[required ACLs](/nomad/api-docs#acls).
|
|
|
|
| Blocking Queries | ACL Required |
|
|
| ---------------- | ------------ |
|
|
| `NO` | `management` |
|
|
|
|
### Parameters
|
|
|
|
- `:node_pool` `(string: <required>)`- Specifies the node pool to delete.
|
|
|
|
### Sample Request
|
|
|
|
```shell-session
|
|
$ nomad operator api -X DELETE /v1/node/pool/prod-eng
|
|
```
|
|
|
|
[api_scheduler_alog]: /nomad/api-docs/operator/scheduler#scheduleralgorithm
|