open-nomad/website/content/docs/commands/node-pool/apply.mdx

74 lines
1.6 KiB
Plaintext

---
layout: docs
page_title: 'Commands: node pool apply'
description: |
The node pool apply command is used to create or update a node pool.
---
# Command: node pool apply
The `node pool apply` command is used to create or update a node pool.
## Usage
```plaintext
nomad node pool apply [options] <input>
```
Apply is used to create or update a node pool. The specification file is read
from stdin by specifying `-`, otherwise a path to the file is expected.
If ACLs are enabled, this command requires a token with the `write` capability
in a `node_pool` policy that matches the node pool being targeted. In federated
clusters, the node pool will be created in the authoritative region and will be
replicated to all federated regions.
## General Options
@include 'general_options_no_namespace.mdx'
## Apply Options
- `-json`: Parse the input as a JSON node pool specification.
## Examples
Create a node pool from a file:
```hcl
# prod_pool.nomad.hcl
node_pool "prod" {
description = "Node pool for production workloads."
meta {
env = "prod"
}
# Available only in Nomad Enterprise.
scheduler_config {
scheduler_algorithm = "spread"
}
}
```
```shell-session
$ nomad node pool apply prod_pool.nomad.hcl
Successfully applied node pool "prod"!
```
Create a node pool from stdin:
```shell-session
$ cat prod_pool.nomad.hcl | nomad node pool apply -
Successfully applied node pool "prod"!
```
```shell-session
$ cat <<EOF | nomad node pool apply -
node_pool "dev" {
description = "Node pool for dev workloads."
}
EOF
Successfully applied node pool "dev"!
```