GithubHelp home page GithubHelp logo

thaisroch / kafka-on-kubernetes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amarendrasingh88/kafka-on-kubernetes

0.0 0.0 0.0 198 KB

This repository describes the steps and resources to deploy Kafka on Kubernetes using Strimzi.

License: Apache License 2.0

kafka-on-kubernetes's Introduction

kafka-on-kubernetes

This repository describes the steps and resources to deploy Kafka on Kubernetes using Strimzi.

Demo-1: We will deploy the Strimzi operator and then the Kafka cluster resources.(Use resources from kafka-demo/demo1-strimzi-setup path)

1- Starting Minikube:
minikube start --memory=4096

2- Create Kafka namespace:
kubectl create namespace kafka

3- Deploy Strimzi Operator (including ClusterRole, ClusterRoleBinding and CRDs):

kubectl create -f 'https://strimzi.io/install/latest?namespace=kafka' -n kafka

4- Now we can add a Kafka custom resource to deploy a Kafka Cluster:
kubectl apply -f kafka.yaml -n kafka

5- Wait for the Kafka, Zookeeper and other optional resources to be ready

6- Create a Topic:
kubectl apply -f kafka-topic.yaml -n kafka

7- Run Producer
kubectl -n kafka run kafka-producer -ti --image=quay.io/strimzi/kafka:0.28.0-kafka-3.1.0 --rm=true --restart=Never -- bin/kafka-console-producer.sh --bootstrap-server kafka-kafka-bootstrap:9092 --topic my-topic

8- Run Consumer
kubectl -n kafka run kafka-consumer -ti --image=quay.io/strimzi/kafka:0.28.0-kafka-3.1.0 --rm=true --restart=Never -- bin/kafka-console-consumer.sh --bootstrap-server kafka-kafka-bootstrap:9092 --topic my-topic --from-beginning

Demo-2: We will deploy the keda operator and use it to auto-scale the kafka consumers in case of loadUse resources from kafka-demo/demo2-auto-scaling-using-keda path)

1- Create keda namespace: kubectl create namespace keda

2- Deploy keda operator:

a. helm repo add kedacore https://kedacore.github.io/charts
b. helm repo update
c. helm install keda kedacore/keda --namespace keda

3- Deploy Consumer application:

a. kubectl apply -f consumer-service.yml -n keda
b. kubectl apply -f consumer-deployment.yml -n keda

4- Deploy Keda scaled object:
kubectl apply -f keda.yaml -n keda

5- Run Kafka Producer:
kubectl -n kafka run kafka-producer -ti --image=quay.io/strimzi/kafka:0.28.0-kafka-3.1.0 --rm=true --restart=Never -- bin/kafka-console-producer.sh --bootstrap-server kafka-kafka-bootstrap:9092 --topic my-topic

6- Produce some messages and see if the consumer pods are getting scaled

Demo-3: This demo is to show the Kafka cluster monitoring using Prometheus and GrafanaUse resources from kafka-demo/demo-3 monitoring path)

1- Create monitoring namespace:

kubectl create namespace monitoring

2- Deploy Prometheus operator:

kubectl apply -f prometheus-operator-deployment.yaml -n monitoring --force-conflicts=true --server-side

3- Create configmap for jmx metrics:

kubectl apply -f kafka-metrics-config.yaml -n monitoring
kubectl apply -f zookeeper-metrics.yaml -n monitoring

4- Update the Kafka resource with jmxPrometheusExporter to scrape the jmx metrics and kafkaExporter for exporting the topic and consumer lag metrics

kubectl apply -f kafka.yaml -n kafka

5- Deploy Prometheus -

kubectl apply -f prometheus.yaml -n monitoring

6- Deploy pod monitor-

kubectl apply -f strimzi-pod-monitor.yaml -n monitoring

7- Deploy Grafana -

kubectl apply -f grafana.yaml -n monitoring

8- Port forward for Prometheus and Grafana-

kubectl port-forward svc/grafana 3000:3000 -n monitoring
kubectl port-forward svc/prometheus-operated 9090:9090 -n monitoring

9- Add Prometheus datasource in Grafana 10 Upload grafana dashboards from- https://github.com/strimzi/strimzi-kafka-operator/tree/0.28.0/examples/metrics/grafana-dashboards

kafka-on-kubernetes's People

Contributors

amarendrasingh88 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.