From 1f743693c58cfb40910fafe1930783fdb0ab37a0 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Mon, 11 Nov 2024 19:03:28 +0100 Subject: [PATCH] feat(node-exporter): Add exporter for hardware metrics --- manifests/kustomization.yaml | 1 + manifests/node-exporter/daemonset.yaml | 55 +++++++++++++++++++++ manifests/node-exporter/kustomization.yaml | 7 +++ manifests/node-exporter/service.yaml | 17 +++++++ manifests/node-exporter/servicemonitor.yaml | 12 +++++ 5 files changed, 92 insertions(+) create mode 100644 manifests/node-exporter/daemonset.yaml create mode 100644 manifests/node-exporter/kustomization.yaml create mode 100644 manifests/node-exporter/service.yaml create mode 100644 manifests/node-exporter/servicemonitor.yaml diff --git a/manifests/kustomization.yaml b/manifests/kustomization.yaml index 91c53c8..8afc7ec 100644 --- a/manifests/kustomization.yaml +++ b/manifests/kustomization.yaml @@ -9,3 +9,4 @@ resources: - loki - prometheus - grafana + - node-exporter diff --git a/manifests/node-exporter/daemonset.yaml b/manifests/node-exporter/daemonset.yaml new file mode 100644 index 0000000..052d74d --- /dev/null +++ b/manifests/node-exporter/daemonset.yaml @@ -0,0 +1,55 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + labels: + app.kubernetes.io/component: exporter + app.kubernetes.io/name: node-exporter + name: node-exporter + namespace: monitoring +spec: + selector: + matchLabels: + app.kubernetes.io/component: exporter + app.kubernetes.io/name: node-exporter + template: + metadata: + labels: + app.kubernetes.io/component: exporter + app.kubernetes.io/name: node-exporter + spec: + containers: + - args: + - --path.sysfs=/host/sys + - --path.rootfs=/host/root + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + name: node-exporter + image: prom/node-exporter + ports: + - containerPort: 9100 + protocol: TCP + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + volumeMounts: + - mountPath: /host/sys + mountPropagation: HostToContainer + name: sys + readOnly: true + - mountPath: /host/root + mountPropagation: HostToContainer + name: root + readOnly: true + volumes: + - hostPath: + path: /sys + name: sys + - hostPath: + path: / + name: root diff --git a/manifests/node-exporter/kustomization.yaml b/manifests/node-exporter/kustomization.yaml new file mode 100644 index 0000000..5a146eb --- /dev/null +++ b/manifests/node-exporter/kustomization.yaml @@ -0,0 +1,7 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - daemonset.yaml + - service.yaml + - servicemonitor.yaml diff --git a/manifests/node-exporter/service.yaml b/manifests/node-exporter/service.yaml new file mode 100644 index 0000000..b03b338 --- /dev/null +++ b/manifests/node-exporter/service.yaml @@ -0,0 +1,17 @@ +kind: Service +apiVersion: v1 +metadata: + name: node-exporter + namespace: monitoring + annotations: + prometheus.io/scrape: 'true' + prometheus.io/port: '9100' +spec: + selector: + app.kubernetes.io/component: exporter + app.kubernetes.io/name: node-exporter + ports: + - name: node-exporter + protocol: TCP + port: 9100 + targetPort: 9100 diff --git a/manifests/node-exporter/servicemonitor.yaml b/manifests/node-exporter/servicemonitor.yaml new file mode 100644 index 0000000..d71465d --- /dev/null +++ b/manifests/node-exporter/servicemonitor.yaml @@ -0,0 +1,12 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: node-exporter + namespace: monitoring +spec: + selector: + matchLabels: + app.kubernetes.io/name: node-exporter + endpoints: + - port: node-exporter + path: /metrics