Kubernetes Cluster Setup
Before deploying Akri, you must have a Kubernetes cluster (v1.16 or higher) running with kubectl and Helm installed. Akri is Kubernetes native, so it should run on most Kubernetes distributions. This document provides cluster setup instructions for the three Kubernetes distributions that all of our end-to-end tests run on.
Note: All nodes must be Linux on amd64, arm64v8, or arm32v7.

Install Kubernetes Distribution

Kubernetes
K3s
MicroK8s
  1. 1.
    Reference Kubernetes documentation for instructions on how to install Kubernetes. See Akri's release notes to see what versions of Kubernetes Akri has been tested on.
  2. 2.
    Install Helm for deploying Akri.
    1
    sudo apt install -y curl
    2
    curl -L https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
    Copied!
Note: To enable workloads on a single-node cluster, remove the master taint.
1
kubectl taint nodes --all node-role.kubernetes.io/master-
Copied!
  1. 1.
    Install K3s. The following will install the latest K3s version. Reference Akri's release notes to see what versions of K3s Akri has been tested on.
    1
    curl -sfL https://get.k3s.io | sh -
    Copied!
    Note: Optionally specify a version with the INSTALL_K3S_VERSION env var as follows: curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.21.5+k3s1 sh -
  2. 2.
    Grant admin privilege to access kube config.
    1
    sudo addgroup k3s-admin
    2
    sudo adduser $USER k3s-admin
    3
    sudo usermod -a -G k3s-admin $USER
    4
    sudo chgrp k3s-admin /etc/rancher/k3s/k3s.yaml
    5
    sudo chmod g+r /etc/rancher/k3s/k3s.yaml
    6
    su - $USER
    Copied!
  3. 3.
    Check K3s status.
    1
    kubectl get node
    Copied!
  4. 4.
    Install Helm.
    1
    export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
    2
    sudo apt install -y curl
    3
    curl -L https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
    Copied!
  5. 5.
    If desired, add nodes to your cluster by running the K3s installation script with the K3S_URL and K3S_TOKEN environment variables. See K3s installation documentation for more details.
  1. 1.
    Install MicroK8s. The following will install the latest MicroK8s version. Add --channel=$VERSION/stable to specify as specific Kubernetes version. Reference Akri's release notes to see what versions of MicroK8s Akri has been tested on.
    1
    snap install microk8s --classic
    Copied!
  2. 2.
    Grant admin privilege for running MicroK8s commands.
    1
    sudo usermod -a -G microk8s $USER
    2
    sudo chown -f -R $USER ~/.kube
    3
    su - $USER
    Copied!
  3. 3.
    Check MicroK8s status.
    1
    microk8s status --wait-ready
    Copied!
  4. 4.
    Enable CoreDNS, Helm and RBAC for MicroK8s.
    1
    microk8s enable dns helm3 rbac
    Copied!
  5. 5.
    If you don't have an existing kubectl and helm installations, add aliases. If you do not want to set an alias, add microk8s in front of all kubectl and helm commands.
    1
    alias kubectl='microk8s kubectl'
    2
    alias helm='microk8s helm3'
    Copied!
  6. 6.
    By default, MicroK8s does not allow Pods to run in a privileged context. None of Akri's components run privileged; however, if your custom broker Pods do in order to access devices for example, enable privileged Pods like so:
    1
    echo "--allow-privileged=true" >> /var/snap/microk8s/current/args/kube-apiserver
    2
    microk8s.stop
    3
    microk8s.start
    Copied!
  7. 7.
    If desired, reference MicroK8's documentation to add additional nodes to the cluster.

Configure crictl

Akri depends on crictl to track some Pod information. By default, Akri assumes Docker is the container runtime with the Docker socket at /var/run/dockershim.sock and crictl installed at /usr/bin/crictl. These are configured via Akri's Helm chart during installation in the agent.host.dockerShimSock and agent.host.crictl values, respectively. Akri recommends setting these under an AKRI_HELM_CRICTL_CONFIGURATION environment variable and then adding the variable to each Akri installation like so:
1
helm install akri akri-helm-charts/akri \
2
$AKRI_HELM_CRICTL_CONFIGURATION
Copied!
The following are the recommended settings based on Kubernetes distribution.
Kubernetes
K3s
MicroK8s
The defaults should work for standard Kubernetes. The following is therefore redundant:
1
export AKRI_HELM_CRICTL_CONFIGURATION="--set agent.host.crictl=/usr/local/bin/crictl --set agent.host.dockerShimSock=/var/run/dockershim.sock"
Copied!
  1. 1.
    If using K3s versions 1.19 or greater, install crictl locally (note: there are no known version limitations, any crictl version is expected to work). Previous K3s versions come with crictl embedded.
    1
    VERSION="v1.17.0"
    2
    curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-${VERSION}-linux-amd64.tar.gz --output crictl-${VERSION}-linux-amd64.tar.gz
    3
    sudo tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
    4
    rm -f crictl-$VERSION-linux-amd64.tar.gz
    Copied!
  2. 2.
    Configure Akri to use the crictl path and K3s containerd socket. This AKRI_HELM_CRICTL_CONFIGURATION environment variable should be added to all Akri Helm installations.
    1
    export AKRI_HELM_CRICTL_CONFIGURATION="--set agent.host.crictl=/usr/local/bin/crictl --set agent.host.dockerShimSock=/run/k3s/containerd/containerd.sock"
    Copied!
MicroK8s does not install crictl locally, so crictl must be installed and the Akri Helm chart needs to be configured with the crictl path and MicroK8s containerd socket.
1
# Note that we aren't aware of any version restrictions
2
VERSION="v1.17.0"
3
curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-${VERSION}-linux-amd64.tar.gz --output crictl-${VERSION}-linux-amd64.tar.gz
4
sudo tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
5
rm -f crictl-$VERSION-linux-amd64.tar.gz
6
7
export AKRI_HELM_CRICTL_CONFIGURATION="--set agent.host.crictl=/usr/local/bin/crictl --set agent.host.dockerShimSock=/var/snap/microk8s/common/run/containerd.sock"
Copied!
Last modified 26d ago