Coder Social home page Coder Social logo

scripts-kafka's Introduction

1. Deploy the Strimzi Operator or find some another way to get a working Kafka cluster inside of your Kubernetes
https://screencast.com/t/mLucXD01sq

2. Create a Kafka cluster
kubectl create namespace franz
kubens franz
oc adm policy add-scc-to-user privileged -z default -n franz

kubectl create -f kubefiles/burr-cluster-no-metrics.yaml

3. Deploy the Kafka Channel CRD
curl -L "https://raw.githubusercontent.com/openshift/knative-eventing/release-v0.6.0/openshift/release/knative-eventing-kafka-v0.6.0.yaml" \
 | sed 's/REPLACE_WITH_CLUSTER_URL/burr-cluster-kafka-bootstrap.franz:9092/' \
 | kubectl apply --filename -

 This loads into knative-eventing

4. Deploy the Kafka Event source CRD
kubectl create namespace knative-sources
# kubectl apply -f https://raw.githubusercontent.com/openshift/knative-eventing-contrib/release-v0.6.0/openshift/release/knative-eventing-kafka-sources-v0.6.0.yaml
kubectl apply -f kubefiles/kafka-event-source.yaml

5. Deploy the specific Kafka Event Source
kubectl apply -f kubefiles/kafkasource2service.yaml

6. Deploy the consuming Knative service (indentified in the kafkasource2service.yaml)
cd quarkus-kafka-knative-consumer
kubectl apply -f knService_docker.yaml
and see that it is installed, no errors like RevisionMissing
kubectl get ksvc

if you need to change the code:
mvn clean package
./buildNativeLinux.sh
modify the dockerbuild.sh for your image coordinates (note: does not work for quay.io)
./dockerbuild.sh
modify dockerpush.sh for your image coordinates
./dockerpush.sh
then 
kubectl replace -f knService_docker.yaml

7.  Deploy a message producer
cd qkafkaproducer
kubectl apply -f Deployment.yaml

8. Watch the logs
stern qkafkaproducer
stern qkafka-knative-consumer

9. Remove the producer 
kubectl delete -f deployment/qkafkaproducer

10. Wait 90 seconds to 2 minutes and watch qkafka-knative-consumer autoscale to 0

11. kubectl get ksvc/qkafka-knative-consumer | awk 'NR==2{print $2}'
use URL value to curl
curl $(kubectl get ksvc/qkafka-knative-consumer | awk 'NR==2{print $2}')
This will autoscale up from 0

12. Deploy the CronJobSource - the code does not care which EventSource invokes it
kubectl create -f kubefiles/cronsource2service.yaml
It sends a message every 60 seconds
Keeping the qkafka-knative-consumer alive indenifitely 
(60 seconds is more frequent than the 90 second autoscale to 0)

Clean up:
13. Delete CronJobSource
kubectl delete cronjobsource/cronjobsource-aloha

14. Delete the Knative Service 
kubectl delete ksvc/qkafka-knative-consumer

You can also delete the KafkaEventSource as well as the Kafka Cluster 
but it might be easier to just delete the whole namespace

scripts-kafka's People

Contributors

burrsutter avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.