I have a Kafka stateful sets with 3 replicas: I am using the kafka helm chart available here and the confluentinc/Kafka 5.3.1 image. I am using annotation to make sure each run on a different node. I want to open the same external port on each pods. Currently the helm charts open ports 9092 internal and (31090 + the replica number) as external. I am using affinity to make sure that the pods are deployed on different hosts. I am also using an ingress to connect to a load balancer on AWS. How can I have the same external port number on each Kafka pods that are running on the different nodes?
Thank you
The increasing NodePort number is by design according to the Helm chart. You can see the definition for incrementing the port number starting from the firstListenerPort
defined in your Helm chart (default 31090) in this file line 9:
{{- $externalListenerPort := add $root.Values.external.firstListenerPort $i }}
You can fork the Helm chart, and then modify templates/service-brokers-external.yaml
to replace references of $externalListenerPort
with $firstListenerPort
. In your Helm chart values definition, you can change the common NodePort number by modifying the external.firstListenerPort
.