Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Installing the agent on K3s and MicroK8s edge clusters

This content describes how to install the Open Horizon agent on K3s or microk8s , lightweight and small Kubernetes clusters:

Prerequisites

  • The architecture of the cluster must be one of the following:
    • AMD64 (x86_64)
    • ARM64 (AArch64)
    • ppc64le
    • s390x
  • Operating system must be modern Linux variant with 64-bit and systemd support

Note: Open Horizon cluster agent installation requires cluster admin access on the edge cluster. Additionally, the β€œjq” command-line JSON processor must be installed prior to running the agent install script.

Procedure

  1. Log in to your edge cluster as root.

  2. If you don’t already have your authorization information, get it now. For details about how to get the authorization information, see Authentication overview.

    export HZN_ORG_ID=<your-exchange-organization>
    export HZN_EXCHANGE_USER_AUTH=<authentication string>
    export HZN_EXCHANGE_URL= # example http://open-horizon.lfedge.iol.unh.edu:3090/v1
    export HZN_FSS_CSSURL= # example http://open-horizon.lfedge.iol.unh.edu:9443/
    
  3. Copy the agent-install.sh script to your new edge cluster.

  4. The agent-install.sh script will store the Open Horizon agent in the edge cluster image registry. Set the full image path (minus the tag) that should be used. For example:

    • On k3s:

      REGISTRY_ENDPOINT=$(kubectl get service docker-registry-service | grep docker-registry-service | awk '{print $3;}'):5000
      export IMAGE_ON_EDGE_CLUSTER_REGISTRY=$REGISTRY_ENDPOINT/openhorizon-agent/amd64_anax_k8s
      
    • On microk8s:

      export IMAGE_ON_EDGE_CLUSTER_REGISTRY=localhost:32000/openhorizon-agent/amd64_anax_k8s
      

    Note: The Open Horizon agent image is stored in the local edge cluster registry because the edge cluster Kubernetes needs ongoing access to it, in case it needs to restart it or move it to another pod.

  5. Instruct agent-install.sh to use the default storage class:

    • On k3s:

      export EDGE_CLUSTER_STORAGE_CLASS=local-path
      
    • On microk8s:

      export EDGE_CLUSTER_STORAGE_CLASS=microk8s-hostpath
      
  6. Run agent-install.sh to get the necessary files from CSS (Cloud Sync Service), install and configure the Horizon agent, and register your edge cluster with policy:

    ./agent-install.sh -D cluster -i 'css:'
    

    Notes:

    • To see all of the available flags, run: ./agent-install.sh -h
    • If an error occurs causing agent-install.sh to not complete successfully, correct the error that is displayed, and run agent-install.sh again. If that does not work, run agent-uninstall.sh (see Removing agent from edge cluster) before running agent-install.sh again.
  7. Verify that the agent pod is running:

    kubectl get namespaces
    kubectl -n openhorizon-agent get pods
    
  8. Usually, when an edge cluster is registered for policy, but does not have any user-specified node policy, none of the deployment policies deploy edge services to it. This is expected. Proceed to Deploying services to your edge cluster to set node policy so that an edge service will be deployed to this edge cluster.

What’s next