This project provides a local and an interactive docker container experience.
Please install the following programs:
Additionally, for setting up a local Kubernetes cluster, we recommend using minikube.
All necessary tools are pre-installed in the Docker container
Execute the following script to build the image and start the interactive Docker container:
./docker.sh
If a container already exists, the script will either start or attach to it.
For further information about the script use ./docker.sh --help
.
This will mount the project as well as the ~/.kube/config
file into the docker container and therefore the installation of kubectl is recommended to have a valid ~/.kube/config
file.
Edits outside of the docker container are reflected through the mount and vice versa. Additionally, the docker container has access to any cluster, that your system has access to.
- Start minikube
minikube start --memory 8192 --cpus 2
- DNS
Then create a DNS entry for minikube.
sudo -- sh -c -e "echo '$(minikube ip) minikube' >> /etc/hosts"
The following steps build the necessary files for the cluster and apply them.
-
Config
Please ensure all values in theconfig.json
file are up to date and match your needs, as these will be used in the following steps -
Kubernetes Operators
Install the necessary Kubernetes operators using Helm:
helm/build-helm.sh
- Resource Files
Generate the Kubernetes resource files:
./build-k8s.sh
- Build kafka resources.
kubectl apply -f build/kafka
Please wait after executing the command until all components are Ready. You can monitor them by running:
kubectl get pods -n kafka -w
To interact efficiently you can source the interact.sh
script in your shell.
source interact.sh
This grants you access to additional interaction commands.
In case you are using the interactive docker container, this step is automatically executed for you.
Provided Commands are :
k
- Alias forkubectl
clip
- Alias forxclip -selection clipboard
pclip
- Alias forxclip -o -selection clipboard
yaml2json
- Alias foryq e -o=json | sed -E 's/\"(\w+)\":/\1:/'
y2j
- Alias forpclip | yaml2json | clip
kn
- Allows for a quick contexts switch between namespaces.- If a prefix is set in
config.json
the resulting namespace is$PREFIX$ARGUMENT
. - If no argument was given the prefix is used as a namespace.
- If a prefix is set in
build
- Shortcut for./build-k8s.sh
get_clusters
- List all the contexts in your kubeconfig filesc
- Set the current-context in a kubeconfig file
prometheus
- Displays prometheus' urlgrafana
- Displays grafanas url as well as the login data
start_load
- Starts the load generator depicted inbuild/load
stop_load
- Stops the load generator
start_chaos
- Start the chaos mesh depicted inbuild/chaos
stop_chaos
- Stops the chaos meshdelete_chaos
- Removes the chaos mesh from the cluster
kafka_deploy
- Applies all kafka files inbuild/kafka
kafka_destroy
- Removes all kafka applications depicted inbuild/kafka
kafka_operator_restart
- Restarts the strimzi cluster operatorkafka
- Displays the kafka bootstrap server urlkafka_ui
- Displays kafka_ui's url