From b608f9c6151c84061baea5b40cbbb759b9b9102c Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Sun, 22 Oct 2017 21:29:31 -0700 Subject: [PATCH] addons: Use service endpoints to scrape node-exporter --- addons/prometheus/config.yaml | 12 ------------ .../exporters/node-exporter/daemonset.yaml | 6 +++++- .../prometheus/exporters/node-exporter/service.yaml | 2 ++ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/addons/prometheus/config.yaml b/addons/prometheus/config.yaml index 184cabae..dd4f7afc 100644 --- a/addons/prometheus/config.yaml +++ b/addons/prometheus/config.yaml @@ -101,18 +101,6 @@ data: target_label: __metrics_path__ replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor - # Scrape config for node-exporter endpoints (e.g. 'node_'). Explore metrics - # from a host running a node-exporter by scraping (127.0.0.1:9100/metrics). - - job_name: 'node-exporters' - - kubernetes_sd_configs: - - role: endpoints - - relabel_configs: - - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name] - action: keep - regex: monitoring;node-exporter;metrics - # Scrape config for service endpoints. # # The relabeling allows the actual service scrape endpoint to be configured diff --git a/addons/prometheus/exporters/node-exporter/daemonset.yaml b/addons/prometheus/exporters/node-exporter/daemonset.yaml index 4c52a057..9289f60f 100644 --- a/addons/prometheus/exporters/node-exporter/daemonset.yaml +++ b/addons/prometheus/exporters/node-exporter/daemonset.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1beta2 kind: DaemonSet metadata: name: node-exporter @@ -8,6 +8,10 @@ spec: type: RollingUpdate rollingUpdate: maxUnavailable: 1 + selector: + matchLabels: + name: node-exporter + phase: prod template: metadata: labels: diff --git a/addons/prometheus/exporters/node-exporter/service.yaml b/addons/prometheus/exporters/node-exporter/service.yaml index d2d86efc..62edcb38 100644 --- a/addons/prometheus/exporters/node-exporter/service.yaml +++ b/addons/prometheus/exporters/node-exporter/service.yaml @@ -3,6 +3,8 @@ kind: Service metadata: name: node-exporter namespace: monitoring + annotations: + prometheus.io/scrape: 'true' spec: type: ClusterIP # service is created to allow prometheus to scape endpoints