Abstract: K8s is penetrating into edge computing. It provides convenience for the deployment of edge applications, changes the relationship between edge applications and hardware to a certain extent, and reduces the degree of coupling between the two.

This article is shared by Kaliarch from the application of cloud native in the Internet of Things (Please, Internet of Things!).

preface

The Internet of Things is already generating a staggering amount of data, which will grow exponentially with the deployment of 5G networks. Managing and using this data is a challenge.

Whether it’s generating information from traffic cameras, weather sensors, electricity meters, etc., combined with data from other cameras and sensors in a smart city environment, it can be too much to process in one central location, especially if you’re expecting devices to respond to events.

Kubernetes (K8s for short), which has been widely used in the ultra-large scale cloud computing environment, has been brought into the edge computing scene of the Internet of Things. The newly formed Kubernetes iot Edge Working Group will take the concept of running containers and extend it to the edge, facilitating the applicability of K8s in edge environments.

  • It supports the expansion of the number of connected devices of the Industrial Internet of Things to millions. It can not only support IP devices to directly connect to the K8s cloud platform, but also support non-IP devices to access the Internet of Things gateway.

  • Edge nodes are used to bring computing closer to devices to reduce latency, reduce bandwidth requirements, improve reliability, and meet users’ real-time, intelligent, data aggregation, and security requirements:

O Deploy streaming data applications to edge nodes to reduce bandwidth requirements for communication between devices and cloud platforms.

O Deploy a serverless application framework that allows edge side to quickly respond to certain emergency situations without communicating with the cloud.

  • Provides a common control platform in hybrid cloud and edge environments to simplify administration and operation.

The background,

1.1 KubeEdge profile

KubeEdge is an open source system that extends native containerized application orchestration and management to edge devices. Built on Kubernetes, it provides core infrastructure support for networks and applications, deploying applications in the cloud and on the edge, and synchronizing metadata. KubeEdge also supports the MQTT protocol, which allows developers to write client logic and enable resource constraints for device communication on the edge side. KubeEdge consists of two parts: cloud and edge.

1.2 KubeEdge characteristics

Edge of computing

By running the business logic at the edge, large amounts of data can be protected and processed locally. KubeEdge reduces bandwidth requests between the edge and the cloud, speeds up response times and protects customer data privacy.

Simplify the development

Developers can write regular HTTP – or MQTT-based applications that can be containerized and run anywhere on the edge or in the cloud.

Kubernetes native support

With KubeEdge, users can orchestrate applications, manage devices, and monitor application/device status on edge nodes, just as they would on a Kubernetes cluster in the cloud.

Rich applications

Users can easily deploy sophisticated machine learning, image recognition, event processing, and other high-level applications to the edge.

Introduction to KubeEdge

2.1 KubeEdge architecture

2.2 Architecture details

2.2.1 Part above the cloud

  • CloudHub: CloudHub is a Web Socket server that listens for changes in the cloud, caches and sends messages to the EdgeHub.

  • EdgeController: The EdgeController is an extended Kubernetes controller that manages metadata for edge nodes and Pods to ensure that data is delivered to the specified edge nodes.

  • DeviceController: DeviceController is an extended Kubernetes controller that manages edge devices and ensures cloud side synchronization of device information and device status.

2.2.2 Edges

  • EdgeHub: EdgeHub is a Web Socket client that interacts with Edge computing cloud services (such as Edge Controller in KubeEdge architecture diagram), including synchronizing cloud resource updates and reporting Edge hosts and device status changes to the cloud.

  • Edged: Edged is an agent running on edge nodes to manage containerized applications.

  • EventBus: EventBus is a MOSQUITotMQTT client that interacts with the MQTT server (Mosquitto) to provide subscription and publishing capabilities to other components.

  • ServiceBus: The ServiceBus is an HTTP client running on the edge. It receives requests from cloud services and interacts with the HTTP server running on the edge, enabling cloud services to access the HTTP server on the edge over HTTP.

  • DeviceTwin: DeviceTwin is responsible for storing device status and synchronizing device status to the cloud. It also provides a query interface for applications.

  • MetaManager: The MetaManager is a message processor, which is located between the Edgeedge and Edgehub. It stores/retrieves metadata into a lightweight database (SQLite).

