Troubleshoot Knative Eventing with Kafka: Useful Commands
Debug Knative Eventing with Kafka using kn and kubectl commands. Inspect services, revisions, triggers, Kafka sources, and event delivery.
Useful commands
-
Display list of knative services
kn services list -
Display config for specific service
kn service describe --verbose <SERVICE_NAME> -
List all revisions
kn revisions list -
Display triggers
kn triggers list kubectl get triggers -
Display kafka sources
kubectl get kafkasource -
Run Kafka Producer container
kubectl -n kafka run kafka-producer -ti --image=strimzi/kafka:0.14.0-kafka-2.3.0 --rm=true --restart=Never -- bash -
List kafka topics
bin/kafka-topics.sh --bootstrap-server <BOOTSTRAP_SERVER_HOST> --list -
List messages produced to a specific topic
bin/kafka-console-consumer.sh --bootstrap-server <BOOTSTRAP_SERVER_HOST> --topic <TOPIC_NAME> --from-beginning -
List messages from knative broker topic
bin/kafka-console-consumer.sh --bootstrap-server <BOOTSTRAP_SERVER_HOST> --topic knative-broker-default-default --from-beginning -
List all consumer groups in Kafka
bin/kafka-consumer-groups.sh --list --bootstrap-server <BOOTSTRAP_SERVER_HOST> -
Display all consumer groups with details
bin/kafka-consumer-groups.sh --describe --all-groups --bootstrap-server <BOOTSTRAP_SERVER_HOST> -
List offset with lag for each knative topic
bin/kafka-consumer-groups.sh --describe --group knative-group --bootstrap-server <BOOTSTRAP_SERVER_HOST> -
Count the lag of the offset from previous group command
bin/kafka-consumer-groups.sh --describe --group knative-group --bootstrap-server <BOOTSTRAP_SERVER_HOST> | awk 'NR>1 {sum += $6} END {print sum}'
Debugging flow
-
Check if your source topic is working:
- Run kafka-producer (6)
- Produce kafka message to the source topic
- Check if message arrived to the topic (8)
-
Check if the Trigger is properly connected/filtered
- Check status of triggers (4)
- Check filter defined in yaml file and check headers in the consumer service if it is matching the query
-
Check if your events are copied into broker topic
- Run kafka-producer (6)
- Produce kafka message to the source topic
- Check if message arrived to the topic (8) - if default topic name is used, the name is:
knative-broker-default-default
-
Check if pods in
knative-eventingnamespace do not raise errors e.g.kafka-broker-dispatcher