I created two applications wurstmeister/kafka
and zookeeper
as shown below.
oc new-app wurstmeister/kafka
oc new-app zookeeper
While I can see the zookeeper
service in my project, I do not see the Kafka service. How do I get my others pods connect to Kafka? Through the pod IP address? But, isn't service
the way for the pods to connect with each other?
Why wasn't the service for Kafka created automatically?
It's related to the fact that while the Zookeeper Dockerfile contains an EXPOSE line exposing the ports, there is no such a line in the Kafka Dockerfile which is actually not exposing the default 9092 port for example. The new-app command exposes the declared ports through a service only in case you are actually exposing ports via EXPOSE.
Because you are trying to deploy Kafka on OpenShift, I suggest to take a look at the Strimzi project (https://strimzi.io/), it will make your life easier. It provides a cluster operator to install in the OpenShift cluster and then describing a Kafka cluster through a Kafka resource; the operator will deploy the cluster for you.