Skip to content

Latest commit

 

History

History
162 lines (124 loc) · 5.83 KB

README.md

File metadata and controls

162 lines (124 loc) · 5.83 KB

Kafka for Kubernetes

Special thanks to @Yoolean

This repository seeks to provide:

  • Production-worthy Kafka setup for reproducing error and loading test
  • End-to-End monitoring system for Kafka

Quick Start

Install all monitoring tools and kafka cluster at once

./install-all.sh

Uninstall all at once

./uninstall-all.sh

Getting started

Only tested in Amazon Linux2 EC2

  • Recommend t2.xlarge (4CPU, 16GB) at least.
  • minikube recommend t2.medium but too many pods and load only to use t2.medium.
git clone https://github.com/joyfulbean/myset
cd myset
./joyful_shell.sh
./updaterc.sh

From now, kubectl is shortened to kp

# install minikube
git clone https://github.com/joyfulbean/myset
cd myset
./minikubeset.sh

# start minikube
sudo su - 
minikube start --driver=none --kubernetes-version=v1.23.0 --force

# start minikube dashboard
kubectl proxy --address='0.0.0.0' --disable-filter=true &
minikube dashboard --url

Minikube Dashboar URL: http://ec2-ip:8001/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/

Due to Recent issue related to minikube, must put version info.

Start Kafka Clusters

git clone https://github.com/joyfulbean/kube-kafka-monitoring.git
cd kube-kafka-monitoring
kubectl apply -k rbac-namespace-default
kubectl apply -k zookeeper/
kubectl apply -k kafka/

Want to start each file? Use apply -f and change kustomization to add new file in the directory

  • ./rbac-namespace-default
    • create namespace kafka and monitoring and create cluster roles
  • ./zookeeper
    • use persistent volume for zookeeper. change zookeeper.properties in zoo-config.yml and the number of zookeeper in pzoo.yml
  • ./kafka
    • change broker.properties in broker-config.yml and the number of kafka in kafka.yml

Out of Cluster access is possible through broker-outside-svc

  • Zookeeper outside access is not allowed in this repo. You need to create.

  • Zookeeper inside access is available. Use zookeeper:2181

  • Kafka outside access is available. Use (ec2-public-ip:32400), (ec2-public-ip:32401),,,, and so on

  • Kafka Internal access is available. Use bootstrap.kafka:9092

Monitoring

kubectl apply -k cmak 
kubectl apply -k linkedin-burrow/
kubectl apply -k prometheus-exporter 
kubectl apply -k prometheus/
kubectl --namespace kafka patch statefulset kafka --patch "$(cat prometheus-exporter/jmx-exporter/kafka-jmx-exporter-patch.yml )"
kubectl apply -k grafana/

Jmeter For Load Test

Successed: Pub using local computer jmeter to EC2, Consume using local computer to EC2

Failed: Sub using local computer jmeter to EC2.

Kafka Inside Cluster Pub-Sub using pod

kubectl -k pub-sub

It creates topic and can simply test pub-sub to check whether internal kafka communication works.

Jenkins

Kafka Cluster usding Kops

Version

  • Kafka
  • Kubernetes : latest
  • Jmeter