LoadBalancer-based networking provider plugin for Strimzi Kafka stretch clusters deployed across multiple Kubernetes clusters.
This plugin enables cross-cluster Kafka communication by:
- Creating LoadBalancer Services - Creates a dedicated LoadBalancer service for each Kafka broker pod
- Waiting for IP Assignment - Waits for cloud provider to assign external IP/hostname (with exponential backoff retry, up to 5 minutes)
- Discovering Endpoints - Extracts the assigned LoadBalancer IP/hostname and port
- Generating Configurations - Automatically generates
advertised.listenersandcontroller.quorum.votersconfigurations for Kafka brokers
Example Output:
- Service:
my-cluster-kafka-0-lbwith external IP10.21.50.10 - Advertised Listener:
REPLICATION-9091://10.21.50.10:9091 - Controller Quorum Voter:
0@10.21.50.10:9091
For each broker pod, the plugin creates a LoadBalancer service:
apiVersion: v1
kind: Service
metadata:
name: my-cluster-kafka-0-lb
spec:
type: LoadBalancer
selector:
statefulset.kubernetes.io/pod-name: my-cluster-kafka-0
ports:
- name: tcp-replication
port: 9091
- name: tcp-plain
port: 9092The plugin waits for the cloud provider/LoadBalancer controller to assign an external IP:
- Retry Logic: Exponential backoff (10s → 20s → 30s...)
- Maximum Wait: 5 minutes per broker
- Cloud Provider Dependent: AWS ELB/NLB, GCP LB, Azure LB, MetalLB, etc.
Once the IP is assigned, the plugin extracts it from service.status.loadBalancer.ingress[0]:
- IP address:
10.21.50.10 - Or hostname:
a1b2c3-123.us-west-2.elb.amazonaws.com
LoadBalancer Support Required:
- Cloud: AWS ELB/NLB, GCP Load Balancer, Azure Load Balancer
- On-Premises: MetalLB, Cilium BGP, or similar LoadBalancer controller
- Network: Connectivity between all cluster LoadBalancer IPs
Use the automated build script:
./build-plugin.shThis script will:
- Build and install Strimzi cluster-operator to local Maven repository
- Build the LoadBalancer plugin JAR
- Verify the JAR contents
- Show next deployment steps
If you prefer to build manually:
# First, build and install the Strimzi cluster-operator
cd ../strimzi-kafka-operator
mvn clean install -pl cluster-operator -am -DskipTests -Dcheckstyle.skip=true
# Then build the plugin
cd ../strimzi-stretch-loadbalancer-plugin
mvn clean packageThis produces: target/strimzi-stretch-loadbalancer-plugin-0.48.0.jar
Mount the plugin JAR into the Strimzi operator:
apiVersion: apps/v1
kind: Deployment
metadata:
name: strimzi-cluster-operator
spec:
template:
spec:
containers:
- name: strimzi-cluster-operator
volumeMounts:
- name: stretch-plugins
mountPath: /opt/strimzi/plugins
volumes:
- name: stretch-plugins
hostPath:
path: /opt/strimzi/plugins # Copy JAR here on operator nodeEnable the plugin by setting these environment variables in the operator deployment:
env:
- name: STRIMZI_STRETCH_PLUGIN_CLASS_NAME
value: io.strimzi.plugin.stretch.LoadBalancerNetworkingProvider
- name: STRIMZI_STRETCH_PLUGIN_CLASS_PATH
value: /opt/strimzi/plugins/*LoadBalancer Controller:
- Ensure LoadBalancer controller is running (cloud provider controller or MetalLB)
- Configure appropriate IP address pools
For MetalLB (on-premises example):
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: kafka-pool
namespace: metallb-system
spec:
addresses:
- 10.21.50.10-10.21.50.50Firewall:
- Allow traffic on Kafka ports (9090, 9091, 9092, etc.)
- LoadBalancer IPs must be routable between clusters
Symptom: Timeout after ~5 minutes waiting for LoadBalancer IP
Solutions:
- Check cloud provider LoadBalancer quota/limits
- Verify LoadBalancer controller is running:
kubectl get pods -n metallb-system(for MetalLB) - Check service events:
kubectl describe svc my-cluster-kafka-0-lb - Verify IPAddressPool configuration (for MetalLB)
This is normal. LoadBalancer IP assignment can take 2-5 minutes per broker depending on the cloud provider. The plugin uses exponential backoff and waits up to 5 minutes per broker.
Apache License 2.0
- Plugin Version: 0.48.0
- Compatible with: Strimzi 0.48.0+
- Requires: Kubernetes 1.25+ with LoadBalancer support