Register an Edge Node
local graph
Chapter 7 — Register an Edge Node
Section titled “Chapter 7 — Register an Edge Node”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.
Technical requirements
Section titled “Technical requirements”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
What is Edge node registration?
Section titled “What is Edge node registration?”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.
Verifying the pre-condition
Section titled “Verifying the pre-condition”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.
- Verify that
HZN_ORG_IDandHZN_EXCHANGE_USER_AUTHare set in yourYou should expect to seeenv | grep HZNHZN_ORG_IDandHZN_EXCHANGE_USER_AUTHas defined environment variables. - Check that the
hznCLI is installed and the Edge agentYou should expect to see text output similar to the following:hzn versionHorizon CLI version: 2.30.0-1491Horizon Agent version: 2.30.0-1491 - Verify that you can access the
You should expect to see text output similar to the following:hzn exchange version2.110.4
- Confirm that your credentials are valid for working with the Management Hub. This step assumes that Step 1 has
You should expect to see text output similar to the following:hzn exchange user list{"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.
Verifying the current Edge node condition
Section titled “Verifying the current Edge node condition”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 listYou 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 Hubunconfiguring: The node can be in this state for a short period when it is unregistering from the Management Hubconfigured: 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: TheHZN_NODE_IDvalue. 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 thehostnamevalue.organization: TheHZN_ORG_IDvalue 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 betrueorfalse, 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 potentialstatevalues described previously.last_update_time: A timestamp value indicating the last timeconfigstatewas updated.
configuration:exchange_api: Exchange (part of the Management Hub) API endpoint:exchange_version: Current exchange versionrequired_minimum_exchange_version: Required minimum exchange version:preferred_exchange_version: Preferred exchange versionmms_api: Model Management System API endpointarchitecture: Processor architecture of the Edge device nodehorizon_version: Current HZN CLI version
Registering an Edge device node
Section titled “Registering an Edge device node”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 -hTip
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 registerThis 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.
Verifying the post-condition
Section titled “Verifying the post-condition”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.
Summary
Section titled “Summary”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.