Get started with OpenShift Streams for Apache Kafka

Red Hat OpenShift Streams for Apache Kafka is a managed cloud service for architects and developers working on event-driven applications. It provides hosted and managed, high-availability Kafka clusters on-demand, so you can focus on developing your applications while Red Hat takes care of the infrastructure.  In this learning path you’ll sign up for a free Red Hat account, provision a managed Kafka instance, and connect to it using service account credentials via SSL.

Note: The following steps require the use of commands in a terminal. These commands will work in macOS and Linux. Windows users can use Windows Subsystem for Linux (WSL) to obtain a Linux-compatible environment on their system.

You’ll be using kcat, a command-line tool, to connect to your Kafka instance. The kcat command-line interface (CLI) allows you to produce or consume messages, and list metadata for the Kafka cluster without having to write custom code. Download and install kcat using the appropriate option for your system, following the kcat installation guide.

To connect to your Kafka instance using kcat, you will need a client ID, client secret, and bootstrap server URL. Along with the credentials (client ID and secret), you will need the URL for the Kafka instance you want to connect to—that is the bootstrap server URL. You already recorded the client ID and secret when you created the service account. You can obtain the bootstrap server URL as follows:

  1. Navigate to the Kafka Instances page.
  2. Click on the Options icon (three dots) on the right-hand side of your listed Kafka instance, and select Connection.
  3. Copy the Bootstrap Server URL field (Figure 13).
    Figure 13: The bootstrap server URL is available on the Connection details panel of the Kafka Instances screen.
    Figure 13: The bootstrap server URL is available on the Connection details panel Kafka Instances screen.
  4. Store the bootstrap URL in the same location as your client ID and client secret.
  5. Run the following kcat command to list metadata for your Kafka instance. Replace the variables with the correct values. For instance, $BOOTSTRAP_URL should be replaced with the bootstrap server URL you copied from the dashboard:
$ kcat -b $BOOTSTRAP_SERVER -X security.protocol=SASL_SSL -X 
sasl.mechanisms=PLAIN -X sasl.username="$CLIENT_ID" -X 
sasl.password="$CLIENT_SECRET" -L

If you see text output similar to the following sample, you’ve successfully completed this learning path:

Metadata for all topics (from broker -1: sasl_ssl://
 3 brokers:
  broker 0 at
  broker 2 at
  broker 1 at (controller)
 0 topics:
Previous resource
Create a service account
Next resource
Topics and partitions recap