Skip to the content.

Setting up Kubernetes


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 | sudo apt-key add - && \
echo "deb 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

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

Setting up minikube

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

curl -LO
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)