Skip to content

Commit 55d4a7c

Browse files
authored
Do not depend on clusterDomain == cluster.local (#325)
* Do not depend on clusterDomain == cluster.local While the default DNS domain of a Kubernetes cluster is 'cluster.local', it can be changed. Furthermore, container running in Kubernetes gets injected search domains in their /etc/resolv.conf of the following form: search <namespace>.svc.<cluster-domain> svc.<cluster-domain> <cluster-domain> This means a good way to be agnostic regarding the cluster DNS domain is to simply not specify it. The downside is that the number of DNS queries might increase, because the search domains are tried in order (which is why "<service>.<ns>" is better than "<service>.<ns>.svc"). Signed-off-by: Max Gautier <mg@max.gautier.name> * Apply 'make generate validate' Signed-off-by: Max Gautier <mg@max.gautier.name> --------- Signed-off-by: Max Gautier <mg@max.gautier.name>
1 parent 6fedb04 commit 55d4a7c

22 files changed

Lines changed: 45 additions & 46 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ We use *breaking* word for marking changes that are not backward compatible (rel
2020
- [#279](https://github.com/thanos-io/kube-thanos/pull/279) Change `hashringConfigmapName` to `hashringConfigMapName` in Receive configuration.
2121
- [#284](https://github.com/thanos-io/kube-thanos/pull/284) Change Receive `PodDisruptionBudget` api version to `policy/v1`
2222
- [#293](https://github.com/thanos-io/kube-thanos/pull/293) Upgrade to Thanos v0.30.2
23+
- [#325](https://github.com/thanos-io/kube-thanos/pull/325) Do not depend on Kubernetes cluster DNS domain to be 'cluster.local'.
2324

2425
### Added
2526

all.jsonnet

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ local s = t.store(commonConfig {
121121
// NOTICE: <MEMCACHED_SERVICE> is a placeholder to generate examples.
122122
// List of memcached addresses, that will get resolved with the DNS service discovery provider.
123123
// For DNS service discovery reference https://thanos.io/tip/thanos/service-discovery.md/#dns-service-discovery
124-
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERVICE>.%s.svc.cluster.local' % commonConfig.namespace],
124+
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERVICE>.%s' % commonConfig.namespace],
125125
},
126126
},
127127
indexCache: {
@@ -130,7 +130,7 @@ local s = t.store(commonConfig {
130130
// NOTICE: <MEMCACHED_SERVICE> is a placeholder to generate examples.
131131
// List of memcached addresses, that will get resolved with the DNS service discovery provider.
132132
// For DNS service discovery reference https://thanos.io/tip/thanos/service-discovery.md/#dns-service-discovery
133-
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERVICE>.%s.svc.cluster.local' % commonConfig.namespace],
133+
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERVICE>.%s' % commonConfig.namespace],
134134
},
135135
},
136136
});
@@ -152,12 +152,12 @@ local q = t.query(commonConfig {
152152
});
153153

154154
local finalRu = t.rule(ru.config {
155-
queriers: ['dnssrv+_http._tcp.%s.%s.svc.cluster.local' % [q.service.metadata.name, q.service.metadata.namespace]],
155+
queriers: ['dnssrv+_http._tcp.%s.%s' % [q.service.metadata.name, q.service.metadata.namespace]],
156156
});
157157

158158
local qf = t.queryFrontend(commonConfig {
159159
replicas: 1,
160-
downstreamURL: 'http://%s.%s.svc.cluster.local.:%d' % [
160+
downstreamURL: 'http://%s.%s:%d' % [
161161
q.service.metadata.name,
162162
q.service.metadata.namespace,
163163
q.service.spec.ports[1].port,
@@ -172,7 +172,7 @@ local qf = t.queryFrontend(commonConfig {
172172
// NOTICE: <MEMCACHED_SERVICE> is a placeholder to generate examples.
173173
// List of memcached addresses, that will get resolved with the DNS service discovery provider.
174174
// For DNS service discovery reference https://thanos.io/tip/thanos/service-discovery.md/#dns-service-discovery
175-
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERVICE>.%s.svc.cluster.local' % commonConfig.namespace],
175+
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERVICE>.%s' % commonConfig.namespace],
176176
},
177177
},
178178
labelsCache: {
@@ -181,7 +181,7 @@ local qf = t.queryFrontend(commonConfig {
181181
// NOTICE: <MEMCACHED_SERVICE> is a placeholder to generate examples.
182182
// List of memcached addresses, that will get resolved with the DNS service discovery provider.
183183
// For DNS service discovery reference https://thanos.io/tip/thanos/service-discovery.md/#dns-service-discovery
184-
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERVICE>.%s.svc.cluster.local' % commonConfig.namespace],
184+
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERVICE>.%s' % commonConfig.namespace],
185185
},
186186
},
187187
});
@@ -213,7 +213,7 @@ local strs = t.storeShards(commonConfig {
213213
// NOTICE: <MEMCACHED_SERVICE> is a placeholder to generate examples.
214214
// List of memcached addresses, that will get resolved with the DNS service discovery provider.
215215
// For DNS service discovery reference https://thanos.io/tip/thanos/service-discovery.md/#dns-service-discovery
216-
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERVICE>.%s.svc.cluster.local' % commonConfig.namespace],
216+
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERVICE>.%s' % commonConfig.namespace],
217217
},
218218
},
219219
indexCache: {
@@ -222,14 +222,14 @@ local strs = t.storeShards(commonConfig {
222222
// NOTICE: <MEMCACHED_SERVICE> is a placeholder to generate examples.
223223
// List of memcached addresses, that will get resolved with the DNS service discovery provider.
224224
// For DNS service discovery reference https://thanos.io/tip/thanos/service-discovery.md/#dns-service-discovery
225-
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERVICE>.%s.svc.cluster.local' % commonConfig.namespace],
225+
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERVICE>.%s' % commonConfig.namespace],
226226
},
227227
},
228228
});
229229

230230
local finalQ = t.query(q.config {
231231
stores: [
232-
'dnssrv+_grpc._tcp.%s.%s.svc.cluster.local' % [service.metadata.name, service.metadata.namespace]
232+
'dnssrv+_grpc._tcp.%s.%s' % [service.metadata.name, service.metadata.namespace]
233233
for service in [re.service, ru.service, sc.service, s.service] +
234234
[rcvs.hashrings[hashring].service for hashring in std.objectFields(rcvs.hashrings)] +
235235
[strs.shards[shard].service for shard in std.objectFields(strs.shards)]

examples/all/manifests/thanos-query-deployment.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ spec:
4646
- --log.format=logfmt
4747
- --query.replica-label=prometheus_replica
4848
- --query.replica-label=rule_replica
49-
- --endpoint=dnssrv+_grpc._tcp.thanos-receive.thanos.svc.cluster.local
50-
- --endpoint=dnssrv+_grpc._tcp.thanos-rule.thanos.svc.cluster.local
51-
- --endpoint=dnssrv+_grpc._tcp.thanos-sidecar.thanos.svc.cluster.local
52-
- --endpoint=dnssrv+_grpc._tcp.thanos-store.thanos.svc.cluster.local
53-
- --endpoint=dnssrv+_grpc._tcp.thanos-receive-default.thanos.svc.cluster.local
54-
- --endpoint=dnssrv+_grpc._tcp.thanos-receive-region-1.thanos.svc.cluster.local
55-
- --endpoint=dnssrv+_grpc._tcp.thanos-store-0.thanos.svc.cluster.local
56-
- --endpoint=dnssrv+_grpc._tcp.thanos-store-1.thanos.svc.cluster.local
57-
- --endpoint=dnssrv+_grpc._tcp.thanos-store-2.thanos.svc.cluster.local
49+
- --endpoint=dnssrv+_grpc._tcp.thanos-receive.thanos
50+
- --endpoint=dnssrv+_grpc._tcp.thanos-rule.thanos
51+
- --endpoint=dnssrv+_grpc._tcp.thanos-sidecar.thanos
52+
- --endpoint=dnssrv+_grpc._tcp.thanos-store.thanos
53+
- --endpoint=dnssrv+_grpc._tcp.thanos-receive-default.thanos
54+
- --endpoint=dnssrv+_grpc._tcp.thanos-receive-region-1.thanos
55+
- --endpoint=dnssrv+_grpc._tcp.thanos-store-0.thanos
56+
- --endpoint=dnssrv+_grpc._tcp.thanos-store-1.thanos
57+
- --endpoint=dnssrv+_grpc._tcp.thanos-store-2.thanos
5858
- --query.timeout=5m
5959
- --query.lookback-delta=15m
6060
- |-

examples/all/manifests/thanos-query-frontend-deployment.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ spec:
4444
- --log.format=logfmt
4545
- --query-frontend.compress-responses
4646
- --http-address=0.0.0.0:9090
47-
- --query-frontend.downstream-url=http://thanos-query.thanos.svc.cluster.local.:9090
47+
- --query-frontend.downstream-url=http://thanos-query.thanos:9090
4848
- --query-range.split-interval=12h
4949
- --labels.split-interval=12h
5050
- --query-range.max-retries-per-request=10
@@ -53,7 +53,7 @@ spec:
5353
- |-
5454
--query-range.response-cache-config="config":
5555
"addresses":
56-
- "dnssrv+_client._tcp.<MEMCACHED_SERVICE>.thanos.svc.cluster.local"
56+
- "dnssrv+_client._tcp.<MEMCACHED_SERVICE>.thanos"
5757
"dns_provider_update_interval": "10s"
5858
"max_async_buffer_size": 10000
5959
"max_async_concurrency": 20
@@ -65,7 +65,7 @@ spec:
6565
- |-
6666
--labels.response-cache-config="config":
6767
"addresses":
68-
- "dnssrv+_client._tcp.<MEMCACHED_SERVICE>.thanos.svc.cluster.local"
68+
- "dnssrv+_client._tcp.<MEMCACHED_SERVICE>.thanos"
6969
"dns_provider_update_interval": "10s"
7070
"max_async_buffer_size": 10000
7171
"max_async_concurrency": 20

examples/all/manifests/thanos-receive-default-statefulSet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ spec:
7676
- --label=replica="$(NAME)"
7777
- --label=receive="true"
7878
- --objstore.config=$(OBJSTORE_CONFIG)
79-
- --receive.local-endpoint=$(NAME).thanos-receive-default.$(NAMESPACE).svc.cluster.local:10901
79+
- --receive.local-endpoint=$(NAME).thanos-receive-default.$(NAMESPACE):10901
8080
- --receive.hashrings-file=/var/lib/thanos-receive/hashrings.json
8181
- |-
8282
--tracing.config="config":

examples/all/manifests/thanos-receive-region-1-statefulSet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ spec:
7676
- --label=replica="$(NAME)"
7777
- --label=receive="true"
7878
- --objstore.config=$(OBJSTORE_CONFIG)
79-
- --receive.local-endpoint=$(NAME).thanos-receive-region-1.$(NAMESPACE).svc.cluster.local:10901
79+
- --receive.local-endpoint=$(NAME).thanos-receive-region-1.$(NAMESPACE):10901
8080
- --receive.hashrings-file=/var/lib/thanos-receive/hashrings.json
8181
- |-
8282
--tracing.config="config":

examples/all/manifests/thanos-receive-statefulSet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ spec:
7272
- --label=replica="$(NAME)"
7373
- --label=receive="true"
7474
- --objstore.config=$(OBJSTORE_CONFIG)
75-
- --receive.local-endpoint=$(NAME).thanos-receive.$(NAMESPACE).svc.cluster.local:10901
75+
- --receive.local-endpoint=$(NAME).thanos-receive.$(NAMESPACE):10901
7676
- --receive.hashrings-file=/var/lib/thanos-receive/hashrings.json
7777
- |-
7878
--tracing.config="config":

examples/all/manifests/thanos-rule-statefulSet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ spec:
5555
- --alert.label-drop=rule_replica
5656
- --tsdb.retention=48h
5757
- --tsdb.block-duration=2h
58-
- --query=dnssrv+_http._tcp.thanos-query.thanos.svc.cluster.local
58+
- --query=dnssrv+_http._tcp.thanos-query.thanos
5959
- --alertmanagers.url=alertmanager:9093
6060
- --alertmanagers.config-file=/etc/thanos/config/thanos-ruler-config/config.yaml
6161
- --rule-file=/etc/thanos/rules/test/test

examples/all/manifests/thanos-store-shard0-statefulSet.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ spec:
5858
- |-
5959
--index-cache.config="config":
6060
"addresses":
61-
- "dnssrv+_client._tcp.<MEMCACHED_SERVICE>.thanos.svc.cluster.local"
61+
- "dnssrv+_client._tcp.<MEMCACHED_SERVICE>.thanos"
6262
"dns_provider_update_interval": "10s"
6363
"max_async_buffer_size": 10000
6464
"max_async_concurrency": 20
@@ -75,7 +75,7 @@ spec:
7575
"chunk_subrange_ttl": "24h"
7676
"config":
7777
"addresses":
78-
- "dnssrv+_client._tcp.<MEMCACHED_SERVICE>.thanos.svc.cluster.local"
78+
- "dnssrv+_client._tcp.<MEMCACHED_SERVICE>.thanos"
7979
"dns_provider_update_interval": "10s"
8080
"max_async_buffer_size": 10000
8181
"max_async_concurrency": 20

examples/all/manifests/thanos-store-shard1-statefulSet.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ spec:
5858
- |-
5959
--index-cache.config="config":
6060
"addresses":
61-
- "dnssrv+_client._tcp.<MEMCACHED_SERVICE>.thanos.svc.cluster.local"
61+
- "dnssrv+_client._tcp.<MEMCACHED_SERVICE>.thanos"
6262
"dns_provider_update_interval": "10s"
6363
"max_async_buffer_size": 10000
6464
"max_async_concurrency": 20
@@ -75,7 +75,7 @@ spec:
7575
"chunk_subrange_ttl": "24h"
7676
"config":
7777
"addresses":
78-
- "dnssrv+_client._tcp.<MEMCACHED_SERVICE>.thanos.svc.cluster.local"
78+
- "dnssrv+_client._tcp.<MEMCACHED_SERVICE>.thanos"
7979
"dns_provider_update_interval": "10s"
8080
"max_async_buffer_size": 10000
8181
"max_async_concurrency": 20

0 commit comments

Comments
 (0)