From f1a20518382f4c8358911a3b0960b8d0de5a1797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 21 Aug 2024 07:11:06 +0300 Subject: [PATCH] monitoring: Move to topologySpreadConstraints --- monitoring/alertmanager.yaml | 8 ++++++++ monitoring/blackbox-exporter.yaml | 17 +++++++---------- monitoring/mikrotik-exporter.yaml | 7 +++++++ monitoring/ping-exporter.yaml | 17 +++++++---------- monitoring/prometheus.yaml | 8 ++++++++ monitoring/snmp-exporter.yaml | 17 +++++++---------- 6 files changed, 44 insertions(+), 30 deletions(-) diff --git a/monitoring/alertmanager.yaml b/monitoring/alertmanager.yaml index 3bb061b..d3b06ac 100644 --- a/monitoring/alertmanager.yaml +++ b/monitoring/alertmanager.yaml @@ -31,6 +31,14 @@ kind: Alertmanager metadata: name: alertmanager spec: + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: topology.kubernetes.io/zone + whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + app.kubernetes.io/instance: alertmanager + app.kubernetes.io/name: alertmanager alertmanagerConfigMatcherStrategy: type: None alertmanagerConfigNamespaceSelector: {} diff --git a/monitoring/blackbox-exporter.yaml b/monitoring/blackbox-exporter.yaml index 11c800e..7b40635 100644 --- a/monitoring/blackbox-exporter.yaml +++ b/monitoring/blackbox-exporter.yaml @@ -188,16 +188,13 @@ spec: operator: Equal value: monitoring effect: NoSchedule - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - blackbox-exporter - topologyKey: "kubernetes.io/hostname" + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: topology.kubernetes.io/zone + whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + app: blackbox-exporter --- kind: Service apiVersion: v1 diff --git a/monitoring/mikrotik-exporter.yaml b/monitoring/mikrotik-exporter.yaml index 4e51a36..37e89bc 100644 --- a/monitoring/mikrotik-exporter.yaml +++ b/monitoring/mikrotik-exporter.yaml @@ -77,6 +77,13 @@ spec: envFrom: - secretRef: name: mikrotik-exporter + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: topology.kubernetes.io/zone + whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + app: mikrotik-exporter nodeSelector: dedicated: monitoring tolerations: diff --git a/monitoring/ping-exporter.yaml b/monitoring/ping-exporter.yaml index 6856752..2c05eeb 100644 --- a/monitoring/ping-exporter.yaml +++ b/monitoring/ping-exporter.yaml @@ -45,16 +45,13 @@ spec: operator: Equal value: monitoring effect: NoSchedule - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - ping-exporter - topologyKey: "kubernetes.io/hostname" + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: topology.kubernetes.io/zone + whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + app: ping-exporter --- kind: Service apiVersion: v1 diff --git a/monitoring/prometheus.yaml b/monitoring/prometheus.yaml index a4d6cbf..f623e42 100644 --- a/monitoring/prometheus.yaml +++ b/monitoring/prometheus.yaml @@ -15,6 +15,14 @@ kind: Prometheus metadata: name: prometheus spec: + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: topology.kubernetes.io/zone + whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + app.kubernetes.io/instance: prometheus + app.kubernetes.io/name: prometheus nodeSelector: dedicated: monitoring tolerations: diff --git a/monitoring/snmp-exporter.yaml b/monitoring/snmp-exporter.yaml index dd221b0..117b532 100644 --- a/monitoring/snmp-exporter.yaml +++ b/monitoring/snmp-exporter.yaml @@ -45,16 +45,13 @@ spec: operator: Equal value: monitoring effect: NoSchedule - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - snmp-exporter - topologyKey: "kubernetes.io/hostname" + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: topology.kubernetes.io/zone + whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + app: snmp-exporter --- kind: Service apiVersion: v1