Skip to content
ImagineWorld

Register an Edge Node

node_idnode-book_real-world-edge-computing_chapter-07-register-an-edge-node
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num7
chapter_titleRegister an Edge Node
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

In the previous chapter, we went through the steps of setting up an All-in-One (AIO) Open Horizon Management Hub and installing the Edge Agent on an Edge node. Once the Edge Agent is installed on the Edge node, it is ready to be registered with the Management Hub. Additionally, as we progress through the subsequent chapters, we will begin utilizing various hzn commands and practicing common techniques to verify the expected functionality of the ecosystem you are beginning to work within. These techniques will often be identified in a callout Tip section.

In this chapter, we’re going to cover the following main topics:

  • What is Edge node registration?
  • Verifying the pre-condition
  • Verifying the current Edge node condition
  • Registering an Edge device node
  • Verifying the post-condition

While the automated Edge Agent installation process usually includes registering the Edge Agent, we have divided the steps in this book to provide a more detailed understanding.

For the Edge Agent registration to work, ensure the following:

  • Open Horizon AIO Management Hub is running and accessible 1 1 See Chapter 6*, Installing an Edge Agent on an Edge Node*, for more information about setting up the Open Horizon AIO Management Hub if you haven’t already.
  • Edge Agent is installed on your Edge device node 2 2 See Chapter 6*, Installing an Edge Agent on an Edge Node*, for more information about installing the Edge Agent if you haven’t already.
  • The Open Horizon CLI (hzn) is functioning on the Edge device node
  • You are SSH-connected and logged in to your Edge device node

As mentioned previously, for an Edge node to be managed for workload placement and to keep the application running, the Edge node must be registered with the Management Hub.

It is always a good idea to work with a functioning system before moving to the next set of steps. This will help you avoid the situation where subsequent actions start to fail. Throughout this book, we will highlight such strategies and provide you with guidance so that you’ll be successful.

Tip

The following set of commands can help you verify any pre-conditions and ensure that you are working with a properly functioning Management Hub.

  1. Verify that HZN_ORG_ID and HZN_EXCHANGE_USER_AUTH are set in your
    env | grep HZN
    You should expect to see HZN_ORG_ID and HZN_EXCHANGE_USER_AUTH as defined environment variables.
  2. Check that the hzn CLI is installed and the Edge agent
    hzn version
    You should expect to see text output similar to the following:
    Horizon CLI version: 2.30.0-1491
    Horizon Agent version: 2.30.0-1491
  3. Verify that you can access the
    hzn exchange version
    You should expect to see text output similar to the following:
    2.110.4
  4. Confirm that your credentials are valid for working with the Management Hub. This step assumes that Step 1 has
    hzn exchange user list
    You should expect to see text output similar to the following:
    {
    "myorg/admin": {
    "password": "********",
    "email": "not@used",
    "admin": true,
    "hubAdmin": false,
    "lastUpdated": "2024-02 13T02:09:45.344124229Z[UTC]",
    "updatedBy": "root/root"
    }
    }

If any of these conditions aren’t working as expected, make sure you correct them before continuing further.

Tip

If you are struggling with the above conditions not working as expected jump to Chapter 15, Troubleshooting at the Edge for techniques for addressing these problems.

Before we register the Edge node, let’s check whether the Edge device node is already registered by running the following command. This command shows the current Edge node status, along with other details of the Edge node:

hzn node list

You should expect to see text output similar to the following:

{
"id": "edge-device-node",
"organization": null,
"pattern": null,
"name": null,
"nodeType": null,
"token_last_valid_time": "",
"token_valid": null,
"ha_group": null,
"configstate": {
"state": "unconfigured",
"last_update_time": ""
},
"configuration": {
"exchange_api": "http://<ip-address-of-the-AIO-machine:3090/v1/",
"exchange_version": "2.110.4",
"required_minimum_exchange_version": "2.90.1",
"preferred_exchange_version": "2.110.1",
"mms_api": "http://ip-address-of-the-AIO-machine:9443",
"architecture": "amd64",
"horizon_version": "2.30.0-1491"
}
}

