Skip to content

Instantly share code, notes, and snippets.

@cheshirecode
Last active August 16, 2018 06:34
Show Gist options
  • Save cheshirecode/8e9932a9165e4a2df6e990026db8fd99 to your computer and use it in GitHub Desktop.
Save cheshirecode/8e9932a9165e4a2df6e990026db8fd99 to your computer and use it in GitHub Desktop.
minikube + Helm
#!/usr/bin/env bash
kubectl apply -f cp-helm-charts/examples/kafka-client.yaml
kubectl exec -it kafka-client -- /bin/bash
## Setup
export RELEASE_NAME=my-confluent-oss
export ZOOKEEPERS=${RELEASE_NAME}-cp-zookeeper:2181
export KAFKAS=${RELEASE_NAME}-cp-kafka-headless:9092
## Create Topic
kafka-topics --zookeeper $ZOOKEEPERS --create --topic test-rep-one --partitions 6 --replication-factor 1
## Producer
kafka-run-class org.apache.kafka.tools.ProducerPerformance --print-metrics --topic test-rep-one --num-records 6000000 --throughput 100000 --record-size 100 --producer-props bootstrap.servers=$KAFKAS buffer.memory=67108864 batch.size=8196
## Consumer
kafka-consumer-perf-test --broker-list $KAFKAS --messages 6000000 --threads 1 --topic test-rep-one --print-metrics
#!/usr/bin/env bash
#list topics
docker-compose exec broker kafka-topics --list --zookeeper zookeeper:2181
# use kafkacat to fetch topic
kafkacat -b localhost:29092 -t users
# list Kafka topic
kafka-topics --zookeeper zookeeper:2181 --list
# create messages (https://docs.confluent.io/current/kafka-rest/docs/intro.html)
# check messages under Avro-schema
kafka-avro-console-consumer \
--bootstrap-server broker:9092 \
--property schema.registry.url=http://schema-registry:8081 \
--property print.key=true \
--from-beginning \
--topic users
#!/usr/bin/env bash
#Mac-only
brew install --HEAD xhyve
brew install docker-machine-driver-xhyve kubernetes-helm
sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
#Other Linux for xhyve
#hyperkit
curl -Lo docker-machine-driver-hyperkit https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-hyperkit \
&& chmod +x docker-machine-driver-hyperkit \
&& sudo cp docker-machine-driver-hyperkit /usr/local/bin/ \
&& rm docker-machine-driver-hyperkit \
&& sudo chown root:wheel /usr/local/bin/docker-machine-driver-hyperkit \
&& sudo chmod u+s /usr/local/bin/docker-machine-driver-hyperkit
#starting minikube
minikube start --cpus 4 --memory 6096 --vm-driver=hyperkit --v=8
minikube ssh -- sudo ip link set docker0 promisc on
eval $(minikube docker-env)
kubectl config set-context minikube.internal --cluster=minikube --user=minikube
kubectl config use-context minikube.internal
#Helm
helm init
helm repo update
helm list
#check that all pods are running
kubectl get po --all-namespaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment