background

With the development of the Internet of Things, there are more and more kinds and numbers of devices connected to the cloud. In 2020, the number of devices connected to the Internet of Things has reached 12.6 billion globally, and it is growing at a rate of more than 10% every year. Unified management and control of numerous devices and processing of the data generated by numerous devices are unavoidable problems.

EdgeX Foundry is an open source edge device management platform that can be deployed at the edge of the network to connect devices and interact with upper-layer components, providing a proven solution for device management and control. EdgeX Foundry can be further enhanced by deploying the EdgeX Foundry in an edge cluster, taking advantage of the edge cluster as opposed to a central cluster.

  • EdgeX Foundry runs on the edge with an edge computing platform that connects to the central cloud from the top and manages devices from the bottom.
  • EdgeX Foundry’s common device management capabilities are required for the EdgeX Foundry’s edge computing platform to enable cloud side integration. The two complement each other and complement each other to empower the edge of the cloud.

The project design

To enable users to quickly use EdgeX Foundry’s capabilities in edge clusters, we provide one-click deployment of EdgeX Foundry in edge clusters. Through the configuration of relevant files, the command is integrated into the addon command of edgeadm according to the hierarchy, and the corresponding test is carried out to reduce possible errors. Users can easily deploy and use EdgeX Foundry’s capabilities on edge clusters in just a few steps.

Advantages of this scheme:

  • Completely native

    There are no changes to the EdgeX Foundry, no packaging, just a native deployment. In the next issue we will be offering new components that connect to SuperEdge and Kubernetes and EdgeX Foundry, but we will keep all components and capabilities optional and integrated as plug-ins without binding users to any additional functionality.

  • Optional components

    Our EdgeX Foundry integration is now hierarchical and optional, but we will continue to refine it to component optional, allowing users to deploy components as they wish and as their business needs require. See EdgeX Foundry architecture diagram for optional levels:

EdgeX Foundry image is from EdgeX Foundry. For more information on EdgeX Foundry, see EdgeX Foundry Github.

  • All parameters can be customized

    Our EdgeX Foundry is integrated with YAML templates, allowing users to modify any of the parameters of the YAML templates to meet their business custom requirements.

Installation of EdgeX Foundry component

Preparation conditions

Run the following command to download the edgeadm static installation package. Modify the parameter “arch= AMd64 “. Currently, [AMd64, arm64] is supported

Arch = AMD64 version= V0.6.0-beta.0 && rm -rf edgeadm- Linux -* && wget https://attlee-1251707795.cos.ap-chengdu.myqcloud.com/superedge/$version/$arch/edgeadm-linux-$arch-$version.tar.gz && tar -xzvf edgeadm-linux-* && cd edgeadm-linux-$arch-$version && ./edgeadmCopy the code

Install an edge cluster for reference: One-click Install edge independent Kubernetes cluster.

Install components for the EdgeX Foundry

Execute the following command to install all components of the EdgeX Foundry in one click

./edgeadm addon edgex
Copy the code

If the following message is displayed, the deployment is successful

Start install edgex-application-services.yml to your cluster
...
Deploy edgex-ui.yml success!
Copy the code

You can also add the required components to the cluster by using the following command

./edgeadm addon edgex [flag]
Copy the code

You can run the./edgeadm addon edgex –help command to view the available flags.

--app           Addon the edgex application-services to cluster.
--core          Addon the edgex core-services to cluster.
--device       Addon the edgex device-services to cluster.
--support      Addon the edgex supporting-services to cluster.
--sysmgmt    Addon the edgex system management to cluster
--ui              Addon the edgex ui to cluster.
Copy the code

For example, only core service layer related components can be installed

./edgeadm addon edgex --core
Copy the code

Install other components in the same way. Replace flag. To install multiple layers of components at the same time, you can add multiple flags.

EdgeX Foundry V1.3 is currently installed by default. If you need to install components of other versions, you can customize the EdgeX Foundry components.

