OpenShift / OKD Specify URL for each Pod Replica
If your application also runs in OpenShift, run oc get svc
to find names of each broker. Note these names are only accessible inside OpenShift cluster.
For example, if oc get svc
returns:
> oc get svcNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEmy-cluster-kafka-0 ClusterIP 172.30.210.241 <none> 9094/TCP 109dmy-cluster-kafka-1 ClusterIP 172.30.39.25 <none> 9094/TCP 109dmy-cluster-kafka-2 ClusterIP 172.30.93.193 <none> 9094/TCP 109d
, you can access kafka-0
by my-cluster-kafka-0
or my-cluster-kafka-0.<pod_namespace>.svc.cluster.local
If your application runs outsides OpenShift, please configure strimzi external listeners. Among the three options to setup external listeners, NodePort
may be easier if you run on-premise OKD.
If you have a statefulset
with a headless
service, then you can access each pod with $(podname).$(service name).$(namespace).svc
read more about stable network id
here