aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Geissler <andreas-geissler@telekom.de>2023-11-17 11:35:18 +0100
committerAndreas Geissler <andreas-geissler@telekom.de>2023-11-17 13:52:19 +0100
commit64f95b155fd2101d3e60872bf2d650954de8a6fa (patch)
treebbc1c878d745f618de2e474444ec8ce31e007601
parent60f33d7fa1d42a7d75df330852cd35d2cd316f10 (diff)
[STRIMZI] Add podAntiAffinity to kafka deployment
Add the configuration to add podAntiAffinity rules for Kafka and zookeeper pods to distribute the pods over multiple worker nodes Issue-ID: OOM-3249 Change-Id: Icd2de1711f8bcad09bd49dac643164c83ae7f06e Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de>
-rw-r--r--kubernetes/strimzi/templates/strimzi-kafka.yaml24
-rw-r--r--kubernetes/strimzi/values.yaml3
2 files changed, 27 insertions, 0 deletions
diff --git a/kubernetes/strimzi/templates/strimzi-kafka.yaml b/kubernetes/strimzi/templates/strimzi-kafka.yaml
index 4071aa03a6..a808b84441 100644
--- a/kubernetes/strimzi/templates/strimzi-kafka.yaml
+++ b/kubernetes/strimzi/templates/strimzi-kafka.yaml
@@ -72,6 +72,18 @@ spec:
securityContext:
runAsUser: 0
fsGroup: 0
+ {{- if .Values.affinity.podAntiAffinity.enabled }}
+ affinity:
+ podAntiAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ - labelSelector:
+ matchExpressions:
+ - key: strimzi.io/name
+ operator: In
+ values:
+ - {{ include "common.fullname" . }}-kafka
+ topologyKey: "kubernetes.io/hostname"
+ {{- end }}
config:
default.replication.factor: {{ .Values.replicaCount }}
min.insync.replicas: {{ (eq 1.0 (.Values.replicaCount)) | ternary 1 (sub .Values.replicaCount 1) }}
@@ -104,6 +116,18 @@ spec:
securityContext:
runAsUser: 0
fsGroup: 0
+ {{- if .Values.affinity.podAntiAffinity.enabled }}
+ affinity:
+ podAntiAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ - labelSelector:
+ matchExpressions:
+ - key: strimzi.io/name
+ operator: In
+ values:
+ - {{ include "common.fullname" . }}-zookeeper
+ topologyKey: "kubernetes.io/hostname"
+ {{- end }}
replicas: {{ .Values.replicaCount }}
config:
ssl.hostnameVerification: false
diff --git a/kubernetes/strimzi/values.yaml b/kubernetes/strimzi/values.yaml
index bb22de7ebd..a9eed5d8b9 100644
--- a/kubernetes/strimzi/values.yaml
+++ b/kubernetes/strimzi/values.yaml
@@ -29,6 +29,9 @@ global:
# Application configuration defaults.
#################################################################
replicaCount: 3
+affinity:
+ podAntiAffinity:
+ enabled: true
config:
kafkaVersion: 3.4.0
authType: simple