2017-04-04 16:33:22 +00:00
|
|
|
---
|
|
|
|
layout: api
|
|
|
|
page_title: Catalog - HTTP API
|
|
|
|
description: |-
|
|
|
|
The /catalog endpoints register and deregister nodes, services, and checks in
|
|
|
|
Consul.
|
|
|
|
---
|
|
|
|
|
|
|
|
# Catalog HTTP API
|
|
|
|
|
|
|
|
The `/catalog` endpoints register and deregister nodes, services, and checks in
|
|
|
|
Consul. The catalog should not be confused with the agent, since some of the
|
|
|
|
API methods look similar.
|
|
|
|
|
|
|
|
## Register Entity
|
|
|
|
|
|
|
|
This endpoint is a low-level mechanism for registering or updating
|
|
|
|
entries in the catalog. It is usually preferable to instead use the
|
2022-03-30 21:16:26 +00:00
|
|
|
[agent endpoints](/api-docs/agent) for registration as they are simpler and
|
2022-01-10 23:36:16 +00:00
|
|
|
perform [anti-entropy](/docs/architecture/anti-entropy).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ------------------- | ------------------ |
|
|
|
|
| `PUT` | `/catalog/register` | `application/json` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2022-03-30 21:16:26 +00:00
|
|
|
[blocking queries](/api-docs/features/blocking),
|
|
|
|
[consistency modes](/api-docs/features/consistency),
|
|
|
|
[agent caching](/api-docs/features/caching), and
|
2022-10-18 19:49:07 +00:00
|
|
|
[required ACLs](/api-docs/api-structure#authentication).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | ------------- | -------------------------- |
|
|
|
|
| `NO` | `none` | `none` | `node:write,service:write` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
### Query Parameters
|
|
|
|
|
|
|
|
- `ns` `(string: "")` <EnterpriseAlert inline /> - Specifies the namespace of the service and checks you register.
|
|
|
|
You can also [specify the namespace through other methods](#methods-to-specify-namespace).
|
|
|
|
|
|
|
|
### JSON Request Body Schema
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2018-12-11 19:06:18 +00:00
|
|
|
- `ID` `(string: "")` - An optional UUID to assign to the node. This must be a 36-character UUID-formatted string.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
- `Node` `(string: <required>)` - Specifies the node ID to register.
|
|
|
|
|
|
|
|
- `Address` `(string: <required>)` - Specifies the address to register.
|
|
|
|
|
|
|
|
- `Datacenter` `(string: "")` - Specifies the datacenter, which defaults to the
|
|
|
|
agent's datacenter if not provided.
|
|
|
|
|
|
|
|
- `TaggedAddresses` `(map<string|string>: nil)` - Specifies the tagged
|
|
|
|
addresses.
|
|
|
|
|
2017-08-01 00:06:07 +00:00
|
|
|
- `NodeMeta` `(map<string|string>: nil)` - Specifies arbitrary KV metadata
|
2017-04-04 16:33:22 +00:00
|
|
|
pairs for filtering purposes.
|
|
|
|
|
|
|
|
- `Service` `(Service: nil)` - Specifies to register a service. If `ID` is not
|
|
|
|
provided, it will be defaulted to the value of the `Service.Service` property.
|
2020-01-15 15:36:17 +00:00
|
|
|
Only one service with a given `ID` may be present per node. We recommend using
|
|
|
|
[valid DNS labels](https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_hostnames)
|
2022-01-10 23:36:16 +00:00
|
|
|
for service definition names for [compatibility with external DNS](/docs/discovery/services#service-and-tag-names-with-dns).
|
2020-01-15 15:36:17 +00:00
|
|
|
The service `Tags`, `Address`, `Meta`, and `Port` fields are all optional. For more
|
2019-04-16 16:00:15 +00:00
|
|
|
information about these fields and the implications of setting them,
|
2022-03-30 21:16:26 +00:00
|
|
|
see the [Service - Agent API](/api-docs/agent/service) page
|
2019-03-06 14:41:12 +00:00
|
|
|
as registering services differs between using this or the Services Agent endpoint.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
- `Check` `(Check: nil)` - Specifies to register a check. The register API
|
|
|
|
manipulates the health check entry in the Catalog, but it does not setup the
|
|
|
|
script, TTL, or HTTP check to monitor the node's health. To truly enable a new
|
|
|
|
health check, the check must either be provided in agent configuration or set
|
2020-04-09 23:46:54 +00:00
|
|
|
via the [agent endpoint](agent).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
The `CheckID` can be omitted and will default to the value of `Name`. As
|
|
|
|
with `Service.ID`, the `CheckID` must be unique on this node. `Notes` is an
|
|
|
|
opaque field that is meant to hold human-readable text. If a `ServiceID` is
|
|
|
|
provided that matches the `ID` of a service on that node, the check is
|
|
|
|
treated as a service level health check, instead of a node level health
|
|
|
|
check. The `Status` must be one of `passing`, `warning`, or `critical`.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
The `Definition` field can be provided with details for a TCP or HTTP health
|
2022-01-10 23:36:16 +00:00
|
|
|
check. For more information, see the [Health Checks](/docs/discovery/checks) page.
|
2017-11-01 21:25:46 +00:00
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
Multiple checks can be provided by replacing `Check` with `Checks` and
|
|
|
|
sending an array of `Check` objects.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2017-11-01 21:25:46 +00:00
|
|
|
- `SkipNodeUpdate` `(bool: false)` - Specifies whether to skip updating the
|
2019-04-16 16:00:15 +00:00
|
|
|
node's information in the registration. This is useful in the case where
|
|
|
|
only a health check or service entry on a node needs to be updated or when
|
2020-04-06 20:27:35 +00:00
|
|
|
a register request is intended to update a service entry or health check.
|
2019-04-16 16:00:15 +00:00
|
|
|
In both use cases, node information will not be overwritten, if the node is
|
2019-11-06 04:34:46 +00:00
|
|
|
already registered. Note, if the parameter is enabled for a node that doesn't
|
2019-02-26 17:00:23 +00:00
|
|
|
exist, it will still be created.
|
2020-04-06 20:27:35 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
- `Namespace` `(string: "")` <EnterpriseAlert inline /> - Specifies the namespace of the service and checks you register.
|
|
|
|
This field takes precedence over the `ns` query parameter,
|
|
|
|
one of several [other methods to specify the namespace](#methods-to-specify-namespace).
|
2019-12-10 02:26:41 +00:00
|
|
|
|
2017-04-04 16:33:22 +00:00
|
|
|
It is important to note that `Check` does not have to be provided with `Service`
|
|
|
|
and vice versa. A catalog entry can have either, neither, or both.
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Datacenter": "dc1",
|
|
|
|
"ID": "40e4a748-2192-161a-0510-9bf59fe950b5",
|
2021-04-16 19:50:02 +00:00
|
|
|
"Node": "t2.320",
|
2017-04-04 16:33:22 +00:00
|
|
|
"Address": "192.168.10.10",
|
|
|
|
"TaggedAddresses": {
|
|
|
|
"lan": "192.168.10.10",
|
|
|
|
"wan": "10.0.10.10"
|
|
|
|
},
|
|
|
|
"NodeMeta": {
|
|
|
|
"somekey": "somevalue"
|
|
|
|
},
|
|
|
|
"Service": {
|
|
|
|
"ID": "redis1",
|
|
|
|
"Service": "redis",
|
2020-04-06 20:27:35 +00:00
|
|
|
"Tags": ["primary", "v1"],
|
2017-04-04 16:33:22 +00:00
|
|
|
"Address": "127.0.0.1",
|
2019-06-17 14:51:50 +00:00
|
|
|
"TaggedAddresses": {
|
|
|
|
"lan": {
|
|
|
|
"address": "127.0.0.1",
|
|
|
|
"port": 8000
|
|
|
|
},
|
|
|
|
"wan": {
|
|
|
|
"address": "198.18.0.1",
|
|
|
|
"port": 80
|
|
|
|
}
|
|
|
|
},
|
2018-03-28 14:04:50 +00:00
|
|
|
"Meta": {
|
2020-04-06 20:27:35 +00:00
|
|
|
"redis_version": "4.0"
|
2018-02-11 13:12:41 +00:00
|
|
|
},
|
2019-12-10 02:26:41 +00:00
|
|
|
"Port": 8000,
|
|
|
|
"Namespace": "default"
|
2017-04-04 16:33:22 +00:00
|
|
|
},
|
|
|
|
"Check": {
|
2021-04-16 19:50:02 +00:00
|
|
|
"Node": "t2.320",
|
2017-04-04 16:33:22 +00:00
|
|
|
"CheckID": "service:redis1",
|
|
|
|
"Name": "Redis health check",
|
|
|
|
"Notes": "Script based health check",
|
|
|
|
"Status": "passing",
|
2017-11-01 21:25:46 +00:00
|
|
|
"ServiceID": "redis1",
|
|
|
|
"Definition": {
|
|
|
|
"TCP": "localhost:8888",
|
|
|
|
"Interval": "5s",
|
|
|
|
"Timeout": "1s",
|
|
|
|
"DeregisterCriticalServiceAfter": "30s"
|
2019-12-10 02:26:41 +00:00
|
|
|
},
|
|
|
|
"Namespace": "default"
|
2017-11-01 21:25:46 +00:00
|
|
|
},
|
2020-04-06 20:27:35 +00:00
|
|
|
"SkipNodeUpdate": false
|
2017-04-04 16:33:22 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2017-04-04 16:33:22 +00:00
|
|
|
$ curl \
|
|
|
|
--request PUT \
|
|
|
|
--data @payload.json \
|
2022-01-12 23:05:01 +00:00
|
|
|
--header "X-Consul-Namespace: team-1" \
|
2018-08-28 16:07:15 +00:00
|
|
|
http://127.0.0.1:8500/v1/catalog/register
|
2017-04-04 16:33:22 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Deregister Entity
|
|
|
|
|
|
|
|
This endpoint is a low-level mechanism for directly removing
|
|
|
|
entries from the Catalog. It is usually preferable to instead use the
|
2022-03-30 21:16:26 +00:00
|
|
|
[agent endpoints](/api-docs/agent) for deregistration as they are simpler and
|
2022-01-10 23:36:16 +00:00
|
|
|
perform [anti-entropy](/docs/architecture/anti-entropy).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | --------------------- | ------------------ |
|
|
|
|
| `PUT` | `/catalog/deregister` | `application/json` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2022-03-30 21:16:26 +00:00
|
|
|
[blocking queries](/api-docs/features/blocking),
|
|
|
|
[consistency modes](/api-docs/features/consistency),
|
|
|
|
[agent caching](/api-docs/features/caching), and
|
2022-10-18 19:49:07 +00:00
|
|
|
[required ACLs](/api-docs/api-structure#authentication).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2018-09-06 10:34:28 +00:00
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | ------------- | -------------------------- |
|
|
|
|
| `NO` | `none` | `none` | `node:write,service:write` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
### Query Parameters
|
|
|
|
|
|
|
|
- `ns` `(string: "")` <EnterpriseAlert inline /> - Specifies the namespace of the service and checks you deregister.
|
|
|
|
You can also [specify the namespace through other methods](#methods-to-specify-namespace).
|
|
|
|
|
|
|
|
### JSON Request Body Schema
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
The behavior of the endpoint depends on what keys are provided.
|
|
|
|
|
|
|
|
- `Node` `(string: <required>)` - Specifies the ID of the node. If no other
|
|
|
|
values are provided, this node, all its services, and all its checks are
|
|
|
|
removed.
|
|
|
|
|
|
|
|
- `Datacenter` `(string: "")` - Specifies the datacenter, which defaults to the
|
|
|
|
agent's datacenter if not provided.
|
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
- `CheckID` `(string: "")` - Specifies the ID of the check to remove.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
- `ServiceID` `(string: "")` - Specifies the ID of the service to remove. The
|
|
|
|
service and all associated checks will be removed.
|
2020-04-06 20:27:35 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
- `Namespace` `(string: "")` <EnterpriseAlert inline /> - Specifies the namespace of the service and checks you deregister.
|
|
|
|
This field takes precedence over the `ns` query parameter,
|
|
|
|
one of several [other methods to specify the namespace](#methods-to-specify-namespace).
|
|
|
|
You can also specify the namespace in the `Service` or `Check` fields;
|
|
|
|
if namespaces are specified in multiple places, they must all be the same.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
### Sample Payloads
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Datacenter": "dc1",
|
2021-04-16 19:50:02 +00:00
|
|
|
"Node": "t2.320"
|
2017-04-04 16:33:22 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Datacenter": "dc1",
|
2021-04-16 19:50:02 +00:00
|
|
|
"Node": "t2.320",
|
2019-12-10 02:26:41 +00:00
|
|
|
"CheckID": "service:redis1",
|
|
|
|
"Namespace": "team-1"
|
2017-04-04 16:33:22 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Datacenter": "dc1",
|
2021-04-16 19:50:02 +00:00
|
|
|
"Node": "t2.320",
|
2019-12-10 02:26:41 +00:00
|
|
|
"ServiceID": "redis1",
|
|
|
|
"Namespace": "team-1"
|
2017-04-04 16:33:22 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2017-04-04 16:33:22 +00:00
|
|
|
$ curl \
|
|
|
|
--request PUT \
|
|
|
|
--data @payload.json \
|
2018-08-28 16:07:15 +00:00
|
|
|
http://127.0.0.1:8500/v1/catalog/deregister
|
2017-04-04 16:33:22 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## List Datacenters
|
|
|
|
|
|
|
|
This endpoint returns the list of all known datacenters. The datacenters will be
|
|
|
|
sorted in ascending order based on the estimated median round trip time from the
|
|
|
|
server to the servers in that datacenter.
|
|
|
|
|
|
|
|
This endpoint does not require a cluster leader and will succeed even during an
|
|
|
|
availability outage. Therefore, it can be used as a simple check to see if any
|
|
|
|
Consul servers are routable.
|
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ---------------------- | ------------------ |
|
|
|
|
| `GET` | `/catalog/datacenters` | `application/json` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2022-03-30 21:16:26 +00:00
|
|
|
[blocking queries](/api-docs/features/blocking),
|
|
|
|
[consistency modes](/api-docs/features/consistency),
|
|
|
|
[agent caching](/api-docs/features/caching), and
|
2022-10-18 19:49:07 +00:00
|
|
|
[required ACLs](/api-docs/api-structure#authentication).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2018-09-06 10:34:28 +00:00
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | ------------- | ------------ |
|
2022-10-10 18:38:04 +00:00
|
|
|
| `NO` | `none` | `simple` | `none` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-01-15 17:29:35 +00:00
|
|
|
The corresponding CLI command is [`consul catalog datacenters`](/commands/catalog/datacenters).
|
2022-01-10 19:21:32 +00:00
|
|
|
|
2017-04-04 16:33:22 +00:00
|
|
|
### Sample Request
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2017-04-04 16:33:22 +00:00
|
|
|
$ curl \
|
2018-08-28 16:07:15 +00:00
|
|
|
http://127.0.0.1:8500/v1/catalog/datacenters
|
2017-04-04 16:33:22 +00:00
|
|
|
```
|
|
|
|
|
2017-05-19 19:15:27 +00:00
|
|
|
### Sample Response
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
```json
|
|
|
|
["dc1", "dc2"]
|
|
|
|
```
|
|
|
|
|
|
|
|
## List Nodes
|
|
|
|
|
|
|
|
This endpoint and returns the nodes registered in a given datacenter.
|
|
|
|
|
2022-03-19 20:32:38 +00:00
|
|
|
@include 'http_api_results_filtered_by_acls.mdx'
|
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ---------------- | ------------------ |
|
|
|
|
| `GET` | `/catalog/nodes` | `application/json` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2022-03-30 21:16:26 +00:00
|
|
|
[blocking queries](/api-docs/features/blocking),
|
|
|
|
[consistency modes](/api-docs/features/consistency),
|
|
|
|
[agent caching](/api-docs/features/caching), and
|
2022-10-18 19:49:07 +00:00
|
|
|
[required ACLs](/api-docs/api-structure#authentication).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2018-09-06 10:34:28 +00:00
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | ------------- | ------------ |
|
|
|
|
| `YES` | `all` | `none` | `node:read` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-01-15 17:29:35 +00:00
|
|
|
The corresponding CLI command is [`consul catalog nodes`](/commands/catalog/nodes).
|
2022-01-10 19:21:32 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
### Query Parameters
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
- `dc` `(string: "")` - Specifies the datacenter to query.
|
|
|
|
This parameter defaults to the datacenter of the agent being queried.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
- `near` `(string: "")` - Specifies a node name to sort the node list in
|
|
|
|
ascending order based on the estimated round trip time from that node. Passing
|
2022-05-10 15:51:11 +00:00
|
|
|
`?near=_agent` uses the agent's node for the sort.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2020-11-23 22:30:30 +00:00
|
|
|
- `node-meta` `(string: "")` **Deprecated** - Use `filter` with the `Meta` selector instead.
|
|
|
|
This parameter will be removed in a future version of Consul.
|
|
|
|
Specifies a desired node metadata key/value pair
|
2017-04-04 16:33:22 +00:00
|
|
|
of the form `key:value`. This parameter can be specified multiple times, and
|
2022-05-10 15:51:11 +00:00
|
|
|
filters the results to nodes with the specified key/value pairs.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2019-04-16 16:00:15 +00:00
|
|
|
- `filter` `(string: "")` - Specifies the expression used to filter the
|
|
|
|
queries results prior to returning the data.
|
|
|
|
|
2017-04-04 16:33:22 +00:00
|
|
|
### Sample Request
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2017-04-04 16:33:22 +00:00
|
|
|
$ curl \
|
2018-08-28 16:07:15 +00:00
|
|
|
http://127.0.0.1:8500/v1/catalog/nodes
|
2017-04-04 16:33:22 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"ID": "40e4a748-2192-161a-0510-9bf59fe950b5",
|
|
|
|
"Node": "baz",
|
|
|
|
"Address": "10.1.10.11",
|
2017-04-18 12:02:24 +00:00
|
|
|
"Datacenter": "dc1",
|
2017-04-04 16:33:22 +00:00
|
|
|
"TaggedAddresses": {
|
|
|
|
"lan": "10.1.10.11",
|
|
|
|
"wan": "10.1.10.11"
|
|
|
|
},
|
|
|
|
"Meta": {
|
|
|
|
"instance_type": "t2.medium"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"ID": "8f246b77-f3e1-ff88-5b48-8ec93abf3e05",
|
2021-04-16 19:50:02 +00:00
|
|
|
"Node": "t2.320",
|
2017-04-04 16:33:22 +00:00
|
|
|
"Address": "10.1.10.12",
|
2017-04-18 12:02:24 +00:00
|
|
|
"Datacenter": "dc2",
|
2017-04-04 16:33:22 +00:00
|
|
|
"TaggedAddresses": {
|
|
|
|
"lan": "10.1.10.11",
|
|
|
|
"wan": "10.1.10.12"
|
|
|
|
},
|
|
|
|
"Meta": {
|
|
|
|
"instance_type": "t2.large"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
2019-04-16 16:00:15 +00:00
|
|
|
### Filtering
|
|
|
|
|
|
|
|
The filter will be executed against each Node in the result list with
|
|
|
|
the following selectors and filter operations being supported:
|
|
|
|
|
2019-07-23 18:45:20 +00:00
|
|
|
| Selector | Supported Operations |
|
|
|
|
| ----------------------- | -------------------------------------------------- |
|
|
|
|
| `Address` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Datacenter` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ID` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Meta` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
| `Meta.<any>` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Node` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `TaggedAddresses` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
| `TaggedAddresses.<any>` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
2019-04-16 16:00:15 +00:00
|
|
|
|
2017-04-04 16:33:22 +00:00
|
|
|
## List Services
|
|
|
|
|
|
|
|
This endpoint returns the services registered in a given datacenter.
|
|
|
|
|
2022-03-19 20:32:38 +00:00
|
|
|
@include 'http_api_results_filtered_by_acls.mdx'
|
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ------------------- | ------------------ |
|
|
|
|
| `GET` | `/catalog/services` | `application/json` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2022-03-30 21:16:26 +00:00
|
|
|
[blocking queries](/api-docs/features/blocking),
|
|
|
|
[consistency modes](/api-docs/features/consistency),
|
|
|
|
[agent caching](/api-docs/features/caching), and
|
2022-10-18 19:49:07 +00:00
|
|
|
[required ACLs](/api-docs/api-structure#authentication).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-12-02 18:42:49 +00:00
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | -------------------- | -------------- |
|
|
|
|
| `YES` | `all` | `background refresh` | `service:read` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-01-15 17:29:35 +00:00
|
|
|
The corresponding CLI command is [`consul catalog services`](/commands/catalog/services).
|
2022-01-10 19:21:32 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
### Query Parameters
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
- `dc` `(string: "")` - Specifies the datacenter to query. This will default to
|
2022-05-10 15:51:11 +00:00
|
|
|
the datacenter of the agent being queried.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-08-10 21:52:32 +00:00
|
|
|
- `node-meta` `(string: "")` **Deprecated** - Use `filter` with the `NodeMeta` selector instead.
|
|
|
|
This parameter will be removed in a future version of Consul.
|
|
|
|
Specifies a desired node metadata key/value pair
|
2017-04-04 16:33:22 +00:00
|
|
|
of the form `key:value`. This parameter can be specified multiple times, and
|
2022-05-10 15:51:11 +00:00
|
|
|
filters the results to nodes with the specified key/value pairs.
|
2020-04-06 20:27:35 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
- `ns` `(string: "")` <EnterpriseAlert inline /> - Specifies the namespace of the services you lookup.
|
|
|
|
You can also [specify the namespace through other methods](#methods-to-specify-namespace).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-08-10 21:52:32 +00:00
|
|
|
- `filter` `(string: "")` - Specifies the expression used to filter the
|
|
|
|
queries results prior to returning the data.
|
|
|
|
|
|
|
|
### Filtering
|
|
|
|
|
|
|
|
The filter will be executed against each Service mapping within the catalog.
|
|
|
|
The following selectors and filter operations are supported:
|
|
|
|
|
|
|
|
| Selector | Supported Operations |
|
|
|
|
| ---------------------------------------------------- | -------------------------------------------------- |
|
|
|
|
| `Address` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Datacenter` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ID` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Node` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `NodeMeta.<any>` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `NodeMeta` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
| `ServiceAddress` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceConnect.Native` | Equal, Not Equal |
|
|
|
|
| `ServiceEnableTagOverride` | Equal, Not Equal |
|
|
|
|
| `ServiceID` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceKind` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceMeta.<any>` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceMeta` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
| `ServiceName` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServicePort` | Equal, Not Equal |
|
|
|
|
| `ServiceProxy.DestinationServiceID` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.DestinationServiceName` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.LocalServiceAddress` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.LocalServicePort` | Equal, Not Equal |
|
|
|
|
| `ServiceProxy.Mode` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.TransparentProxy.OutboundListenerPort` | Equal, Not Equal |
|
|
|
|
| `ServiceProxy.MeshGateway.Mode` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams.Datacenter` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams.DestinationName` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams.DestinationNamespace` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams.DestinationType` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams.LocalBindAddress` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams.LocalBindPort` | Equal, Not Equal |
|
|
|
|
| `ServiceProxy.Upstreams.MeshGateway.Mode` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams` | Is Empty, Is Not Empty |
|
|
|
|
| `ServiceTaggedAddresses.<any>.Address` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceTaggedAddresses.<any>.Port` | Equal, Not Equal |
|
|
|
|
| `ServiceTaggedAddresses` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
| `ServiceTags` | In, Not In, Is Empty, Is Not Empty |
|
|
|
|
| `ServiceWeights.Passing` | Equal, Not Equal |
|
|
|
|
| `ServiceWeights.Warning` | Equal, Not Equal |
|
|
|
|
| `TaggedAddresses.<any>` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `TaggedAddresses` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
|
2017-04-04 16:33:22 +00:00
|
|
|
### Sample Request
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2017-04-04 16:33:22 +00:00
|
|
|
$ curl \
|
2019-12-10 02:26:41 +00:00
|
|
|
http://127.0.0.1:8500/v1/catalog/services?ns=foo
|
2017-04-04 16:33:22 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"consul": [],
|
|
|
|
"redis": [],
|
2020-04-06 20:27:35 +00:00
|
|
|
"postgresql": ["primary", "secondary"]
|
2017-04-04 16:33:22 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
The keys are the service names, and the array values provide all known tags for
|
|
|
|
a given service.
|
|
|
|
|
|
|
|
## List Nodes for Service
|
|
|
|
|
|
|
|
This endpoint returns the nodes providing a service in a given datacenter.
|
|
|
|
|
2022-03-19 20:32:38 +00:00
|
|
|
@include 'http_api_results_filtered_by_acls.mdx'
|
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | -------------------------------- | ------------------ |
|
|
|
|
| `GET` | `/catalog/service/:service_name` | `application/json` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2022-03-30 21:16:26 +00:00
|
|
|
[blocking queries](/api-docs/features/blocking),
|
|
|
|
[consistency modes](/api-docs/features/consistency),
|
|
|
|
[agent caching](/api-docs/features/caching), and
|
2022-10-18 19:49:07 +00:00
|
|
|
[required ACLs](/api-docs/api-structure#authentication).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2018-09-06 10:34:28 +00:00
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | -------------------- | ------------------------ |
|
|
|
|
| `YES` | `all` | `background refresh` | `node:read,service:read` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
### Path Parameters
|
|
|
|
|
|
|
|
- `service_name` `(string: <required>)` - Specifies the name of the service for which
|
|
|
|
to list nodes.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
### Query Parameters
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
- `dc` `(string: "")` - Specifies the datacenter to query. This will default to
|
2022-05-10 15:51:11 +00:00
|
|
|
the datacenter of the agent being queried.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2020-11-23 22:30:30 +00:00
|
|
|
- `tag` `(string: "")` **Deprecated** - Use `filter` with the `ServiceTags` selector instead.
|
|
|
|
This parameter will be removed in a future version of Consul.
|
2022-05-10 15:51:11 +00:00
|
|
|
Specifies the tag to filter on.
|
|
|
|
Can be used multiple times for additional filtering,
|
2018-10-19 15:52:17 +00:00
|
|
|
returning only the results that include all of the tag values provided.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
- `near` `(string: "")` - Specifies a node name to sort the node list in
|
|
|
|
ascending order based on the estimated round trip time from that node. Passing
|
2022-05-10 15:51:11 +00:00
|
|
|
`?near=_agent` uses the agent's node for the sort.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2020-11-23 22:30:30 +00:00
|
|
|
- `node-meta` `(string: "")` **Deprecated** - Use `filter` with the `NodeMeta` selector instead.
|
|
|
|
This parameter will be removed in a future version of Consul.
|
|
|
|
Specifies a desired node metadata key/value pair
|
2017-04-04 16:33:22 +00:00
|
|
|
of the form `key:value`. This parameter can be specified multiple times, and
|
2022-05-10 15:51:11 +00:00
|
|
|
filters the results to nodes with the specified key/value pairs.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2019-04-16 16:00:15 +00:00
|
|
|
- `filter` `(string: "")` - Specifies the expression used to filter the
|
|
|
|
queries results prior to returning the data.
|
2020-04-06 20:27:35 +00:00
|
|
|
|
2022-09-16 21:48:03 +00:00
|
|
|
- `merge-central-config` - Include this flag in a request for `connect-proxy` kind or `*-gateway` kind
|
|
|
|
services to return a fully resolved service definition that includes merged values from the
|
|
|
|
[proxy-defaults/global](/docs/connect/config-entries/proxy-defaults) and
|
|
|
|
[service-defaults/:service](/docs/connect/config-entries/service-defaults) config entries.
|
|
|
|
Returning a fully resolved service definition is useful when a service was registered using the
|
|
|
|
[/catalog/register](/api-docs/catalog#register_entity) endpoint, which does not automatically merge config entries.
|
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
- `ns` `(string: "")` <EnterpriseAlert inline /> - Specifies the namespace of the services you lookup.
|
|
|
|
You can also [specify the namespace through other methods](#methods-to-specify-namespace).
|
2019-04-16 16:00:15 +00:00
|
|
|
|
2022-09-16 21:48:03 +00:00
|
|
|
|
2017-04-04 16:33:22 +00:00
|
|
|
### Sample Request
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2017-04-04 16:33:22 +00:00
|
|
|
$ curl \
|
2021-04-16 19:50:02 +00:00
|
|
|
http://127.0.0.1:8500/v1/catalog/service/web?ns=default
|
2017-04-04 16:33:22 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"ID": "40e4a748-2192-161a-0510-9bf59fe950b5",
|
2021-04-16 19:50:02 +00:00
|
|
|
"Node": "t2.320",
|
2017-04-04 16:33:22 +00:00
|
|
|
"Address": "192.168.10.10",
|
2017-04-18 12:02:24 +00:00
|
|
|
"Datacenter": "dc1",
|
2017-04-04 16:33:22 +00:00
|
|
|
"TaggedAddresses": {
|
|
|
|
"lan": "192.168.10.10",
|
|
|
|
"wan": "10.0.10.10"
|
|
|
|
},
|
2017-09-11 10:14:47 +00:00
|
|
|
"NodeMeta": {
|
2017-09-11 11:01:56 +00:00
|
|
|
"somekey": "somevalue"
|
2017-04-04 16:33:22 +00:00
|
|
|
},
|
|
|
|
"CreateIndex": 51,
|
|
|
|
"ModifyIndex": 51,
|
|
|
|
"ServiceAddress": "172.17.0.3",
|
|
|
|
"ServiceEnableTagOverride": false,
|
|
|
|
"ServiceID": "32a2a47f7992:nodea:5000",
|
2021-04-16 19:50:02 +00:00
|
|
|
"ServiceName": "web",
|
2017-04-04 16:33:22 +00:00
|
|
|
"ServicePort": 5000,
|
2018-02-11 13:12:41 +00:00
|
|
|
"ServiceMeta": {
|
2021-04-16 19:50:02 +00:00
|
|
|
"web_meta_value": "baz"
|
2018-02-11 13:12:41 +00:00
|
|
|
},
|
2019-06-17 14:51:50 +00:00
|
|
|
"ServiceTaggedAddresses": {
|
|
|
|
"lan": {
|
|
|
|
"address": "172.17.0.3",
|
|
|
|
"port": 5000
|
|
|
|
},
|
|
|
|
"wan": {
|
|
|
|
"address": "198.18.0.1",
|
|
|
|
"port": 512
|
|
|
|
}
|
|
|
|
},
|
2021-04-16 19:50:02 +00:00
|
|
|
"ServiceTags": ["prod"],
|
2018-09-12 16:07:47 +00:00
|
|
|
"ServiceProxy": {
|
2020-04-06 20:27:35 +00:00
|
|
|
"DestinationServiceName": "",
|
|
|
|
"DestinationServiceID": "",
|
|
|
|
"LocalServiceAddress": "",
|
|
|
|
"LocalServicePort": 0,
|
|
|
|
"Config": null,
|
|
|
|
"Upstreams": null
|
2018-09-12 16:07:47 +00:00
|
|
|
},
|
|
|
|
"ServiceConnect": {
|
2020-04-06 20:27:35 +00:00
|
|
|
"Native": false,
|
|
|
|
"Proxy": null
|
2018-09-12 16:07:47 +00:00
|
|
|
},
|
2019-12-10 02:26:41 +00:00
|
|
|
"Namespace": "default"
|
2017-04-04 16:33:22 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
- `Address` is the IP address of the Consul node on which the service is
|
|
|
|
registered.
|
|
|
|
|
2017-04-18 12:02:24 +00:00
|
|
|
- `Datacenter` is the data center of the Consul node on which the service is
|
|
|
|
registered.
|
|
|
|
|
2017-04-04 16:33:22 +00:00
|
|
|
- `TaggedAddresses` is the list of explicit LAN and WAN IP addresses for the
|
|
|
|
agent
|
|
|
|
|
2017-09-11 10:14:47 +00:00
|
|
|
- `NodeMeta` is a list of user-defined metadata key/value pairs for the node
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
- `CreateIndex` is an internal index value representing when the service was
|
|
|
|
created
|
|
|
|
|
|
|
|
- `ModifyIndex` is the last index that modified the service
|
|
|
|
|
|
|
|
- `Node` is the name of the Consul node on which the service is registered
|
|
|
|
|
|
|
|
- `ServiceAddress` is the IP address of the service host — if empty, node
|
|
|
|
address should be used
|
|
|
|
|
|
|
|
- `ServiceEnableTagOverride` indicates whether service tags can be overridden on
|
|
|
|
this service
|
|
|
|
|
|
|
|
- `ServiceID` is a unique service instance identifier
|
|
|
|
|
|
|
|
- `ServiceName` is the name of the service
|
|
|
|
|
2018-02-11 13:12:41 +00:00
|
|
|
- `ServiceMeta` is a list of user-defined metadata key/value pairs for the service
|
|
|
|
|
2017-04-04 16:33:22 +00:00
|
|
|
- `ServicePort` is the port number of the service
|
|
|
|
|
|
|
|
- `ServiceTags` is a list of tags for the service
|
|
|
|
|
2019-06-17 14:51:50 +00:00
|
|
|
- `ServiceTaggedAddresses` is the map of explicit LAN and WAN addresses for the
|
|
|
|
service instance. This includes both the address as well as the port.
|
|
|
|
|
2018-05-29 21:07:40 +00:00
|
|
|
- `ServiceKind` is the kind of service, usually "". See the Agent
|
2022-03-30 21:16:26 +00:00
|
|
|
[service registration API](/api-docs/agent/service#kind) for more information.
|
2018-05-29 21:07:40 +00:00
|
|
|
|
2018-09-12 16:07:47 +00:00
|
|
|
- `ServiceProxy` is the proxy config as specified in
|
2020-04-09 23:46:54 +00:00
|
|
|
[Connect Proxies](/docs/connect/proxies).
|
2018-05-29 21:07:40 +00:00
|
|
|
|
2020-04-09 23:20:00 +00:00
|
|
|
- `ServiceConnect` are the [Connect](/docs/connect) settings. The
|
2018-09-12 16:07:47 +00:00
|
|
|
value of this struct is equivalent to the `Connect` field for service
|
|
|
|
registration.
|
2020-04-06 20:27:35 +00:00
|
|
|
|
2019-12-10 02:26:41 +00:00
|
|
|
- `Namespace` is the Consul Enterprise namespace of this service instance
|
2018-06-05 16:43:49 +00:00
|
|
|
|
2019-04-16 16:00:15 +00:00
|
|
|
### Filtering
|
|
|
|
|
|
|
|
Filtering is executed against each entry in the top level result list with the
|
|
|
|
following selectors and filter operations being supported:
|
|
|
|
|
2021-04-16 19:50:02 +00:00
|
|
|
| Selector | Supported Operations |
|
|
|
|
| ---------------------------------------------------- | -------------------------------------------------- |
|
|
|
|
| `Address` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Datacenter` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ID` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Node` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `NodeMeta.<any>` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `NodeMeta` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
| `ServiceAddress` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceConnect.Native` | Equal, Not Equal |
|
|
|
|
| `ServiceEnableTagOverride` | Equal, Not Equal |
|
|
|
|
| `ServiceID` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceKind` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceMeta.<any>` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceMeta` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
| `ServiceName` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServicePort` | Equal, Not Equal |
|
|
|
|
| `ServiceProxy.DestinationServiceID` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.DestinationServiceName` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.LocalServiceAddress` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.LocalServicePort` | Equal, Not Equal |
|
|
|
|
| `ServiceProxy.Mode` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.TransparentProxy.OutboundListenerPort` | Equal, Not Equal |
|
|
|
|
| `ServiceProxy.MeshGateway.Mode` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams.Datacenter` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams.DestinationName` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams.DestinationNamespace` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams.DestinationType` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams.LocalBindAddress` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams.LocalBindPort` | Equal, Not Equal |
|
|
|
|
| `ServiceProxy.Upstreams.MeshGateway.Mode` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceProxy.Upstreams` | Is Empty, Is Not Empty |
|
|
|
|
| `ServiceTaggedAddresses.<any>.Address` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `ServiceTaggedAddresses.<any>.Port` | Equal, Not Equal |
|
|
|
|
| `ServiceTaggedAddresses` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
| `ServiceTags` | In, Not In, Is Empty, Is Not Empty |
|
|
|
|
| `ServiceWeights.Passing` | Equal, Not Equal |
|
|
|
|
| `ServiceWeights.Warning` | Equal, Not Equal |
|
|
|
|
| `TaggedAddresses.<any>` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `TaggedAddresses` | Is Empty, Is Not Empty, In, Not In |
|
2019-04-16 16:00:15 +00:00
|
|
|
|
2018-05-29 21:07:40 +00:00
|
|
|
## List Nodes for Connect-capable Service
|
|
|
|
|
|
|
|
This endpoint returns the nodes providing a
|
2020-04-09 23:20:00 +00:00
|
|
|
[Connect-capable](/docs/connect) service in a given datacenter.
|
2018-05-29 21:07:40 +00:00
|
|
|
This will include both proxies and native integrations. A service may
|
|
|
|
register both Connect-capable and incapable services at the same time,
|
|
|
|
so this endpoint may be used to filter only the Connect-capable endpoints.
|
|
|
|
|
2022-03-19 20:32:38 +00:00
|
|
|
@include 'http_api_results_filtered_by_acls.mdx'
|
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | --------------------------- | ------------------ |
|
|
|
|
| `GET` | `/catalog/connect/:service` | `application/json` |
|
2018-05-29 21:07:40 +00:00
|
|
|
|
2018-07-20 15:50:28 +00:00
|
|
|
Parameters and response format are the same as
|
2022-05-10 15:51:11 +00:00
|
|
|
[`/catalog/service/:service_name`](/api-docs/catalog#list-nodes-for-service).
|
2018-05-29 21:07:40 +00:00
|
|
|
|
2020-01-24 14:27:25 +00:00
|
|
|
## Retrieve Map of Services for a Node
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
This endpoint returns the node's registered services.
|
|
|
|
|
2022-03-19 20:32:38 +00:00
|
|
|
@include 'http_api_results_filtered_by_acls.mdx'
|
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | -------------------------- | ------------------ |
|
|
|
|
| `GET` | `/catalog/node/:node_name` | `application/json` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2022-03-30 21:16:26 +00:00
|
|
|
[blocking queries](/api-docs/features/blocking),
|
|
|
|
[consistency modes](/api-docs/features/consistency),
|
|
|
|
[agent caching](/api-docs/features/caching), and
|
2022-10-18 19:49:07 +00:00
|
|
|
[required ACLs](/api-docs/api-structure#authentication).
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2018-09-06 10:34:28 +00:00
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | ------------- | ------------------------ |
|
|
|
|
| `YES` | `all` | `none` | `node:read,service:read` |
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
### Path Parameters
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
- `node_name` `(string: <required>)` - Specifies the name of the node to list services for.
|
|
|
|
|
|
|
|
### Query Parameters
|
2017-04-04 16:33:22 +00:00
|
|
|
|
|
|
|
- `dc` `(string: "")` - Specifies the datacenter to query. This will default to
|
2022-05-10 15:51:11 +00:00
|
|
|
the datacenter of the agent being queried.
|
2017-04-04 16:33:22 +00:00
|
|
|
|
2019-04-16 16:00:15 +00:00
|
|
|
- `filter` `(string: "")` - Specifies the expression used to filter the
|
|
|
|
queries results prior to returning the data.
|
2020-04-06 20:27:35 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
- `ns` `(string: "")` <EnterpriseAlert inline /> - Specifies the namespace of the services you lookup.
|
|
|
|
You can also [specify the namespace through other methods](#methods-to-specify-namespace).
|
2019-04-16 16:00:15 +00:00
|
|
|
|
2017-04-04 16:33:22 +00:00
|
|
|
### Sample Request
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2017-04-04 16:33:22 +00:00
|
|
|
$ curl \
|
2018-08-28 16:07:15 +00:00
|
|
|
http://127.0.0.1:8500/v1/catalog/node/my-node
|
2017-04-04 16:33:22 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Node": {
|
|
|
|
"ID": "40e4a748-2192-161a-0510-9bf59fe950b5",
|
2021-04-16 19:50:02 +00:00
|
|
|
"Node": "t2-node",
|
2017-04-04 16:33:22 +00:00
|
|
|
"Address": "10.1.10.12",
|
2017-04-18 12:02:24 +00:00
|
|
|
"Datacenter": "dc1",
|
2017-04-04 16:33:22 +00:00
|
|
|
"TaggedAddresses": {
|
|
|
|
"lan": "10.1.10.12",
|
|
|
|
"wan": "10.1.10.12"
|
|
|
|
},
|
|
|
|
"Meta": {
|
|
|
|
"instance_type": "t2.medium"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Services": {
|
|
|
|
"consul": {
|
|
|
|
"ID": "consul",
|
|
|
|
"Service": "consul",
|
|
|
|
"Tags": null,
|
2018-03-28 14:04:50 +00:00
|
|
|
"Meta": {},
|
2017-04-04 16:33:22 +00:00
|
|
|
"Port": 8300
|
|
|
|
},
|
|
|
|
"redis": {
|
|
|
|
"ID": "redis",
|
|
|
|
"Service": "redis",
|
2019-06-17 14:51:50 +00:00
|
|
|
"TaggedAddresses": {
|
|
|
|
"lan": {
|
|
|
|
"address": "10.1.10.12",
|
2020-04-06 20:27:35 +00:00
|
|
|
"port": 8000
|
2019-06-17 14:51:50 +00:00
|
|
|
},
|
|
|
|
"wan": {
|
|
|
|
"address": "198.18.1.2",
|
|
|
|
"port": 80
|
|
|
|
}
|
|
|
|
},
|
2020-04-06 20:27:35 +00:00
|
|
|
"Tags": ["v1"],
|
2018-03-28 14:04:50 +00:00
|
|
|
"Meta": {
|
2018-02-11 13:12:41 +00:00
|
|
|
"redis_version": "4.0"
|
|
|
|
},
|
2019-12-10 02:26:41 +00:00
|
|
|
"Port": 8000,
|
|
|
|
"Namespace": "default"
|
2017-04-04 16:33:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2019-04-16 16:00:15 +00:00
|
|
|
|
|
|
|
### Filtering
|
|
|
|
|
|
|
|
The filter will be executed against each value in the `Services` mapping within the
|
|
|
|
top level Node object. The following selectors and filter operations are supported:
|
|
|
|
|
2021-04-16 19:50:02 +00:00
|
|
|
| Selector | Supported Operations |
|
|
|
|
| --------------------------------------------- | -------------------------------------------------- |
|
|
|
|
| `Address` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Connect.Native` | Equal, Not Equal |
|
|
|
|
| `EnableTagOverride` | Equal, Not Equal |
|
|
|
|
| `ID` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Kind` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Meta` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
| `Meta.<any>` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Port` | Equal, Not Equal |
|
|
|
|
| `Proxy.DestinationServiceID` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.DestinationServiceName` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.LocalServiceAddress` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.LocalServicePort` | Equal, Not Equal |
|
|
|
|
| `Proxy.Mode` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.TransparentProxy.OutboundListenerPort` | Equal, Not Equal |
|
|
|
|
| `Proxy.MeshGateway.Mode` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.Upstreams` | Is Empty, Is Not Empty |
|
|
|
|
| `Proxy.Upstreams.Datacenter` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.Upstreams.DestinationName` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.Upstreams.DestinationNamespace` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.Upstreams.DestinationType` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.Upstreams.LocalBindAddress` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.Upstreams.LocalBindPort` | Equal, Not Equal |
|
|
|
|
| `Proxy.Upstreams.MeshGateway.Mode` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Service` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `TaggedAddresses` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
| `TaggedAddresses.<any>.Address` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `TaggedAddresses.<any>.Port` | Equal, Not Equal |
|
|
|
|
| `Tags` | In, Not In, Is Empty, Is Not Empty |
|
|
|
|
| `Weights.Passing` | Equal, Not Equal |
|
|
|
|
| `Weights.Warning` | Equal, Not Equal |
|
2020-01-24 14:27:25 +00:00
|
|
|
|
|
|
|
## List Services for Node
|
|
|
|
|
|
|
|
This endpoint returns the node's registered services.
|
|
|
|
|
2022-03-19 20:32:38 +00:00
|
|
|
@include 'http_api_results_filtered_by_acls.mdx'
|
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ----------------------------------- | ------------------ |
|
|
|
|
| `GET` | `/catalog/node-services/:node_name` | `application/json` |
|
2020-01-24 14:27:25 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2022-03-30 21:16:26 +00:00
|
|
|
[blocking queries](/api-docs/features/blocking),
|
|
|
|
[consistency modes](/api-docs/features/consistency),
|
|
|
|
[agent caching](/api-docs/features/caching), and
|
2022-10-18 19:49:07 +00:00
|
|
|
[required ACLs](/api-docs/api-structure#authentication).
|
2020-01-24 14:27:25 +00:00
|
|
|
|
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | ------------- | ------------------------ |
|
|
|
|
| `YES` | `all` | `none` | `node:read,service:read` |
|
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
### Path Parameters
|
|
|
|
|
|
|
|
- `node_name` `(string: <required>)` - Specifies the name of the node to list services for.
|
2020-01-24 14:27:25 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
### Query Parameters
|
2020-01-24 14:27:25 +00:00
|
|
|
|
|
|
|
- `dc` `(string: "")` - Specifies the datacenter to query. This will default to
|
2022-05-10 15:51:11 +00:00
|
|
|
the datacenter of the agent being queried.
|
2020-01-24 14:27:25 +00:00
|
|
|
|
|
|
|
- `filter` `(string: "")` - Specifies the expression used to filter the
|
|
|
|
queries results prior to returning the data.
|
2020-04-06 20:27:35 +00:00
|
|
|
|
2022-09-16 21:48:03 +00:00
|
|
|
- `merge-central-config` - Include this flag in a request for `connect-proxy` kind or `*-gateway` kind
|
|
|
|
services to return a fully resolved service definition that includes merged values from the
|
|
|
|
[proxy-defaults/global](/docs/connect/config-entries/proxy-defaults) and
|
|
|
|
[service-defaults/:service](/docs/connect/config-entries/service-defaults) config entries.
|
|
|
|
Returning a fully resolved service definition is useful when a service was registered using the
|
|
|
|
[/catalog/register](/api-docs/catalog#register_entity) endpoint, which does not automatically merge config entries.
|
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
- `ns` `(string: "")` <EnterpriseAlert inline /> - Specifies the namespace of the services you lookup.
|
|
|
|
The namespace may be specified as '\*' to return results for all namespaces.
|
|
|
|
You can also [specify the namespace through other methods](#methods-to-specify-namespace).
|
2020-01-24 14:27:25 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2020-01-24 14:27:25 +00:00
|
|
|
$ curl \
|
2021-04-16 19:50:02 +00:00
|
|
|
http://127.0.0.1:8500/v1/catalog/node-services/t2-node
|
2020-01-24 14:27:25 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Node": {
|
|
|
|
"ID": "40e4a748-2192-161a-0510-9bf59fe950b5",
|
2021-04-16 19:50:02 +00:00
|
|
|
"Node": "t2-node",
|
2020-01-24 14:27:25 +00:00
|
|
|
"Address": "10.1.10.12",
|
|
|
|
"Datacenter": "dc1",
|
|
|
|
"TaggedAddresses": {
|
|
|
|
"lan": "10.1.10.12",
|
|
|
|
"wan": "10.1.10.12"
|
|
|
|
},
|
|
|
|
"Meta": {
|
|
|
|
"instance_type": "t2.medium"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Services": [
|
|
|
|
{
|
|
|
|
"ID": "consul",
|
|
|
|
"Service": "consul",
|
|
|
|
"Tags": null,
|
|
|
|
"Meta": {},
|
|
|
|
"Port": 8300
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"ID": "redis",
|
|
|
|
"Service": "redis",
|
|
|
|
"TaggedAddresses": {
|
|
|
|
"lan": {
|
|
|
|
"address": "10.1.10.12",
|
2021-04-16 19:50:02 +00:00
|
|
|
"port": 8000
|
2020-01-24 14:27:25 +00:00
|
|
|
},
|
|
|
|
"wan": {
|
|
|
|
"address": "198.18.1.2",
|
|
|
|
"port": 80
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Tags": [
|
|
|
|
"v1"
|
|
|
|
],
|
|
|
|
"Meta": {
|
|
|
|
"redis_version": "4.0"
|
|
|
|
},
|
|
|
|
"Port": 8000,
|
|
|
|
"Namespace": "default"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Filtering
|
|
|
|
|
|
|
|
The filter will be executed against each value in the `Services` list within the
|
|
|
|
top level object. The following selectors and filter operations are supported:
|
|
|
|
|
2021-04-16 19:50:02 +00:00
|
|
|
| Selector | Supported Operations |
|
|
|
|
| --------------------------------------------- | -------------------------------------------------- |
|
|
|
|
| `Address` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Connect.Native` | Equal, Not Equal |
|
|
|
|
| `EnableTagOverride` | Equal, Not Equal |
|
|
|
|
| `ID` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Kind` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Meta` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
| `Meta.<any>` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Port` | Equal, Not Equal |
|
|
|
|
| `Proxy.DestinationServiceID` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.DestinationServiceName` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.LocalServiceAddress` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.LocalServicePort` | Equal, Not Equal |
|
|
|
|
| `Proxy.Mode` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.TransparentProxy.OutboundListenerPort` | Equal, Not Equal |
|
|
|
|
| `Proxy.MeshGateway.Mode` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.Upstreams` | Is Empty, Is Not Empty |
|
|
|
|
| `Proxy.Upstreams.Datacenter` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.Upstreams.DestinationName` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.Upstreams.DestinationNamespace` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.Upstreams.DestinationType` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.Upstreams.LocalBindAddress` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Proxy.Upstreams.LocalBindPort` | Equal, Not Equal |
|
|
|
|
| `Proxy.Upstreams.MeshGateway.Mode` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `Service` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `TaggedAddresses` | Is Empty, Is Not Empty, In, Not In |
|
|
|
|
| `TaggedAddresses.<any>.Address` | Equal, Not Equal, In, Not In, Matches, Not Matches |
|
|
|
|
| `TaggedAddresses.<any>.Port` | Equal, Not Equal |
|
|
|
|
| `Tags` | In, Not In, Is Empty, Is Not Empty |
|
|
|
|
| `Weights.Passing` | Equal, Not Equal |
|
|
|
|
| `Weights.Warning` | Equal, Not Equal |
|
2020-06-12 15:03:14 +00:00
|
|
|
|
|
|
|
## List Services for Gateway
|
|
|
|
|
2020-07-10 17:36:46 +00:00
|
|
|
-> **1.8.0+:** This API is available in Consul versions 1.8.0 and later.
|
|
|
|
|
2020-06-12 15:03:14 +00:00
|
|
|
This endpoint returns the services associated with an ingress gateway or terminating gateway.
|
|
|
|
|
2022-03-19 20:32:38 +00:00
|
|
|
@include 'http_api_results_filtered_by_acls.mdx'
|
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ------------------------------------ | ------------------ |
|
2020-06-12 15:03:14 +00:00
|
|
|
| `GET` | `/catalog/gateway-services/:gateway` | `application/json` |
|
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2022-03-30 21:16:26 +00:00
|
|
|
[blocking queries](/api-docs/features/blocking),
|
|
|
|
[consistency modes](/api-docs/features/consistency),
|
|
|
|
[agent caching](/api-docs/features/caching), and
|
2022-10-18 19:49:07 +00:00
|
|
|
[required ACLs](/api-docs/api-structure#authentication).
|
2020-06-12 15:03:14 +00:00
|
|
|
|
2020-07-08 23:09:00 +00:00
|
|
|
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|
|
|
|
| ---------------- | ----------------- | ------------- | -------------- |
|
2020-06-12 15:03:14 +00:00
|
|
|
| `YES` | `all` | `none` | `service:read` |
|
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
### Path Parameters
|
2020-06-12 15:03:14 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
- `gateway` `(string: <required>)` - Specifies the name of the node to list services for.
|
2020-06-12 15:03:14 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
### Query Parameters
|
|
|
|
|
|
|
|
- `dc` `(string: "")` - Specifies the datacenter to query.
|
|
|
|
This parameter defaults to the datacenter of the agent being queried.
|
2020-06-12 15:03:14 +00:00
|
|
|
|
2022-05-10 15:51:11 +00:00
|
|
|
- `ns` `(string: "")` <EnterpriseAlert inline /> - Specifies the namespace of the services you lookup.
|
|
|
|
The namespace may be specified as '\*' to return results for all namespaces.
|
|
|
|
You can also [specify the namespace through other methods](#methods-to-specify-namespace).
|
2020-06-12 15:03:14 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```shell-session
|
|
|
|
$ curl \
|
|
|
|
http://127.0.0.1:8500/v1/catalog/gateway-services/my-terminating-gateway
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Responses
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"Gateway": {
|
|
|
|
"Name": "my-terminating-gateway",
|
|
|
|
"Namespace": "default"
|
|
|
|
},
|
|
|
|
"Service": {
|
|
|
|
"Name": "api",
|
|
|
|
"Namespace": "frontend"
|
|
|
|
},
|
|
|
|
"GatewayKind": "terminating-gateway",
|
|
|
|
"CAFile": "/etc/certs/ca.pem",
|
|
|
|
"CertFile": "/etc/certs/api/client.pem",
|
|
|
|
"KeyFile": "/etc/certs/api/client.key",
|
|
|
|
"SNI": "api.my-domain",
|
|
|
|
"CreateIndex": 16,
|
|
|
|
"ModifyIndex": 16
|
2020-07-08 23:09:00 +00:00
|
|
|
},
|
2020-06-12 15:03:14 +00:00
|
|
|
{
|
|
|
|
"Gateway": {
|
|
|
|
"Name": "my-terminating-gateway",
|
|
|
|
"Namespace": "default"
|
|
|
|
},
|
|
|
|
"Service": {
|
|
|
|
"Name": "web",
|
|
|
|
"Namespace": "frontend"
|
|
|
|
},
|
|
|
|
"GatewayKind": "terminating-gateway",
|
|
|
|
"CreateIndex": 17,
|
|
|
|
"ModifyIndex": 17
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"Gateway": {
|
|
|
|
"Name": "my-ingress-gateway",
|
|
|
|
"Namespace": "default"
|
|
|
|
},
|
|
|
|
"Service": {
|
|
|
|
"Name": "api",
|
|
|
|
"Namespace": "frontend"
|
|
|
|
},
|
|
|
|
"GatewayKind": "ingress-gateway",
|
|
|
|
"Port": 8888,
|
|
|
|
"Protocol": "http",
|
2020-07-08 23:09:00 +00:00
|
|
|
"Hosts": ["api.mydomain.com"],
|
2020-06-12 15:03:14 +00:00
|
|
|
"CreateIndex": 15,
|
|
|
|
"ModifyIndex": 15
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"Gateway": {
|
|
|
|
"Name": "my-ingress-gateway",
|
|
|
|
"Namespace": "default"
|
|
|
|
},
|
|
|
|
"Service": {
|
|
|
|
"Name": "redis",
|
|
|
|
"Namespace": "ops"
|
|
|
|
},
|
|
|
|
"GatewayKind": "ingress-gateway",
|
|
|
|
"Port": 8443,
|
|
|
|
"Protocol": "tcp",
|
|
|
|
"CreateIndex": 16,
|
|
|
|
"ModifyIndex": 16
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
- `Gateway.Name` is the name of the gateway service of the request
|
|
|
|
|
|
|
|
- `Gateway.Namespace` is the Consul Enterprise namespace of the gateway
|
|
|
|
|
|
|
|
- `Service.Name` is the name of a service associated with the gateway
|
|
|
|
|
|
|
|
- `Service.Namespace` is the Consul Enterprise namespace of a service associated with the gateway
|
|
|
|
|
2020-06-12 19:15:31 +00:00
|
|
|
- `GatewayKind` is the kind of service, will be one of "ingress-gateway" or "terminating-gateway". See the Agent
|
2022-03-30 21:16:26 +00:00
|
|
|
[service registration API](/api-docs/agent/service#kind) for more information.
|
2020-06-12 15:03:14 +00:00
|
|
|
|
|
|
|
- `CAFile` is the path to a CA file the gateway will use for TLS origination to the associated service
|
|
|
|
|
|
|
|
- `CertFile` is the path to a client certificate the gateway will use for TLS origination to the associated service
|
|
|
|
|
|
|
|
- `KeyFile` is the path to a key file the gateway will use for TLS origination to the associated service
|
|
|
|
|
|
|
|
- `SNI` is a hostname or domain name the gateway will specify during the TLS handshake with the associated service
|
|
|
|
|
|
|
|
- `Port` is the port the ingress gateway is listening on for the associated service
|
|
|
|
|
|
|
|
- `Protocol` is the protocol of the ingress gateway's listener for the associated service
|
|
|
|
|
|
|
|
- `Hosts` list of hosts that specify what requests will match to this associated service
|
|
|
|
|
|
|
|
- `FromWildcard` determines whether the service was associated with the gateway by providing a wildcard specifier
|
|
|
|
in the gateway's configuration entry
|
2022-05-10 15:51:11 +00:00
|
|
|
|
|
|
|
## Methods to Specify Namespace <EnterpriseAlert inline />
|
|
|
|
|
|
|
|
Catalog endpoints
|
|
|
|
support several methods for specifying the namespace of resources
|
|
|
|
with the following order of precedence:
|
|
|
|
1. `Namespace` field of the JSON request body -
|
|
|
|
only applies to the [register entity](#register-entity) endpoint
|
|
|
|
1. `ns` query parameter
|
|
|
|
1. `X-Consul-Namespace` request header
|
|
|
|
1. Namespace is inherited from the namespace of the request's ACL token (if any)
|
|
|
|
1. The `default` namespace
|