Kafka Channel ConfigMap

NOTE: This guide assumes Knative Eventing is installed in the knative-eventing namespace. If you have installed Knative Eventing in a different namespace, replace knative-eventing with the name of that namespace.

To use Kafka channels, you must create a YAML file that specifies how these channels will be created.

NOTE: You must install the Kafka Channel first.

You can copy the following sample code into your kafka-channel ConfigMap:

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: kafka-channel
  5. namespace: knative-eventing
  6. data:
  7. channelTemplateSpec: |
  8. apiVersion: messaging.knative.dev/v1beta1
  9. kind: KafkaChannel
  10. spec:
  11. numPartitions: 3
  12. replicationFactor: 1

NOTE: This example specifies two extra parameters that are specific to Kafka Channels; numPartitions and replicationFactor.

To create a Broker that uses the KafkaChannel, specify the kafka-channel ConfigMap:

  1. kubectl create -f - <<EOF
  2. apiVersion: eventing.knative.dev/v1
  3. kind: Broker
  4. metadata:
  5. annotations:
  6. eventing.knative.dev/broker.class: MTChannelBasedBroker
  7. name: kafka-backed-broker
  8. namespace: default
  9. spec:
  10. config:
  11. apiVersion: v1
  12. kind: ConfigMap
  13. name: kafka-channel
  14. namespace: knative-eventing
  15. EOF

Feedback

Was this page helpful?

Glad to hear it! Please tell us how we can improve.

Sorry to hear that. Please tell us how we can improve.