The above installation does not include Security layer components and configurations. Related functions may be added in later versions or configured in the project source files.

After the deployment, run the following command to check the Pod and Service deployment

kubectl get -n edgex svc/pod
Copy the code

Note: If some components at the same level are successfully installed and some components fail to be installed, you can run the installation command again to update and install them. If an installed component fails to run, run the./edgeadm detach edgex [flag] command to uninstall and reinstall a specific layer of components. See EdgeX Foundry Uninstall below for details.

EdgeX Foundry interface

Access to the consul

You can view the deployment information about components by accessing the port on core-Consul from the web page. 30850 is the port number exposed by the core-Consul service.

curl http://localhost:30850/ui/dc1/services
Copy the code

If a Red Cross is displayed, the component fails to be installed. If the refresh still does not work, view the component logs to troubleshoot the failure or reinstall the component.

Visit the UI

You can also check whether each component is properly deployed by accessing the UI service port from the web page. 30040 is the port number exposed by the UI service

curl http://localhost:30040/
Copy the code

If the deployment is successful, entries are generated for each item.

Validation of the EdgeX Foundry

Connected devices

Run the following command to start a virtual device.

kubectl apply -f https://raw.githubusercontent.com/superedge/superedge/main/deployment/edgex/edgex-device-random.yaml
Copy the code

This starts a random integer generator virtual appliance connected to the EdgeX Foundry, which sends random numbers to core-Data and receives command control from Core-Command.

The data access

Run the following command to access the port of the core-data service from the web page to view the last 10 pieces of data sent to the core service by the random number device started in the previous step, where 30080 is the port number of the core-data service. Random-integer-generator01 is the virtual device where the above files are installed.

curl http://localhost:30080/api/v1/event/device/Random-Integer-Generator01/10
Copy the code

Device control

Viewing available commands

You can access the core-command service to view the commands performed on virtual devices, including the Put command and Get command. Put is used to deliver commands, Get is used to obtain commands, and 30082 is the port number of the core-command service.

curl http://localhost:30082/api/v1/device/name/Random-Integer-Generator01
Copy the code

Put the instructions

To control virtual devices, run the Put command. Here, we modify the range of random number generation, find the URL of the Put command from the web page, and run the following command:

curl -X PUT -d '{"Min_Int8": "0", "Max_Int8": "10"} ' http://localhost:30082/api/v1/device/2a20be3f-d9e6-4032-aeba-23f602d99a63/command/646fb3c7-f8bc-4b4f-bbad-d566777582d1Copy the code

Change the range of generated virtual devices to 0 to 10 and run the Put command.

Please remember to change the edgex-core-command:48082 field to localhost:30082, and change the contents in {} to available parameters. The parameters that can be modified are obtained from the display of the previous query command. 30082 is the port number of the core-command service.

The Get command

You can obtain the URL of the Get command from the above web page. The URL of the Get command is used to obtain the data sent by the random number device.

curl http://localhost:30082/api/v1/device/2a20be3f-d9e6-4032-aeba-23f602d99a63/command/646fb3c7-f8bc-4b4f-bbad-d566777582d1
Copy the code

The edgex-core-command:48082 field should be changed to localhost:30082, where 30082 is the port number of the core-command service

You can see that the random number generated by the random number device has changed to the range [0,10].

Export data

Execute the following command to deploy a component that exports EdgeX Foundry data to the cloud

kubectl apply -f  https://raw.githubusercontent.com/superedge/superedge/main/deployment/edgex/edgex-app-service-configurable.yaml
Copy the code

Start the component that exports data from core-Data to HiveMQ’s exposed MQTT Broker. You can visit the agent on a web page to see if the data has been successfully exported to the cloud. Visit the following url to access the web page

http://www.hivemq.com/demos/websocket-client/
Copy the code

Click Connect to connect and fill in the subject as EdgeXEvents

