Add Kafka Topics#

To add Kafka topics, create a new KafkaTopic resource within the kafka/overlays/smaug/topics sub directory.

Replace my-topic with a preferred name.

# my-topic.yaml
kind: KafkaTopic
  name: my-topic
  labels: odh-message-bus
  partitions: 2
  replicas: 3
    # message retention period is 6 hours 21600000

The label should have the value odh-message-bus. On MOC the recommended partition size is 2 and replica count is 3. The replica count should be less than or equal to the number of Kafka brokers. On MOC smaug cluster we have 3 brokers.

Pick a suitable name, ensure that it’s unique in the topics folder.

Save this file under kafka/overlays/smaug/my-topic.yaml.

Then add it to kafka/overlays/smaug/kustomization.yaml by running the following:

$ cd kafka/overlays/smaug/topics
$ kustomize edit add resource my-topic.yaml

If you don’t have kustomize then simply add this file manually.