Created
September 17, 2019 12:28
-
-
Save matzew/16cede246a7697279d8236f0ee2729fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# Turn colors in this script off by setting the NO_COLOR variable in your | |
# environment to any value: | |
# | |
# $ NO_COLOR=1 test.sh | |
NO_COLOR=${NO_COLOR:-""} | |
if [ -z "$NO_COLOR" ]; then | |
header=$'\e[1;33m' | |
reset=$'\e[0m' | |
else | |
header='' | |
reset='' | |
fi | |
strimzi_version=`curl https://github.com/strimzi/strimzi-kafka-operator/releases/latest | awk -F 'tag/' '{print $2}' | awk -F '"' '{print $1}' 2>/dev/null` | |
kube_version="v1.13.4" | |
MEMORY="$(minikube config view | awk '/memory/ { print $3 }')" | |
CPUS="$(minikube config view | awk '/cpus/ { print $3 }')" | |
DISKSIZE="$(minikube config view | awk '/disk-size/ { print $3 }')" | |
DRIVER="$(minikube config view | awk '/vm-driver/ { print $3 }')" | |
function header_text { | |
echo "$header$*$reset" | |
} | |
header_text "Starting Knative on minikube!" | |
header_text "Using Kubernetes Version: ${kube_version}" | |
header_text "Using Strimzi Version: ${strimzi_version}" | |
minikube start --memory="${MEMORY:-12288}" --cpus="${CPUS:-8}" --kubernetes-version="${kube_version}" --vm-driver="${DRIVER:-kvm2}" --disk-size="${DISKSIZE:-30g}" --extra-config=apiserver.enable-admission-plugins="LimitRanger,NamespaceExists,NamespaceLifecycle,ResourceQuota,ServiceAccount,DefaultStorageClass,MutatingAdmissionWebhook" | |
header_text "Waiting for core k8s services to initialize" | |
sleep 5; while echo && kubectl get pods -n kube-system | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done | |
header_text "Strimzi install" | |
kubectl create namespace kafka | |
curl -L "https://github.com/strimzi/strimzi-kafka-operator/releases/download/${strimzi_version}/strimzi-cluster-operator-${strimzi_version}.yaml" \ | |
| sed 's/namespace: .*/namespace: kafka/' \ | |
| kubectl -n kafka apply -f - | |
header_text "Applying Strimzi Cluster file" | |
#kubectl -n kafka apply -f "https://raw.githubusercontent.com/strimzi/strimzi-kafka-operator/${strimzi_version}/examples/kafka/kafka-persistent-single.yaml" | |
# use one with kafka exposed via nodeport: | |
kubectl -n kafka apply -f "https://gist.githubusercontent.com/matzew/4b283a2aadcd5c438461cc34fce3f067/raw/002a492f20e5738f311d68d3f8ef46a6d90b530e/exposed_strimzi.yaml" | |
header_text "Waiting for Strimzi to become ready" | |
sleep 5; while echo && kubectl get pods -n kafka | grep -v -E "(Running|Completed|STATUS)"; do sleep 5; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IP:
minikube ip
PORT:
k get service my-cluster-kafka-external-bootstrap -o=jsonpath='{.spec.ports[0].nodePort}{"\n"}' -n kafka
Connection
E.g. using
kafkacat
:kafkacat -P -b IP:PORT -t my-topic
kafkacat -C -b IP:PORT -t my-topic