Kubeedge

时间:2024-05-23 07:13:34

kubeedge

KubeEdge是一个开源系统,用于将本机容器化的应用程序编排功能扩展到Edge上的主机。

KubeEdge的优势主要包括:

·        边缘计算

借助在Edge上运行的业务逻辑,可以在生成数据的本地保护和处理大量数据。这样可以减少边缘和云之间的网络带宽需求和消耗。这样可以提高响应速度,降低成本并保护客户的数据隐私。

·        简化开发

开发人员可以编写基于常规http或mqtt的应用程序,对其进行容器化,然后在Edge或Cloud中的任何位置运行它们中的更合适的一个。

·        Kubernetes原生支持

借助KubeEdge,用户可以在Edge节点上编排应用,管理设备并监视应用和设备状态,就像云中的传统Kubernetes集群一样

·        大量的应用

可以轻松地将现有的复杂机器学习,图像识别,事件处理和其他高级应用程序部署和部署到Edge。

 

组件

KubeEdge由以下组件组成:

·        Edged:在边缘节点上运行并管理容器化应用程序的代理。

·        EdgeHub:Web套接字客户端,负责与Cloud Service进行交互以进行边缘计算(例如KubeEdge体系结构中的Edge Controller)。这包括将云侧资源更新同步到边缘,并将边缘侧8主机和设备状态更改报告给云。

·        CloudHub:Web套接字服务器,负责在云侧观察更改,缓存并向EdgeHub发送消息。

·        EdgeController:扩展的kubernetes控制器,它管理边缘节点和pod的元数据,以便可以将数据定向到特定的边缘节点。

·        EventBus:与MQTT服务器(mosquitto)进行交互的MQTT客户端,为其他组件提供发布和订阅功能。

·        DeviceTwin:负责存储设备状态并将设备状态同步到云。它还为应用程序提供查询接口。

·        MetaManager:edged和edgehub之间的消息处理器。它还负责将元数据存储到轻量级数据库(SQLite)或从中检索元数据。

 

 

 

Dependencies

For cloud side, we need:

·        Kubernetes cluster

For edge side, we need:

·        Container runtimes, now we support:

o    Docker

o    Containerd

o    Cri-o

o    Virtlet

·        MQTTServer(Optional)

 

Kubeedge

KubeEdge 1.3是我们当前的稳定分支。下面的路线图概述了将添加到KubeEdge的新功能。

2020Q2 Roadmap

·        Support metrics-server in the cloud.

·        Support Kubernetes exec API for edge application.

·        Upgrade Kubernetes dependency to 1.18.

·        Support edgenode certificate rotation.

·        Upgrade golang to 1.14.

·        Support ingress/gateway at edge.

·        Device CRD improvement, support device protocol extension.

·        Edge nodes cross subnet communication.

·        Support list-watch from edgecore for applications on the edge.

·        Collect data information sent from the edge side from CloudHub

·        Improve KubeEdge installation experience

·        Add more docs and move docs out of main repo

Future

·        Improve contributor experience by defining project governancepolicies, release process, membership rules etc.

·        Improve the performance and e2e tests with more metrics andscenarios.

·        Add protobuf support for data exchange format between cloud andedge

·        Finish scalability test and publish report

·        Support managing clusters at edge from cloud (aka. EdgeSite)

·        Enhance performance and reliability of KubeEdge infrastructure.

·        Support edge-cloud communication using edgemesh.

·        Istio-based service mesh across Edge and Cloud wheremicro-services can communicate freely in the mesh.

·        Enable function as a service at the Edge.

·        Evaluate and enable much larger scale Edge clusters withthousands of Edge nodes and millions of devices.

·        Enable intelligent scheduling of applications to large scaleEdge clusters.

·        Data management with support for ingestion of telemetry data andanalytics at the edge.

·        Security at the edge.

·        Evaluate gRPC for cloud to edge communication.

 

Beehive Overview

Beehive是基于消息通道的消息传递框架,用于KubeEdge模块之间的通信。如果已知其他蜂箱模块所注册的名称或该模块组的名称,则向蜂箱注册的模块可以与其他蜂箱模块通信。

 

Edge Controller Overview

EdgeController is the bridge between Kubernetes Api-Server and edgecore

