In the previous part of this series, I introduced the core building blocks of cloud native edge computing stack: K3sProject Calico, and Portworx.

This tutorial will walk you through the steps involved in installing and configuring this software on an edge cluster, a set of Intel NUC mini PCs running Ubuntu 18.04. This infrastructure can be used for running reliable, scalable, and secure AI and IoT workloads at the edge.

Customizing K3s Installation for Calico

By default, K3s will run with flannel as the Container Networking Interface (CNI), using VXLAN as the default backend. We will replace that with a CNI-compliant Calico.

To integrate Calico networking stack with K3s, we need to customize the installation to enable CNI support.

Note that you need at least three nodes running the K3s cluster at the edge for high availability.

On the first node designated as server, run the below commands.

 export  K3S_TOKEN = "secret_edgecluster_token"

 export  INSTALL_K3S_EXEC = "--flannel-backend=none --disable=traefik --cluster-cidr=172.16.2.0/24 --cluster-init"
 curl  - sfL  https : //get.k3s.io | sh -

If 172.16.2.0/24 is already in use within your network you must select a different pod network CIDR by replacing 172.16.2.0/24 in the above command.

On the remaining server nodes, run the following commands. Note that we added the --server switch to the installer pointing it to the IP address of the first node.

 export  K3S_TOKEN = "secret_edgecluster_token"
 export  INSTALL_K3S_EXEC = "--flannel-backend=none --disable=traefik --cluster-cidr=172.16.2.0/24 --server https://10.0.0.60:6443"
 curl  - sfL  https : //get.k3s.io | sh -
 

To configure worker nodes or agents, run the following commands:

 export  K3S_URL = https : //10.0.0.60:6443
 export  K3S_TOKEN = "secret_edgecluster_token"
 curl  - sfL  https : //get.k3s.io | sh -

Replace K3S_URL with the IP address of the K3s server.

At the end of this step, you should have a cluster with four nodes.

Since the network is not configured yet, none of these nodes are ready. As soon as we apply Calico specs to the cluster, the nodes will become ready.

Before proceeding to the next step, copy /etc/rancher/k3s/k3s.yaml from one of the server nodes to your local workstation and point the KUBECONFIG environment variable to that. Don’t forget to update the master URL in the YAML file. This provides remote access to the K3s cluster through kubectl CLI.

#cloud native #edge / iot #kubernetes #tutorial #react native

 Configure Cloud Native Edge Infrastructure with K3s, Calico, Portworx
3.20 GEEK