2017-09-19 14:47:10 +00:00
|
|
|
---
|
2020-02-06 23:45:31 +00:00
|
|
|
layout: docs
|
|
|
|
page_title: 'Commands: namespace apply'
|
|
|
|
description: |
|
2017-09-19 14:47:10 +00:00
|
|
|
The namespace apply command is used create or update a namespace.
|
|
|
|
---
|
|
|
|
|
|
|
|
# Command: namespace apply
|
|
|
|
|
|
|
|
The `namespace apply` command is used create or update a namespace.
|
|
|
|
|
2020-10-22 21:59:40 +00:00
|
|
|
~> Namespaces are open source in Nomad 1.0. Namespaces were Enterprise-only
|
2020-12-07 22:04:11 +00:00
|
|
|
when introduced in Nomad 0.7.
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2019-10-22 13:44:00 +00:00
|
|
|
```plaintext
|
2022-02-24 14:27:32 +00:00
|
|
|
nomad namespace apply [options] <input>
|
2017-09-19 14:47:10 +00:00
|
|
|
```
|
|
|
|
|
2022-02-24 14:27:32 +00:00
|
|
|
Apply is used to create or update a namespace. The specification file
|
|
|
|
will be read from stdin by specifying "-", otherwise a path to the file is
|
|
|
|
expected.
|
|
|
|
|
|
|
|
Instead of a file, you may instead pass the namespace name to create
|
|
|
|
or update as the only argument.
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2020-11-19 21:38:08 +00:00
|
|
|
If ACLs are enabled, this command requires a management ACL token.
|
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
## General Options
|
|
|
|
|
2020-11-19 18:02:48 +00:00
|
|
|
@include 'general_options_no_namespace.mdx'
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
## Apply Options
|
|
|
|
|
2019-10-22 13:44:00 +00:00
|
|
|
- `-quota` : An optional quota to apply to the namespace.
|
2017-10-13 21:36:02 +00:00
|
|
|
|
2019-10-22 13:44:00 +00:00
|
|
|
- `-description` : An optional human readable description for the namespace.
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2022-02-24 14:27:32 +00:00
|
|
|
- `json` : Parse the input as a JSON namespace specification.
|
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
## Examples
|
|
|
|
|
2020-12-18 18:55:31 +00:00
|
|
|
Create a namespace with a quota:
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2020-05-18 20:53:06 +00:00
|
|
|
```shell-session
|
|
|
|
$ nomad namespace apply -description "Prod API servers" -quota prod api-prod
|
2017-09-19 14:47:10 +00:00
|
|
|
Successfully applied namespace "api-prod"!
|
|
|
|
```
|
2020-12-18 18:55:31 +00:00
|
|
|
|
|
|
|
Remove a quota from a namespace:
|
|
|
|
|
|
|
|
```shell-session
|
|
|
|
$ nomad namespace apply -quota= api-prod
|
|
|
|
```
|
2022-02-24 14:27:32 +00:00
|
|
|
|
|
|
|
Create a namespace from a file:
|
|
|
|
```shell-session
|
|
|
|
$ cat namespace.json
|
|
|
|
name = "dev"
|
|
|
|
description = "Namespace for developers"
|
|
|
|
|
|
|
|
capabilities {
|
|
|
|
enabled_task_drivers = ["docker", "exec"]
|
|
|
|
disabled_task_drivers = ["raw_exec"]
|
|
|
|
}
|
|
|
|
$ nomad namespace apply namespace.json
|
|
|
|
```
|