以下是Edge控制器执行的功能:-

  • 下游控制器:从K8s Api服务器将添加/更新/删除事件同步到Edgecore

  • 上游控制器:将监视和资源和事件(节点,pod和configmap)的更新状态同步到K8s-Api服务器,还订阅来自edgecore的消息

  • 控制器管理器:创建管理器接口,该接口实现用于管理ConfigmapManager,LocationCache和podManager的事件

 

Downstream Controller:

  • Downstream controller: Watches K8S-Api-server and sends updates to edgecore via cloudHub

  • Sync (pod, configmap, secret) add/update/delete event to edge via cloudHub

  • Creates Respective manager (pod, configmap, secret) for handling events by calling manager interface

  • Locates configmap and secret should be send to which node

Kubeedge

Upstream Controller:

Sync watch and Update status of resource and events

  • UpstreamController receives messages from edgecore and sync the updates to K8S-Api-server

  • Creates stop channel to dispatch and stop event to handle pods, configMaps, node and secrets

  • Creates message channel to update Nodestatus, Podstatus, Secret and configmap related events

  • Gets Podcondition information like Ready, Initialized, Podscheduled and Unschedulable details

  • Below is the information for PodCondition

    • Ready: PodReady means the pod is able to service requests and should be added to the load balancing pools for all matching services

    • PodScheduled: It represents status of the scheduling process for this pod

    • Unschedulable: It means scheduler cannot schedule the pod right now, may be due to insufficient resources in the cluster

    • Initialized: It means that all Init containers in the pod have started successfully

    • ContainersReady: It indicates whether all containers in the pod are ready

  • Below is the information for PodStatus

    • PodPhase: Current condition of the pod

    • Conditions: Details indicating why the pod is in this condition

    • HostIP: IP address of the host to which pod is assigned

    • PodIp: IP address allocated to the Pod

    • QosClass: Assigned to the pod based on resource requirement

 

Kubeedge

 

CloudHub概述

CloudHub执行的主要功能是:

  • 获取消息上下文并为事件创建ChannelQ

  • 通过WebSocket创建HTTP连接

  • 服务websocket连接

  • 从边缘读取消息

  • 写消息到边缘

  • 将消息发布到控制器

 

设备控制器概述

设备控制器是KubeEdge的云组件,负责设备管理。KubeEdge中的设备管理是通过使用Kubernetes 自定义资源定义(CRD)来描述设备元数据/状态和设备控制器以在边缘和云之间同步这些设备更新来实现的。

 

The device controller makes use of device model and device instance to implement device management :

Device Model: A 

 describes the device properties exposed by the device and property visitors to access these properties. A device model is like a reusable template using which many devices can be created and managed. Details on device model definition can be found here.

Device Instance: A 

 instance represents an actual device object. It is like an instantiation of the 

 and references properties defined in the model. The device spec is static while the device status contains dynamically changing data like the desired state of a device property and the state reported by the device. Details on device instance definition can be found here.

Kubeedge

 

 

设备控制器执行的操作

以下是设备控制器执行的功能:-

  • 下游控制器:通过监视K8S API服务器,将设备更新从云同步到边缘节点

  • 上游控制器:使用设备孪生组件将设备更新从边缘节点同步到云

KubeedgeKubeedge

 

 

Kubeedge

 

将所需的设备双属性更新从云同步到边缘

Kubeedge

Edged

EdgeD是管理节点生命周期的边缘节点模块。它可以帮助用户在边缘节点上部署容器化的工作负载或应用程序。这些工作负载可以执行任何操作,从简单的遥测数据操作到分析或ML推理等等。使用kubectl云端的命令行界面,用户可以发出命令来启动工作负载。

Kubeedge

Pod Management

Kubeedge

 

Kubeedge

KubeedgeKubeedge

 

 

Kubeedge

 

Kubeedge

Kubeedge

Kubeedge

 

Kubeedge

 

Kubeedge

EventBus

Eventbus充当用于发送/接收有关mqtt主题的消息的接口。

它支持三种模式:

  • internalMqttMode

  • externalMqttMode

  • bothMqttMode

Kubeedge

 

Kubeedge

 

MetaManager

MetaManager是edged和edgehub之间的消息处理器。它还负责将元数据存储到轻量级数据库(SQLite)或从中检索元数据。

Metamanager根据以下列出的操作接收不同类型的消息:

  • 插入

  • 更新资料

  • 删除

  • 询问

  • 响应

  • 节点连接

  • MetaSync