Though it is important to understand the meaning of each field, the most important field to pay attention to is configstate and its corresponding state field. The configstate field can be in three different states:

  • unconfigured: This is one of the terminal states of the Edge node when the node is not registered with a Management Hub
  • unconfiguring: The node can be in this state for a short period when it is unregistering from the Management Hub
  • configured: This is one of the terminal states of the Edge node when the node is registered with a Management Hub

While the meaning of some of the other fields is self-explanatory, here is a brief explanation of each:

  • id: The HZN_NODE_ID value. You can pass it as a command-line option or set it as an environment value in your shell. If not specified, the value will be picked up from the hostname value.
  • organization: The HZN_ORG_ID value is initialized in your shell.
  • pattern: The service pattern that this node is running. We will elaborate on this in detail later in this book when we discuss how to deploy services on the Edge node.
  • name: The name of the Edge node.
  • nodeType: Its value can be device or cluster.
  • token_last_valid_time: A timestamp value indicating the last time the authentication token to the Exchange was validated for this node.
  • token_valid: This can be true or false, indicating whether the token was deemed to be valid by the Exchange.
  • ha_group: The high-availability group that this node belongs to.
  • configstate:
    • state: Current Edge device node state. See the potential state values described previously.
      • last_update_time: A timestamp value indicating the last time configstate was updated.
  • configuration:
    • exchange_api: Exchange (part of the Management Hub) API endpoint:
      • exchange_version: Current exchange version
      • required_minimum_exchange_version: Required minimum exchange version:
      • preferred_exchange_version: Preferred exchange version
      • mms_api: Model Management System API endpoint
      • architecture: Processor architecture of the Edge device node
      • horizon_version: Current HZN CLI version

Simply running the hzn register command will register the Edge node with the Management Hub. The provided HZN_ORG_ID and HZN_EXCHANGE_USER_AUTH values are specified as environment variables. To get a better understanding of the register command and the various options that it supports, run the following command with the – h option:

hzn register -h

Tip

In general, each hzn command and its subcommands provide an extensive detailed description of each option. Take some time to familiarize yourself with the options that deal with other ways of specifying authentication parameters, org names, patterns, policies, and more.

We will be using variations of the hzn register command in later chapters. For now, just use the following command to register the Edge device node:

hzn register

This will register the Edge device node with the Management Hub. The preceding command shows a detailed output of activities that get performed on the terminal as part of registering the Edge device node with the Management Hub. This output also specifies suggested next steps the user may take.

In addition to observing the output on the terminal as the Edge device node registers with the Management Hub, you can also utilize the hzn node list command to confirm that the node was registered successfully by observing the changes in the output. Your expected output will look similar to this:

{
"id": "edge-device-node",
"organization": "myorg",
"pattern": "",
"name": "edge-device-node",
"nodeType": "device",
"token_last_valid_time": "2024-02-25 16:27:19 -0800 PST",
"token_valid": true,
"ha_group": "",
"configstate": {
"state": "configured",
"last_update_time": "2024-02-25 16:27:19 -0800 PST"
},
"configuration": {
"exchange_api": "http://<ip-address-of-the-AIO-node>:3090/v1/",
"exchange_version": "2.110.4",
"required_minimum_exchange_version": "2.90.1",
"preferred_exchange_version": "2.110.1",
"mms_api": "http://<ip-address-of-the-AIO-node>:9443",
"architecture": "amd64",
"horizon_version": "2.30.0-1491"
}
}

You will notice that most of the fields that were either null or "" before the Edge node registration now have values.

It is also important to note that the configstate: state value is now configured.

With that, you’ve learned how to register an Edge device node with the Management Hub.

In this chapter, you learned how to register an Edge device node with the Management Hub. To achieve this, you learned how to verify the initial condition before registering and the post-condition after registering.

In the next chapter, we will learn about other commands and develop a solid understanding about them so that we can interact with other components of the Management Hub.