kn-plugin-source-kafka
is a plugin of Knative Client, for management of kafka event
source interactively from the command line.
kn-plugin-source-kafka
is a plugin of Knative Client. You can create, describe and
delete kafka event sources. Go to
Knative Eventing document
to understand more about kafka event sources.
You must
set up your development environment
before you build kn-plugin-source-kafka
.
Building:
Once you've set up your development environment, let's build kn-plugin-source-kafka
.
Run below command under the root directory of this repository.
$ hack/build.sh
Installing:
You will get an executable file kn-plugin-source-kafka
under the directory of
client-contrib/plugins/source-kafka
after you run the build command. Then
let's install it to become a Knative Client kn
plugin.
Install the plugin by simply copying the executable file kn-plugin-source-kafka
to
the folder of the kn
plugins directory. You will be able to invoke it by
kn source kafka
.
Knative eventing kafka source plugin
Manage Knative kafka eventing sources
-h, --help help for kafka
- kafka create - Create a kafka source
- kafka delete - Delete a kafka source
- kafka describe - Describe a kafka source
- kafka list - List kafka sources
Create a kafka source
kafka create NAME --servers SERVERS --topics TOPICS --consumergroup GROUP --sink SINK [flags]
# Create a new kafka source 'mykafkasrc' which subscribes a kafka server 'my-cluster-kafka-bootstrap.kafka.svc:9092' at topic 'test-topic' using the consumer group ID 'test-consumer-group' and sends the events to service 'event-display'
kn source kafka create mykafkasrc --servers my-cluster-kafka-bootstrap.kafka.svc:9092 --topics test-topic --consumergroup test-consumer-group --sink svc:event-display
-A, --all-namespaces If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.
--consumergroup string the consumer group ID
-h, --help help for create
-n, --namespace string Specify the namespace to operate in.
--servers stringArray Kafka bootstrap servers that the consumer will connect to, consist of a hostname plus a port pair, e.g. my-kafka-bootstrap.kafka:9092. Flag can be used multiple times.
-s, --sink string Addressable sink for events. You can specify a broker, channel, Knative service or URI. Examples: '--sink broker:nest' for a broker 'nest', '--sink channel:pipe' for a channel 'pipe', '--sink https://event.receiver.uri' for an URI with an 'http://' or 'https://' schema, '--sink ksvc:receiver' or simply '--sink receiver' for a Knative service 'receiver'. If a prefix is not provided, it is considered as a Knative service.
--topics stringArray Topics to consume messages from. Flag can be used multiple times.
- kafka - Knative eventing kafka source plugin
Delete a kafka source
kafka delete NAME [flags]
# Delete a kafka source with name 'mykafkasrc'
kn source kafka delete mykafkasrc
-A, --all-namespaces If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.
-h, --help help for delete
-n, --namespace string Specify the namespace to operate in.
- kafka - Knative eventing kafka source plugin
Describe a kafka source
kafka describe NAME [flags]
# Describe a kafka source with NAME
kn source kafka describe kafka-name
-A, --all-namespaces If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.
-h, --help help for describe
-n, --namespace string Specify the namespace to operate in.
- kafka - Knative eventing kafka source plugin
List kafka sources
kafka list [flags]
# List the available kafka sources
kn source kafka list
-A, --all-namespaces If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.
-h, --help help for list
-n, --namespace string Specify the namespace to operate in.
- kafka - Knative eventing kafka source plugin