Kubeedge

更新操作

Kubeedge

 

Kubeedge

 

删除操作

Kubeedge

查询操作

Kubeedge

 

Kubeedge

 

EdgeHub

Edge Hub负责与云中存在的CloudHub组件进行交互。它可以使用Web套接字连接或QUIC协议连接到CloudHub 。它支持诸如同步云端资源更新,报告边缘端主机和设备状态更改之类的功能。

它充当边缘与云之间的通信链接。它将从云接收的消息转发到边缘的相应模块,反之亦然。

Edgehub执行的主要功能是:

  • Keep Alive

在每个心跳周期之后,将保持活动消息或心跳发送到cloudHub。

 

  • Publish Client Info

发布客户端信息的主要职责是通知其他组或模块有关云连接状态的信息。

它会向所有组(即metaGroup,twinGroup和busGroup)发送一个蜂巢消息,告知它们云连接还是断开。

 

  • Route to Cloud

路由到云的主要责任是从其他模块(通过蜂巢框架)接收所有要发送到云的消息,然后通过websocket连接将它们发送到cloudHub。

此过程涉及的主要步骤如下:-

  1. 不断接收来自蜂巢上下文的消息

  2. 发送该消息到cloudHub

  3. 如果收到的消息是同步消息,则:

3.1如果在syncChannel上收到响应,则它将创建一个map [string]通道,其中包含消息的messageID作为键

3.2它等待一个心跳周期,以在创建的通道上接收响应,如果它在指定时间内未在通道上接收到任何响应,则它将超时。

3.3使用SendResponse()函数将通道上收到的响应发送回模块。

Kubeedge

 

  • Route to Edge

边缘路由的主要职责是(通过websocket连接)从云中接收消息,并通过蜂巢框架将其发送到所需的组。

此过程涉及的主要步骤如下:-

  • 接收来自cloudHub的消息

  • 检查是否找到消息的路由组。

  • 检查它是否是对SendSync()函数的响应。

  • 如果不是响应消息,则将消息发送到所需的组

  • 如果它是响应消息,那么该消息将发送到syncKeep通道

Kubeedge

DeviceTwin

DeviceTwin模块负责存储设备状态,处理设备属性,处理设备孪生操作,在边缘设备和边缘节点之间创建成员资格,将设备状态同步到云以及在边缘和云之间同步设备孪生信息。它还为应用程序提供查询接口。设备孪生由四个子模块(即成员模块,通信模块,设备模块和设备孪生模块)组成,以执行设备孪生模块的职责。

 

以下是设备双控制器执行的功能:-

  • 将元数据与数据库同步(Sqlite)

  • 注册并启动子模块

  • 将消息分配给子模块

  • 健康检查

DeviceTwin由四个模块组成,即:-

  • 会员模块

  • 双模块

  • 通讯模块

  • 设备模块

Kubeedge

KubeedgeKubeedge

Kubeedge

 

 

Kubeedge

Kubeedge

Kubeedge

Kubeedge

EdgeSite: Standalone Cluster at edge

在边缘计算中,有些情况下客户希望在边缘位置安装整个群集。结w果,管理员/用户可以利用本地控制平面来实现管理功能,并充分利用所有边缘计算的优势。

EdgeSite帮助在边缘运行轻量级群集。

Kubeedge

 

好处

通过集成,可以启用以下功能

  1. 完全控制Kubernetes集群的边缘

  2. 轻质控制平面和代理

  3. 网络断开/重新连接时的边缘工作器节点自治

  4. 边缘计算的所有优势,包括延迟,数据局部性等

Bluetooth Mapper

映射器是用于连接和控制设备的应用程序。这是用于蓝牙协议的映射器的实现。目的是创建一个应用程序,用户可以通过该应用程序轻松地使用蓝牙协议操作设备以与KubeEdge平台进行通信。要求用户通过配置文件向映射器提供控制其设备所需的信息。通过通过MQTT代理提供输入,可以在运行时更改这些设置。

Modbus映射器

映射器是用于连接和控制设备的应用程序。这是用于Modbus协议的映射器的实现。目的是创建一个应用程序,通过该应用程序,用户可以轻松使用ModbusTCP / ModbusRTU协议操作设备以与KubeEdge平台进行通信。要求用户通过dpl配置文件向映射器提供控制其设备所需的信息。这些可以在运行时通过更新configmap进行更改。