Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save luszczynski/01730873e08ca56443b1c654a89a7657 to your computer and use it in GitHub Desktop.
Save luszczynski/01730873e08ca56443b1c654a89a7657 to your computer and use it in GitHub Desktop.
Kafka on Kubernetes (Strimzi) Demo Script

Kafka on Kubernetes (Strimzi) Demonstration

Cluster Deployment

cd strimzi-0.6.0
oc crete -f examples/templates/cluster-operator/
oc create -f examples/install/cluster-operator/
oc new-app strimzi-ephemeral

Topics

oc create -f examples/topic/kafka-topic.yaml

Kafka Like

oc exec -it my-cluster-zookeeper-0 -- bin/kafka-topics.sh --zookeeper localhost:21810 --list
oc exec -it my-cluster-zookeeper-0 -- bin/kafka-topics.sh --zookeeper localhost:21810 --describe
oc exec -it my-cluster-zookeeper-0 -- bin/kafka-topics.sh --zookeeper localhost:21810 --create --topic created-in-kafka

Kubernetes Like

oc get kafka
oc create -f examples/topic/kafka-topic.yaml

Producing and Consuming Messages

oc run kafka-producer -ti --image=strimzi/kafka:0.6.0 --restart=Never \-- bin/kafka-console-producer.sh --broker-list my-cluster-kafka-bootstrap:9092 --topic my-topic
oc run kafka-consumer -ti --image=strimzi/kafka:0.6.0 --restart=Never \-- bin/kafka-console-consumer.sh --bootstrap-server my-cluster-kafka-bootstrap:9092 --topic my-topic --from-beginning

IoT Demo

oc create -f ./stream-app/resources/topics.yml
oc create -f ./stream-app/resources/stream-app.yml
oc get kafkaTopics
oc create -f ./consumer-app/resources/consumer-app.yml
oc create -f ./device-app/resources/device-app.yml

Event Sourcing

open http://analytic-ui-sko.apps.ramalho.openshiftworkshop.com/
oc rsh kafka-0
cd bin
./kafka-consumer-groups.sh --bootstrap-server kafka:9092 --group analyticgroup --reset-offsets --to-earliest --all-topics --execute
./kafka-consumer-groups.sh --bootstrap-server kafka:9092 --group analyticgroup --describe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment