From 76d1c5115705f6d66f581fe4c9dd32c39e517ca5 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Sat, 20 Apr 2024 19:04:44 +0200 Subject: [PATCH] improve thanos/prometheus retention --- infrastructure/prometheus/prometheus.yaml | 14 ++++++++++++-- .../prometheus/thanos-query.deployment.yaml | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/infrastructure/prometheus/prometheus.yaml b/infrastructure/prometheus/prometheus.yaml index 4ae590d..f204142 100644 --- a/infrastructure/prometheus/prometheus.yaml +++ b/infrastructure/prometheus/prometheus.yaml @@ -4,7 +4,7 @@ metadata: name: prometheus --- apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole +knd: ClusterRole metadata: name: prometheus rules: @@ -51,6 +51,8 @@ spec: resources: requests: memory: 400Mi + retention: 730d + retentionSize: 50Gi serviceAccountName: prometheus enableAdminAPI: false serviceMonitorNamespaceSelector: {} @@ -61,7 +63,15 @@ spec: # loads the config from a secret named thanos-objstore-config in the same namespace key: thanos.yaml name: thanos-objstore-config - + volumeClaimTemplate: + metadata: + name: prometheus-data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 50Gi --- apiVersion: v1 kind: Service diff --git a/infrastructure/prometheus/thanos-query.deployment.yaml b/infrastructure/prometheus/thanos-query.deployment.yaml index b82c1a3..ded5f1e 100644 --- a/infrastructure/prometheus/thanos-query.deployment.yaml +++ b/infrastructure/prometheus/thanos-query.deployment.yaml @@ -22,6 +22,7 @@ spec: - --log.level=debug - --query.replica-label=replica - --endpoint=dnssrv+_grpc._tcp.thanos-store:10901 + - --endpoint=dnssrv+_grpc._tcp.prometheus:9090 ports: - name: http containerPort: 10902 @@ -38,6 +39,20 @@ spec: --- apiVersion: v1 kind: Service +metadata: + name: thanos-querier +spec: + selector: + app: thanos-querier + ports: + - name: http + protocol: TCP + port: 10902 + targetPort: http + - name: grpc + protocol: TCP + port: 10901 + targetPort: grpc metadata: labels: app: thanos-querier