Skip to content

Commit 299704f

Browse files
committed
sd discovery docs improvements
Signed-off-by: trouaux <[email protected]>
1 parent 48a8b3d commit 299704f

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

docs/service-discovery.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ The simplest way to tell a component about a peer is to use a static flag.
2020

2121
### Thanos Querier
2222

23-
The repeatable flag `--endpoint.sd-config=<content>` can be used to specify a `StoreAPI` that `Thanos Querier` should use.
23+
The flag `--endpoint.sd-config=<content>` can be used to specify a `StoreAPI` that `Thanos Querier` should use. It expects a formatted configuration.
24+
25+
```
26+
--endpoint.sd-config=endpoints: [{address: "localhost:9090"}]
27+
```
2428

2529
### Thanos Ruler
2630

@@ -32,29 +36,32 @@ The repeatable flag `--endpoint.sd-config=<content>` can be used to specify a `S
3236

3337
File Service Discovery is another mechanism for configuring components. With File SD, a list of files can be watched for updates, and the new configuration will be dynamically loaded when a change occurs. The list of files to watch is passed to a component via a flag shown in the component-specific sections below.
3438

35-
The format of the configuration file is the same as the one used in [Prometheus' File SD](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#file_sd_config). Both YAML and JSON files can be used. The format of the files is as follows:
39+
Both YAML and JSON files can be used. The format of the files is as follows:
3640

3741
* JSON:
3842

3943
```json
40-
[
41-
{
42-
"targets": ["localhost:9090", "example.org:443"]
43-
}
44-
]
44+
{
45+
"endpoints": [
46+
{ "address": "localhost:9090" },
47+
{ "address": "example.org:443" }
48+
]
49+
}
4550
```
4651

4752
* YAML:
4853

4954
```yaml
50-
- targets: ['localhost:9090', 'example.org:443']
55+
endpoints:
56+
- address: 'localhost:9090'
57+
- address: 'example.org:443'
5158
```
5259
5360
As a fallback, the file contents are periodically re-read at an interval that can be set using a flag specific to the component as shown below. The default value for all File SD re-read intervals is 5 minutes.
5461
5562
### Thanos Querier
5663
57-
The repeatable flag `--endpoint.sd-config-file` can be used to specify the path to files that contain addresses of `StoreAPI` servers.
64+
The flag `--endpoint.sd-config-file` can be used to specify the path to files that contain addresses of `StoreAPI` servers.
5865

5966
The flag `--endpoint.sd-config-reload-interval=<5m>` can be used to change the fallback re-read interval from the default 5 minutes.
6067

@@ -73,27 +80,27 @@ To use DNS SD, just add one of the following prefixes to the domain name in your
7380
* `dns+` - the domain name after this prefix will be looked up as an A/AAAA query. *A port is required for this query type*. An example using this lookup with a static flag:
7481

7582
```
76-
--endpoint.sd-config=dns+stores.thanos.mycompany.org:9090
83+
--endpoint.sd-config=endpoints: [{address: "dns+stores.thanos.mycompany.org:9090"}]
7784
```
7885
7986
* `dnssrv+` - the domain name after this prefix will be looked up as a SRV query, and then each SRV record will be looked up as an A/AAAA query. You do not need to specify a port as the one from the query results will be used. For example:
8087
8188
```
82-
--endpoint.sd-config=dnssrv+_thanosstores._tcp.mycompany.org
89+
--endpoint.sd-config=endpoints: [{address: "dnssrv+_thanosstores._tcp.mycompany.org"}]
8390
```
8491
8592
DNS SRV record discovery also work well within Kubernetes. Consider the following example:
8693
8794
```
88-
--endpoint.sd-config=dnssrv+_grpc._tcp.thanos-store.monitoring.svc
95+
--endpoint.sd-config=endpoints: [{address: "dnssrv+_grpc._tcp.thanos-store.monitoring.svc"}]
8996
```
9097
9198
This configuration will instruct Thanos to discover all endpoints within the `thanos-store` service in the `monitoring` namespace and use the declared port named `grpc`.
9299
93100
* `dnssrvnoa+` - the domain name after this prefix will be looked up as a SRV query, with no A/AAAA lookup made after that. Similar to the `dnssrv+` case, you do not need to specify a port. For example:
94101
95102
```
96-
--endpoint.sd-config=dnssrvnoa+_thanosstores._tcp.mycompany.org
103+
--endpoint.sd-config=endpoints: [{address: "dnssrvnoa+_thanosstores._tcp.mycompany.org"}]
97104
```
98105
99106
The default interval between DNS lookups is 30s. This interval can be changed using the `store.sd-dns-interval` flag for `StoreAPI` configuration in `Thanos Querier`, or `query.sd-dns-interval` for `QueryAPI` configuration in `Thanos Ruler`.

0 commit comments

Comments
 (0)