Three, actual combat deployment

3.1 keadm deployment

Matters needing attention:

  • Currently, keadmUbuntu and CentOS are supported. RaspberryPi support is ongoing.

  • You need superuser privileges (or root privileges) to run.

3.1.1 Setting up the cloud (KubeEdge main node)

By default, the edge node needs to have access to ports and ports in Cloudcore.

Keadm init will install Cloudcore, generate the certificate, and install CRD. It also provides a flag that allows you to set a specific version.

Important: ****

1. At least one of kubeconFig or Master must be configured correctly so that it can be used to verify the version of the K8S cluster and other information.

2. Ensure that the edge node can connect to the cloud node using the local IP address of the cloud node, or use the –advertise-address flag to specify the public IP address of the cloud node.

3. –advertise-address (available only after version 1.3) is the address exposed in the cloud (added to the SAN of the CloudCore certificate). The default value is the local IP address.

Example:

# keadm init --advertise-address=" the-explaced-IP "(only work since 1.3 release)Copy the code

Output:

Kubernetes version verification passed, KubeEdge installation will start... . KubeEdge cloudcore is running, For logs visit: /var/log/kubeedge/cloudcore.logCopy the code

3.1.2 Setting edge End (KubeEdge working node)

  • Get the token from the cloud

Keadm GetToken running in the cloud returns a token that will be used when joining edge nodes.

# keadm gettoken 27a37ef16159f7d3be8fae95d588b79b3adaaf92727b72659eb89758c66ffda2.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTAyMT YwNzd9.JBj8LLYWXwbbvHKffJBpPd5CyxqapRQYDIXtFZErgYECopy the code
  • Add edge node

Keadm Join will install edgecore and MQTT. It also provides a flag that allows you to set a specific version.

Example:

# keadm join -- cloudcore - ipport = 192.168.20.50:10000 --token=27a37ef16159f7d3be8fae95d588b79b3adaaf92727b72659eb89758c66ffda2.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOj E1OTAyMTYwNzd9.JBj8LLYWXwbbvHKffJBpPd5CyxqapRQYDIXtFZErgYECopy the code

Important Note:

1. — Cloudcore-ipportFlag Indicates the mandatory flag. 1. To automatically apply for certificates for edge nodes, –token is required.

2. Use the same version of kubeEdge on cloud and edge.

Output:

Host has mosquit+ already installed and running. Hence skipping the installation steps !!! . KubeEdge edgecore is running, For logs visit: /var/log/kubeedge/edgecore.logCopy the code

3.2 Binary Deployment

Matters needing attention:

  • You need superuser privileges (or root privileges) to run.

3.2.1 Setting up the cloud (KubeEdge main node)

  • Create the CRD

  • Preparing configuration Files

For details, see Cloud Configuration.

  • run

3.2.2 Setting edge End (KubeEdge working node)

3.2.2.1 Preparing the Configuration File

  • Generating a Configuration File

  • Currency replaced in the cloud:

  • Update the token value in the Edgecore configuration file:

This token is the result of the previous step.

For details, see Edge configuration.

3.2.2.2 run

To run Cloudcore and edgecore on the same host, run the following command:

# export CHECK_EDGECORE_ENVIRONMENT="false"
Copy the code

Activate marginal nucleus:

# edgecore --config edgecore.yaml
Copy the code

Run edgecore-h to get help information and add options as needed.

Fourth, to reflect on

K8s is penetrating into edge computing, which provides convenience for edge-side application deployment, changes the relationship between edge application and hardware to some extent, and reduces the degree of coupling between the two. Through KubeEdge, the “edge scenario” can be expanded to help users accelerate the realization of cloud-side collaboration and complete the unified delivery, operation, maintenance and control of large-scale applications on a large number of edge and end devices.

Gartner estimates that by 2025, more than 75% of enterprise generated data can be created and processed outside of traditional data centers and the cloud, and the promise of choreography systems like Kubernetes has proven to be the best tool for this task.

The resources

  • Github.com/kubeedge/ku…

  • www.cncf.io/blog/2020/0…

Click to follow, the first time to learn about Huawei cloud fresh technology ~