The Message column displays data sent from the virtual appliance to the EdgeX Foundry

However, since this is a public Broker, data uploaded by multiple parties will be kept and co-stored under the corresponding theme. Therefore, even if there is data displayed in the message column, it may be left over from the previous export operation. To truly verify whether the export was successful, you can try to create a new theme after connect. Yaml env Writable_Pipeline_Functions_MQTTSend_Addressable_Topic to this topic. After the deployment, check whether data is displayed on the Broker web page. If yes, the export is successful.

** Note: ** If any exception occurs during the above operations, please re-check the Pod and uninstall and reinstall it if necessary.

Uninstallation of EdgeX Foundry

Run the./edgeadm addon command to uninstall all edgex Foundry components and mount data generated on the host if all edgex components are installed or if you have custom installed all edgex Foundry components. If only some layers are installed or some components are missing, uninstall layers one by one by adding flags as described in the following section.

./edgeadm detach edgex
Copy the code

If the following information is displayed, the uninstallation is complete:

Detach edgex-application-services.yml success! . Detach edgex-configmap.yml success! Detach edgex completely success!Copy the code

/edgeadm detach edgex [flag] To unmount the Edgex Foundry, run the./edgeadm detach edgex — -help command to view the available flags:

--app             Detach the edgex application-services from cluster.
--core            Detach the edgex core-services from cluster.
--device         Detach the edgex device-services from cluster.
--support       Detach the edgex supporting-services from cluster.
--sysmgmt      Detach the edgex system management from cluster.
--ui                Detach the ui from cluster.
--completely  Detach the configmap and volumes from cluster.
Copy the code

Run this command to uninstall core service components

. / edgeadm detach edgex - coreCopy the code

To delete other components, replace flags. You can delete components of multiple layers at the same time with multiple Flags. You can run the following command to check whether all the pods have been deleted.

kubectl -n edgex  get deploy
Copy the code

Note:

  • If an error occurs during the deletion process, some components of a tier have been deleted, but some components of the tier are not deleted, the deletion operation fails. You need to reinstall all components of the tier using Addon before deleting the tier.
  • ./edgeadm detach edgexThis parameter is applicable only when all layer components exist. If only some components exist, manually delete them.

The late plan

We have now achieved the first step of our integration with the EdgeX Foundry, and our goal is shown below:

Is to thoroughly get through the cloud side end, the formation of cloud side end complete integration. EdgeX Foundry is not our only device management solution, but we will continue to integrate and abstract with more edge devices as we strive for seamless access to more common, multi-platform edge devices.

If you have any problems or suggestions, please pay attention to the “Cloud Native” public account, or raise Issues in SuperEdge community.

SuperEdge

  • Deploy the EdgeX Foundry using TKE Edge
  • Tencent Cloud united with a number of ecological partners, the open source SuperEdge edge container project
  • 【TKE Edge Container Series 】SuperEdge is easy to learn and use.
  • TKE Edge Containers from 0 to N Learn about SuperEdge
  • 【TKE Edge Container Series 】 Understand the architecture and principle of SuperEdge edge container
  • Install edge K8s cluster and native K8s cluster with edgeadm
  • Addon SuperEdge enables native K8s clusters to manage edge applications and nodes
  • 【TKE Edge Container Series 】 Break the internal network barrier, add hundreds of edge nodes from the cloud at a time
  • 【TKE Edge Container Series 】SuperEdge Cloud Edge tunnel new feature: From the cloud SSH operation and maintenance of edge nodes
  • 【TKE Edge Container Series 】 What are the features of SuperEdge High Availability Cloud side tunnel?

Landing case related information:

  • Edge container practice of Tencent WeMake Industrial Internet platform: Build a more efficient industrial Internet
  • After the explosion. With the edge container, the workload of seven or eight team members in a week can be achieved in seconds
  • Construction of industrial Internet platform based on edge container technology