From 2d7fec1cdfbf3ffd0e401197cf2a941cd56dedf9 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Wed, 26 Jun 2024 18:23:15 -0500 Subject: [PATCH] v-m: vmstorage: Add pod anti-affinity One of the reasons for moving to 4 `vmstorage` replicas was to ensure that the load was spread evenly between the physical VM host machines. To ensure that is the case as much as possible, we need to keep one pod per Kubernetes node. --- victoria-metrics/vmstorage.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/victoria-metrics/vmstorage.yaml b/victoria-metrics/vmstorage.yaml index 216f1a6..1f1a7da 100644 --- a/victoria-metrics/vmstorage.yaml +++ b/victoria-metrics/vmstorage.yaml @@ -36,6 +36,18 @@ spec: app.kubernetes.io/name: vmstorage app.kubernetes.io/component: vmstorage spec: + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: In + values: + - vmstorage + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: vmstorage image: docker.io/victoriametrics/vmstorage:v1.96.0-cluster