From 2090be85a3871cb59673e95dd9c793493362b7c1 Mon Sep 17 00:00:00 2001 From: Pinghao Wu Date: Mon, 3 Feb 2025 13:14:43 +0800 Subject: [PATCH] prometheus: scrape itself from sd --- monitoring/prometheus/configmap.yaml | 3 --- monitoring/prometheus/deployment.yaml | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/monitoring/prometheus/configmap.yaml b/monitoring/prometheus/configmap.yaml index 052af10..1b5e81d 100644 --- a/monitoring/prometheus/configmap.yaml +++ b/monitoring/prometheus/configmap.yaml @@ -54,9 +54,6 @@ data: target_label: node - action: labelmap regex: __meta_kubernetes_pod_annotation_prometheus_xdavidwu_link_(.+) - - job_name: 'prometheus' - static_configs: - - targets: ['localhost:9090'] - job_name: 'ceph' static_configs: - targets: ['10.0.3.1:9283'] diff --git a/monitoring/prometheus/deployment.yaml b/monitoring/prometheus/deployment.yaml index ccb6d75..51aed45 100644 --- a/monitoring/prometheus/deployment.yaml +++ b/monitoring/prometheus/deployment.yaml @@ -7,6 +7,11 @@ spec: type: Recreate replicas: 1 template: + metadata: + annotations: + prometheus.xdavidwu.link/instance: main + labels: + metrics: metrics spec: containers: - name: prometheus @@ -18,6 +23,9 @@ spec: # leave compaction to thanos - --storage.tsdb.min-block-duration=2h - --storage.tsdb.max-block-duration=2h + ports: + - name: metrics + containerPort: 9090 volumeMounts: - name: configs mountPath: /etc/prometheus -- 2.45.2