Skip to the content.

Setting up Kubernetes

Sources: https://serverfault.com/a/684792; https://gist.github.com/alexellis/

Do not forget docker being installed is always necessary! First, disable swap on your system: find swap volumes with cat /proc/swaps. Then, turn off swap:

sudo swapoff --a

Comment out any of the volumes found before in /etc/fstab and reboot your system.

Then, install Kubernetes:

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && \
sudo apt-get update -q && \
sudo apt-get install -qy kubeadm

Do this on all nodes.

The Kubernetes master node

Only on the master node, execute:

sudo sysctl net.bridge.bridge-nf-call-iptables=1
sudo kubeadm init --token-ttl=0

If you have the error

[ERROR CRI]: container runtime is not running: output: time="2023-04-17T12:35:13Z" level=fatal msg="validate service connection: CRI v1 runtime API is not implemented for endpoint \"unix:///var/run/containerd/containerd.sock\": rpc error: code = Unimplemented desc = unknown service runtime.v1.RuntimeService"

This is a possible solution

rm /etc/containerd/config.toml

systemctl restart containerd

The kubeadm init command tells you to execute the following statements (must be ran inside the kollaps directory):

mkdir -p $HOME/.kube && \
sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config && \
sudo chown $(id -u):$(id -g) $HOME/.kube/config
cp $HOME/.kube/config kube/config

Rebuild the deployment generator.

docker build -f dockerfiles/DeploymentGenerator -t kollaps-deployment-generator:2.0 .

It also gives you a join command like this: sudo kubeadm join <IP>:<PORT> --token <TOKEN> --discovery-token-ca-cert-hash sha256:<HASH>. Use this on the worker nodes to join the cluster.

Next (only on the master again), install the Weavenet CNI plugin with a custom IP range:

kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s.yaml

If you have problems with kubeadm do kubeadm reset and init again, do not forget to run the commands above.

Note that we also successfully tested the Calico CNI plugin.

If you want to run pods on the master node, un-taint it:

kubectl taint nodes --all node-role.kubernetes.io/control-plane-

Setting up minikube

To use local docker images, we use minikube install it with:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube

Start minikube with:

minikube start

And to load the Kollaps and dashboard images into minikube run

eval $(minikube docker-env)  
docker build --rm -f dockerfiles/Kollaps -t kollaps:2.0 .
docker build -f examples/utils/dashboard/Dockerfile -t kollaps/dashboard:1.0 examples/utils/dashboard/
eval $(minikube docker-env --unset)