Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Deploy the Open Horizon All-in-1 Horizon Management Hub

JP> NOTE: If you already have a Hub, skip to the next section: installing and configuring a cluster.

  1. Install the Management Hub without the native agent:

    curl -sSL https://raw.githubusercontent.com/open-horizon/devops/master/mgmt-hub/deploy-mgmt-hub.sh | bash -s -- -A
    

    Note: You can also optionally export HZN_LISTEN_IP to an external IP that can be reached outside of the local network before running the deploy-mgmt-hub.sh script

  2. The end of the command output will include a summary of steps performed. In step 2, you will find a list of passwords and tokens that were automatically generated. These include the exchange root password and Hub admin password, so it is important you write these down somewhere safe.

    The final 2 lines of output will list the HZN_ORG_ID and HZN_EXCHANGE_USER_AUTH environment variables and prompt you to export them. Exporting these will allow us to continue the tutorial without the need to specify them later.

    If you would like to use different credentials to connect your agent, use the hzn exchange org create and hzn exchange user create commands to add a new org and user, respectively. Export these variables and/or take note of them.

    Note: For more information about the all-in-1 hub, please follow this link: https://github.com/open-horizon/devops/tree/master/mgmt-hub

JP> NOTE: If you already have a cluster installed, skip to the next section: Installing the Cluster Agent.

JP> NOTE: The following section on installing and configuring a cluster currently has separate directions for two solutionsL k3s and microk8s.  Please choose one of those two supported solutions or use your own and translate our directions accordingly.

Install and configure a k3s edge cluster

...

This content describes how to install the Open Horizon agent on k3s or microk8s - a lightweight and small Kubernetes cluster solutions.

  1. Log in to your edge cluster as root

  2. Export your Hub exchange credentials if not already done:

    export HZN_EXCHANGE_USER_AUTH=<your-exchange-username>:<your-exchange-password>
    export HZN_ORG_ID=<your-exchange-organization>
  3. Run the following commands to export the HZN_EXCHANGE_URL, HZN_FSS_CSSURL, HZN_AGBOT_URL and HZN_SDO_SVC_URL needed to configure the agent to be able to talk to the Hub resources.

    export HZN_EXCHANGE_URL=http://$(docker network inspect hzn_horizonnet | jq -r '.[].Containers | to_entries[] | select (.value.Name == "exchange-api") | .value.IPv4Address' | cut -d'/' -f1):8080/v1
    export HZN_FSS_CSSURL=http://$(docker network inspect hzn_horizonnet | jq -r '.[].Containers | to_entries[] | select (.value.Name == "css-api") | .value.IPv4Address' | cut -d'/' -f1):9443/
    export HZN_AGBOT_URL=http://$(docker network inspect hzn_horizonnet | jq -r '.[].Containers | to_entries[] | select (.value.Name == "agbot") | .value.IPv4Address' | cut -d'/' -f1):3111
    export HZN_SDO_SVC_URL=http://$(docker network inspect hzn_horizonnet | jq -r '.[].Containers | to_entries[] | select (.value.Name == "sdo-owner-services") | .value.IPv4Address' | cut -d'/' -f1):9008/api
  4. Download the latest agent-install.sh script to your new edge cluster

    curl -sSLO https://github.com/open-horizon/anax/releases/latest/download/agent-install.sh
    chmod +x agent-install.sh
  5. 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.

    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
  6. 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
  7. Run agent-install.sh to get the necessary files from Github, install and configure the Horizon agent, and register your edge cluster with policy.

    Since this install guide does not enable SSL on the All-in-1 Management Hub, run the following commands to create a fake certificate and install the agent. (The install script currently requires a certificate to be present even if SSL is disabled)

    touch agent-install.crt
    ./agent-install.sh -D cluster -i 'anax:'
  8. Verify that the agent pod is running:

    kubectl get namespaces
    kubectl -n openhorizon-agent get pods
  9. Use the following command to connect to a bash instance on the agent pod to execute hzn commands

    kubectl exec -it $(kubectl get pod -l app=agent -n openhorizon-agent | grep "agent-" | cut -d " " -f1) -n openhorizon-agent – bash
  10. As a test, execute the following hzn command on the agent pod:

    hzn node ls
  11. The OpenHorizon cluster agent is now successfully installed and ready to deploy services