I am running a KOPS Kubernetes cluster on AWS, trying to make kubernetes-kafka example work with an Elastic Load Balancer. Here is the external services portion for two of the brokers:
kind: Service
apiVersion: v1
metadata:
name: outside-0
namespace: kafka
spec:
selector:
app: kafka
kafka-broker-id: "0"
ports:
- protocol: TCP
targetPort: 9094
port: 32400
nodePort: 32400
type: NodePort
---
kind: Service
apiVersion: v1
metadata:
name: outside-1
namespace: kafka
spec:
selector:
app: kafka
kafka-broker-id: "1"
ports:
- protocol: TCP
targetPort: 9094
port: 32401
nodePort: 32401
type: NodePort
Here is my attempt to expose those brokers via an ELB (actual FQDN replaced with my.copmany.com
).
apiVersion: v1
kind: Service
metadata:
name: kafka-0
annotations:
dns.alpha.kubernetes.io/external: kafka-0.kafka.my.company.com
spec:
type: LoadBalancer
ports:
- port: 32400
name: outside
targetPort: 32400
selector:
app: outside-0
---
apiVersion: v1
kind: Service
metadata:
name: kafka-1
annotations:
dns.alpha.kubernetes.io/external: kafka-1.kafka.my.company.com
spec:
type: LoadBalancer
ports:
- port: 32401
name: outside
targetPort: 32401
selector:
app: outside-1
Looking at AWS ELB console shows 0 of 3 instances available for each of the Kafka ELB brokers and producing to kafka-1.kafka.my.company.com:9094
using Kafka command line client times out. How can outside-0
NodePort service be exposed via kafka-0
LoadBalancer service? Or are there other approached to be considered?
ec2-host:port
and the second one useselb:port
. My challenge is each kafka broker needs to have it's own "permanent" URL likesubdomain-on-company-domain:port
, e.g.kafka-1.kafka.my.company.com:9094
. – SergeyB