2019-12-06 16:14:56 +00:00
|
|
|
---
|
2020-09-01 15:14:13 +00:00
|
|
|
layout: commands
|
2020-04-07 18:55:19 +00:00
|
|
|
page_title: 'Commands: Namespace'
|
2020-04-13 18:40:26 +00:00
|
|
|
sidebar_title: namespace
|
2020-04-07 18:55:19 +00:00
|
|
|
description: |
|
2019-12-06 16:14:56 +00:00
|
|
|
The namespace command provides management of Consul Enterprise namespaces.
|
|
|
|
---
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
# Consul Namespace
|
2019-12-06 16:14:56 +00:00
|
|
|
|
|
|
|
Command: `consul namespace`
|
|
|
|
|
2020-04-23 22:13:18 +00:00
|
|
|
<EnterpriseAlert />
|
|
|
|
|
2019-12-06 16:14:56 +00:00
|
|
|
The `namespace` command provides management of Consul Enterprise namespaces. This was added in Consul Enterprise 1.7.0.
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
If ACLs are enabled then a token with operator privileges may be required in order to use this command. Write
|
2019-12-06 16:14:56 +00:00
|
|
|
requests are forwarded to the leader in the primary datacenter. Therefore these commands can be run against
|
|
|
|
any agent in any datacenter.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `consul namespace <subcommand>`
|
|
|
|
|
|
|
|
For the exact documentation for your Consul version, run `consul namespace -h` to view the complete list of subcommands.
|
|
|
|
|
|
|
|
```text
|
|
|
|
Usage: consul namespace <subcommand> [options] [args]
|
|
|
|
|
|
|
|
This command has subcommands for interacting with Consul Enterprise
|
|
|
|
Namespaces. Here are some simple examples. More detailed
|
|
|
|
examples are available in the subcommands or the documentation.
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
Subcommands:
|
2020-03-16 13:42:39 +00:00
|
|
|
create Create a Namespace
|
2019-12-06 16:14:56 +00:00
|
|
|
delete Delete a Namespace
|
|
|
|
list List all Namespaces
|
|
|
|
read Read a Namespace
|
2020-03-16 13:42:39 +00:00
|
|
|
update Update a Namespace
|
|
|
|
write Create or update a Namespace from its full definition
|
2019-12-06 16:14:56 +00:00
|
|
|
```
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
For more information, examples, and usage about a subcommand, click on the name
|
2019-12-06 16:14:56 +00:00
|
|
|
of the subcommand in the sidebar.
|
|
|
|
|
|
|
|
## Basic Examples
|
|
|
|
|
2020-03-16 13:42:39 +00:00
|
|
|
Create a Namespace
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2020-03-16 13:42:39 +00:00
|
|
|
$ consul namespace create -name team1
|
|
|
|
```
|
|
|
|
|
|
|
|
Create or Update a Namespace from its full definition:
|
2019-12-06 16:14:56 +00:00
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-12-06 16:14:56 +00:00
|
|
|
$ consul namespace write ns1.hcl
|
|
|
|
```
|
|
|
|
|
|
|
|
Read a Namespace:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-12-06 16:14:56 +00:00
|
|
|
$ consul namespace read ns1
|
|
|
|
```
|
|
|
|
|
|
|
|
List all Namespaces:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-12-06 16:14:56 +00:00
|
|
|
$ consul namespace list
|
|
|
|
```
|
|
|
|
|
2020-03-16 13:42:39 +00:00
|
|
|
Update a namespace
|
2019-12-06 16:14:56 +00:00
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2020-03-16 13:42:39 +00:00
|
|
|
$ consul namespace update -name team1 -description "first namespace"
|
2019-12-06 16:14:56 +00:00
|
|
|
```
|
2020-03-16 13:42:39 +00:00
|
|
|
|
|
|
|
Delete a Namespace:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2020-03-16 13:42:39 +00:00
|
|
|
$ consul namespace delete team1
|
2020-04-07 18:55:19 +00:00
|
|
|
```
|