Project Calico — Installation

First, we need to download calico configuration file

curl https://docs.projectcalico.org/v3.11/manifests/calico.yaml -O

As we didn’t specify CIDR when we initialized our cluster we need to check what we got assigned.

kubeadm config view | grep Subnet

We are going to update the configuration file with CIDR that we got earlier for our cluster.

sed -i 's@192.168.0.0/16@YOUR-CIDR@g' calico.yaml

and apply it to our cluster

kubectl apply -f calico.yaml

This will take a minute or two, so we can monitor the progress with

kubectl get pods --all-namespaces

Because Calico requires enforcement of Reverse Path Filtering and our Ubuntu distribution is not enforcing them our Calico nodes will be failing. So we will be disabling it via a change in env variable with the command below. You can read more about this here and here.

kubectl -n kube-system set env daemonset/calico-node FELIX_IGNORELOOSERPF=true

Once all pods are running we can confirm that all our nodes now are now in a ready state by running

kubectl get nodes

Let’s also rename label <none> to “worker”

kubectl label node k8-w1 node-role.kubernetes.io/worker=worker

kubectl label node k8-w2 node-role.kubernetes.io/worker=worker

kubectl label node k8-w3 node-role.kubernetes.io/worker=worker

Running Kubernetes cluster

Congratulations your Kubernetes cluster is now running!

However, we are not done just yet (it’s called slow guide after all).

MetalLB Load Balancer Installation

As we don’t have an external load balancer, we are going to need a software solution, and metalLB looks like a good choice. There are some compatibility issues with Calico and metaLB and you can read about them more here. However, they are not important for what we are trying to do.

On our master node let’s install our load balancer.

Now we need to configure our IP pool. Make sure it is out of address range for your local DHCP, but that is in range for your router’s local network. Let’s save config map below as metalLB-config.yaml

apiVersion: v1

kind: ConfigMap

metadata:

namespace: metallb-system

name: config

data:

config: |

address-pools:

- name: default

protocol: layer2

addresses:

- 192.168.1.200-192.168.254.254

We can install it to cluster with

kubectl apply -f metalLB-config.yaml

That’s it we are all set!