From 67fb6c372772c3f8ccb2333f80dd75bb70e3cc43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 23 Aug 2024 07:58:26 +0300 Subject: [PATCH] Consolidate monitoring stack to Kube master nodes --- monitoring/README.md | 8 ++++---- monitoring/alertmanager.yaml | 6 +++--- monitoring/blackbox-exporter.yaml | 7 +++---- monitoring/mikrotik-exporter.yaml | 10 +++++----- monitoring/ping-exporter.yaml | 10 +++++----- monitoring/prometheus.yaml | 6 +++--- monitoring/snmp-exporter.yaml | 10 +++++----- 7 files changed, 28 insertions(+), 29 deletions(-) diff --git a/monitoring/README.md b/monitoring/README.md index f874b5f..3309fb1 100644 --- a/monitoring/README.md +++ b/monitoring/README.md @@ -5,10 +5,10 @@ and the corresponding AlertManager is accessible at [am.k-space.ee](https://am.k Both are [deployed by ArgoCD](https://argocd.k-space.ee/applications/monitoring) from this Git repo directory using Prometheus operator. -Note that Prometheus and other monitoring stack components should use the -`dedicated: monitoring` Kubernetes node selector to make sure the components -get scheduled on `mon[1-3]` nodes which are hosted in a privileged VLAN where -they have access to UPS SNMP targets, Mikrotik router/switch API-s etc. +Note that Prometheus and other monitoring stack components should appropriate +node selector to make sure the components get scheduled on nodes which are +hosted in a privileged VLAN where they have access to UPS SNMP targets, +Mikrotik router/switch API-s etc. To add monitoring targets inside the Kubernetes cluster make use of [PodMonitor](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md#using-podmonitors) or ServiceMonitor custom diff --git a/monitoring/alertmanager.yaml b/monitoring/alertmanager.yaml index d3b06ac..8d25cb0 100644 --- a/monitoring/alertmanager.yaml +++ b/monitoring/alertmanager.yaml @@ -48,11 +48,11 @@ spec: secrets: - slack-secrets nodeSelector: - dedicated: monitoring + node-role.kubernetes.io/control-plane: '' tolerations: - - key: dedicated + - key: node-role.kubernetes.io/control-plane operator: Equal - value: monitoring + value: '' effect: NoSchedule replicas: 3 serviceAccountName: alertmanager diff --git a/monitoring/blackbox-exporter.yaml b/monitoring/blackbox-exporter.yaml index 9966253..9592992 100644 --- a/monitoring/blackbox-exporter.yaml +++ b/monitoring/blackbox-exporter.yaml @@ -180,13 +180,12 @@ spec: - name: blackbox-exporter-config configMap: name: blackbox-exporter-config - # TODO: Results in odd 6s connection lag if scheduled in VLAN20 nodeSelector: - dedicated: monitoring + node-role.kubernetes.io/control-plane: '' tolerations: - - key: dedicated + - key: node-role.kubernetes.io/control-plane operator: Equal - value: monitoring + value: '' effect: NoSchedule topologySpreadConstraints: - maxSkew: 1 diff --git a/monitoring/mikrotik-exporter.yaml b/monitoring/mikrotik-exporter.yaml index 37e89bc..e79073f 100644 --- a/monitoring/mikrotik-exporter.yaml +++ b/monitoring/mikrotik-exporter.yaml @@ -85,12 +85,12 @@ spec: matchLabels: app: mikrotik-exporter nodeSelector: - dedicated: monitoring + node-role.kubernetes.io/control-plane: '' tolerations: - - key: dedicated - operator: Equal - value: monitoring - effect: NoSchedule + - key: node-role.kubernetes.io/control-plane + operator: Equal + value: '' + effect: NoSchedule affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: diff --git a/monitoring/ping-exporter.yaml b/monitoring/ping-exporter.yaml index cd11f91..a13a0cd 100644 --- a/monitoring/ping-exporter.yaml +++ b/monitoring/ping-exporter.yaml @@ -39,12 +39,12 @@ spec: - NET_ADMIN - NET_RAW nodeSelector: - dedicated: monitoring + node-role.kubernetes.io/control-plane: '' tolerations: - - key: dedicated - operator: Equal - value: monitoring - effect: NoSchedule + - key: node-role.kubernetes.io/control-plane + operator: Equal + value: '' + effect: NoSchedule topologySpreadConstraints: - maxSkew: 1 topologyKey: topology.kubernetes.io/zone diff --git a/monitoring/prometheus.yaml b/monitoring/prometheus.yaml index f623e42..aca37d9 100644 --- a/monitoring/prometheus.yaml +++ b/monitoring/prometheus.yaml @@ -24,11 +24,11 @@ spec: app.kubernetes.io/instance: prometheus app.kubernetes.io/name: prometheus nodeSelector: - dedicated: monitoring + node-role.kubernetes.io/control-plane: '' tolerations: - - key: dedicated + - key: node-role.kubernetes.io/control-plane operator: Equal - value: monitoring + value: '' effect: NoSchedule alerting: alertmanagers: diff --git a/monitoring/snmp-exporter.yaml b/monitoring/snmp-exporter.yaml index 8356ada..09fedda 100644 --- a/monitoring/snmp-exporter.yaml +++ b/monitoring/snmp-exporter.yaml @@ -39,12 +39,12 @@ spec: configMap: name: snmp-exporter nodeSelector: - dedicated: monitoring + node-role.kubernetes.io/control-plane: '' tolerations: - - key: dedicated - operator: Equal - value: monitoring - effect: NoSchedule + - key: node-role.kubernetes.io/control-plane + operator: Equal + value: '' + effect: NoSchedule topologySpreadConstraints: - maxSkew: 1 topologyKey: topology.kubernetes.io/zone