Skip to content

Commit

Permalink
fix for thanos querier to see store correctly
Browse files Browse the repository at this point in the history
We don't need to label by replica as it's a single prometheus
Prometheus service should be clusterip not nodeport
Thanos store gateway is a headless service
  • Loading branch information
RMcVelia committed Feb 20, 2024
1 parent 4c57002 commit f28d711
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ global:
keep_dropped_targets: 100
external_labels:
cluster: prometheus
# Each Prometheus has to have unique labels.
replica: $(POD_NAME)
rule_files:
- /etc/prometheus/prometheus.rules
alerting:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ global:
keep_dropped_targets: 100
external_labels:
cluster: prometheus
# Each Prometheus has to have unique labels.
replica: $(POD_NAME)
rule_files:
- /etc/prometheus/prometheus.rules
alerting:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ global:
keep_dropped_targets: 100
external_labels:
cluster: prometheus
# Each Prometheus has to have unique labels.
replica: $(POD_NAME)
rule_files:
- /etc/prometheus/prometheus.rules
alerting:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ global:
keep_dropped_targets: 100
external_labels:
cluster: prometheus
# Each Prometheus has to have unique labels.
replica: $(POD_NAME)
rule_files:
- /etc/prometheus/prometheus.rules
alerting:
Expand Down
12 changes: 1 addition & 11 deletions cluster/terraform_kubernetes/prometheus.tf
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,6 @@ resource "kubernetes_deployment" "prometheus" {
# "--reloader.rule-dir=/etc/prometheus/rules/",
]

env {
name = "POD_NAME"
value_from {
field_ref {
field_path = "metadata.name"
}
}
}

liveness_probe {
http_get {
path = "/-/healthy"
Expand Down Expand Up @@ -235,13 +226,12 @@ resource "kubernetes_service" "prometheus" {

spec {
port {
node_port = 30000
name = "prometheus"
port = 8080
target_port = kubernetes_deployment.prometheus.spec[0].template[0].spec[0].container[0].port[0].container_port
}
selector = {
app = "prometheus"
}
type = "NodePort"
}
}
8 changes: 4 additions & 4 deletions cluster/terraform_kubernetes/thanos.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ resource "kubernetes_service" "thanos-store-gateway" {
selector = {
thanos-store-api : "true"
}
type = "ClusterIP"
type = "ClusterIP"
cluster_ip = "None"
}
}

Expand Down Expand Up @@ -84,7 +85,7 @@ resource "kubernetes_deployment" "thanos-querier" {
"query",
"--log.level=debug",
"--query.replica-label=replica",
"--store=dnssrv+thanos-store-gateway:10901",
"--store=dns+thanos-store-gateway:10901",
]

liveness_probe {
Expand Down Expand Up @@ -263,8 +264,7 @@ resource "kubernetes_deployment" "thanos-compactor" {
template {
metadata {
labels = {
app = "thanos-compactor"
thanos-store-api = true
app = "thanos-compactor"
}
}

Expand Down

0 comments on commit f28d711

Please sign in to comment.