1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 06:46:26 +01:00
Files
openshift-docs/modules/serverless-kafka-source-yaml.adoc
2020-11-18 14:52:16 +00:00

62 lines
1.5 KiB
Plaintext

// Module included in the following assemblies:
//
// * serverless/event_sources/serverless-kafka-source.adoc
[id="serverless-kafka-source-yaml_{context}"]
= Creating a Kafka event source by using YAML
You can create a Kafka event source by using YAML.
.Prerequisites
* The {ServerlessOperatorName}, Knative Eventing, and the `KnativeKafka` custom resource are installed on your cluster.
* You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in {product-title}.
.Procedure
. Create a YAML file containing the following:
+
[source,yaml]
----
apiVersion: sources.knative.dev/v1beta1
kind: KafkaSource
metadata:
name: <source-name>
spec:
consumerGroup: <group-name> <1>
bootstrapServers:
- <list-of-bootstrap-servers>
topics:
- <list-of-topics> <2>
sink:
----
<1> A consumer group is a group of consumers that use the same group ID, and consume data from a topic.
<2> A topic provides a destination for the storage of data. Each topic is split into one or more partitions.
+
.Example `KafkaSource` object
[source,yaml]
----
apiVersion: sources.knative.dev/v1beta1
kind: KafkaSource
metadata:
name: kafka-source
spec:
consumerGroup: knative-group
bootstrapServers:
- my-cluster-kafka-bootstrap.kafka:9092
topics:
- knative-demo-topic
sink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: event-display
----
. Apply the YAML file:
+
[source,terminal]
----
$ oc apply -f <filename>
----