北冰洋以北 发表于 2024-5-23 09:17:36

KubeEdge v1.17.0发布!数据处置处罚能力与易用性全面提拔

本文分享自华为云社区《KubeEdge v1.17.0发布!数据处置处罚能力与易用性全面提拔》 ,作者: 云容器大未来。
KubeEdge社区v1.17.0 版本正式发布。新版本为边缘节点和设备带来了更多的新能力,同时一连在易用性上做了提拔。
https://bbs-img.huaweicloud.com/blogs/img/20240521/1716255067330579125.png
KubeEdge v1.17.0 新增特性:

[*]支持边缘 Pods 使用 InClusterConfig 访问 Kube-APIServer
[*]Mapper 支持流数据上报
[*]支持边缘子模块自启动
[*]引入 keadm ctl 命令,支持在边缘查询和重启 pod
[*]易用性提拔:基于 Keadm 的部署能力增强
[*]Mapper 框架添加 MySQL 数据库
[*]升级 K8s 依赖到 v1.28
新特性概览

支持边缘 Pods 使用 InClusterConfig 访问 Kube-APIServer

Kubernetes 支持 Pods 使用 InClusterConfig 机制直接访问 Kube-APIServer,然而在边缘场景,边缘 Pods 和 Kube-APIServer 通常不在一个网络情况下,无法直接访问。在1.17.0 新版本中,通过开启 MetaServer 和 DynamicController 模块,边缘 Pods 同样可以使用 InClusterConfig 机制直接访问 Kube-APIServer。
该特性在本版本中作为 Alpha 特性发布,如果你需要使用,您需要开启边缘 List-Watch 开关并配置 requireAuthorization的featureGates。

[*]在使 keadm init 启动 CloudCore 时,指定 cloudCore.featureGates.requireAuthorization=true 以及 cloudCore.modules.dynamicController.enable=true。
[*]启动 EdgeCore 后,按如下修改 edgecore.yaml 后重启 EdgeCore。
apiVersion: edgecore.config.kubeedge.io/v1alpha2
kind: EdgeCore
featureGates:
requireAuthorization: true
modules:
...
metaManager:
    metaServer:
      enable: true更多信息可参考:https://github.com/kubeedge/kubeedge/pull/5524
https://github.com/kubeedge/kubeedge/pull/5541
Mapper 支持流数据上报

1.17 版本中,针对当前 Mapper 只能处置处罚离散型的设备数据,无法处置处罚流数据的问题,为 Mapper-Framework 提供视频流数据处置处罚的能力。在新版本中,能够支持 KubeEdge 管理边缘摄像头设备,获取摄像头收罗的视频流,并将视频流保存为帧文件大概视频文件,增强 KubeEdge 边缘设备管理能力。
边缘摄像头设备管理

1.17 版本提供基于 Onvif 协议的内置 Mapper,实现 Onvif 设备驱动功能,能够根据用户配置文件中的定义连接摄像头设备,获取设备的鉴权文件与 RTSP 视频流,将 Onvif 摄像头设备纳管进 KubeEdge 集群。Onvif 设备的一个示例 device-instance 配置文件如下:
apiVersion: devices.kubeedge.io/v1beta1
kind: Device
metadata:
name: onvif-device-01
namespace: default
spec:
deviceModelRef:
    name: onvif-model   # need to be the same as the model name defined in onvif-model.yaml
protocol:
    protocolName: onvif
    configData:
      url: 192.168.168.64:80   # Replace it with the address of your own onvif camera
      userName: admin          # Replace it with the username of your own onvif camera
      password: /etc/secret/password   # Fill in the fields according to your secret.yaml
nodeName: edge-node          # Replace it with your edge node name
properties:
    - name: getURI
      visitors:
      protocolName: onvif
      configData:
          url: 192.168.168.64:80
          userName: admin
          password: /etc/secret/password
          dataType: string视频流数据处置处罚

新版本增强 Mapper-Framework 数据面能力,内置流数据处置处罚功能。用户能够在 device-instance 文件中进行配置,将边缘摄像头设备上报的视频流截取保存为视频片段文件以及视频帧文件,流数据处置处罚的 device-instance 文件示例如下:
apiVersion: devices.kubeedge.io/v1beta1
kind: Device
metadata:
name: onvif-device-01
...
properties:
- name: saveFrame                  # Convert video stream into frame
    visitors:
      protocolName: onvif
      configData:
      format: jpg                  # Frame file format
      outputDir: /tmp/case/      # Directory for output frame files
      frameCount: 30               # Number of output frames
      frameInterval: 1000000       # Time interval between frames (The unit is nanoseconds)
      dataType: stream
- name: saveVideo                  # Convert video streams into video clips
    visitors:
      protocolName: onvif
      configData:
      frameCount: 1000             # The number of frames the video clip contains
      format: mp4                  # Video clip format
      outputDir: /tmp/case/      # Directory for output video clip
      videoNum: 2                  # Number of video clips
      dataType: stream更多信息可参考:
https://github.com/kubeedge/kubeedge/pull/5448
https://github.com/kubeedge/kubeedge/pull/5514
https://github.com/kubeedge/mappers-go/pull/127
支持边缘子模块自启动

由于配置大概可规复的情况问题,例如进程启动次序等,导致 EdgeCore 启动失败。例如,当 containerd.socket 没有就绪时,Edged 启动 Kubelet 失败会导致 EdgeCore 直接退出。
在新版本中,我们改进了 Beehive 框架,支持边缘子模块重启。用户可以通过启动 moduleRestart featureGates,将 EdgeCore 的子模块设置为自动重启,而不是整个 EdgeCore 退出。
该特性在本版本中作为 Alpha 特性发布,如果你需要使用,您需要配置 moduleRestart 的 featureGates。
apiVersion: edgecore.config.kubeedge.io/v1alpha2
kind: EdgeCore
featureGates:
moduleRestart: true 更多信息可参考:
https://github.com/kubeedge/kubeedge/pull/5513
https://github.com/kubeedge/kubeedge/pull/5514
引入 keadm ctl 命令,支持在边缘查询和重启 pod

当边缘节点离线时,我们无法通过 kubectl 检察边缘节点上的 pod,在 1.17 中可以在边缘节点上通过 keadm ctl get/restart pod 对 pod 进行查询或重启。
如果需要使用该特性,您需要开启 metaserver 开关。

[*]keadm ctl get pod 的可选参数如下:
# keadm ctl get pod -h
Get pods in edge node

Usage:
keadm ctl get pod

Flags:
-A, --all-namespaces   If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace
-h, --help               help for pod
-n, --namespace string   Specify a namespace (default "default")
-o, --output string      Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file, custom-columns, custom-columns-file, wide)
-l, --selector string    Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)

[*]keadm ctl restart pod 的可选参数如下:
# keadm ctl restart pod -h
Restart pods in edge node

Usage:
keadm ctl restart pod

Flags:
-h, --help               help for pod
-n, --namespace string   Specify a namespace (default "default")Demo 演示:# alias kectl='keadm ctl'
# kectl get pod -owide -A
NAMESPACE   NAME                              READY   STATUS    RESTARTS      AGE   IP               NODE       NOMINATED NODE   READINESS GATES
default   nginx-deployment-58b54fbd94-f5q7p   1/1   Running   1 (20m ago)   22m   10.88.0.2      centos-2   <none>         <none>
kubeedge    edge-eclipse-mosquitto-scvrk      1/1   Running   1 (16m ago)   28m   192.168.94.106   centos-2   <none>         <none>

# kectl restart pod -n kubeedge    edge-eclipse-mosquitto-scvrk
393cbcac4b484a4a28eee7dd2d63b33137a10a84d5f6eed6402b9a23efc6aef0
af4059137ced56b365da7e1c43d3ea218e3090ab7644a105651ca4661ddf26f0

# kectl get pod -owide -A
NAMESPACE   NAME                              READY   STATUS    RESTARTS      AGE   IP               NODE       NOMINATED NODE   READINESS GATES
default   nginx-deployment-58b54fbd94-f5q7p   1/1   Running   1 (21m ago)   23m   10.88.0.2      centos-2   <none>         <none>
kubeedge    edge-eclipse-mosquitto-scvrk      1/1   Running   2 (10s ago)   29m   192.168.94.106   centos-2   <none>         <none>更多信息可参考:
https://github.com/kubeedge/kubeedge/pull/5535
https://github.com/kubeedge/kubeedge/pull/5504
易用性提拔:基于 Keadm 的部署能力增强


[*]将命令 keadm generate 更改为 keadm manifest;
# keadm --help|grep manifest
manifest    Checks and generate the manifests.

example:
# keadm manifest --advertise-address=<cloud-ip> --profile version=v1.17.0

[*]在 keadm join 添加一个镜像堆栈参数: image-repository,以支持自定义镜像堆栈;
# keadmjoin -h|grep image-repository
      --image-repository string          Use this key to decide which image repository to pull images from

example:
# keadm join --cloudcore-ipport <cloud-ip>:10000 --kubeedge-version=1.17.0 --remote-runtime-endpoint=unix:///run/cri-dockerd.sock --image-repository my.harbor.cn/kubeedge --token xxxx

[*]将 keadm reset 命令进行三级拆分,拆分成 keadm reset cloud 和 keadm reset edge, keadm reset 仍然被保留,使用时 cloudcore 和 edgecore 都会被卸载,新增的三级命令 keadm reset cloud 和 keadm reset edge 分别只卸载 cloudcore 和 edgecore。
# keadmreset --help
...
Available Commands:
cloud       Teardowns CloudCore component
edge      Teardowns EdgeCore component
Flags:
      --force                Reset the node without prompting for confirmation
-h, --help               help for reset
      --kube-config string   Use this key to set kube-config path, eg: $HOME/.kube/config (default "/root/.kube/config")

# keadmreset cloud --help
...
Flags:
      --force                Reset the node without prompting for confirmation
-h, --help               help for cloud
      --kube-config string   Use this key to set kube-config path, eg: $HOME/.kube/config (default "/root/.kube/config")

# keadmreset edge --help
...
Flags:
      --force   Reset the node without prompting for confirmation
-h, --help    help for edge更多信息可参考:
https://github.com/kubeedge/kubeedge/issues/5317
https://github.com/kubeedge/kubeedge/pull/5462
https://github.com/kubeedge/kubeedge/pull/5463
https://github.com/kubeedge/kubeedge/pull/5540
Mapper 框架添加 MySQL 数据库

在 1.17 的 Mapper-Framework 中,数据推送模块新增了 MySQL 数据库,如果用户想使用 MySQL 作为某个 property 的 PushMethod,可以在 device instance 的对应 property 下, 通过如下配置即可:apiVersion: devices.kubeedge.io/v1beta1
kind: Device
...
spec:
properties:
    - name: xxx
      ...
      pushMethod:
      dbMethod:
          mysql:
            mysqlClientConfig:
            addr: 127.0.0.1:3306    #the url to connect to the mysql database.
            database: kubeedge      #database name
            userName: root          #user name更多信息可参考:https://github.com/kubeedge/kubeedge/pull/5376
升级 K8s 依赖到 v1.28

新版本将依赖的 Kubernetes 版本升级到 v1.28.6,您可以在云和边缘使用新版本的特性。更多信息可参考:https://github.com/kubeedge/kubeedge/pull/5412
版本升级注意事项

自 v1.17.0 起,我们推荐在使用 keadm 安装 KubeEdge 时使用 --kubeedge-version= 来指定具体版本,--profile version= 会渐渐废弃。
致谢

感谢 KubeEdge 社区技术引导委员会 (TSC)、各 SIG 成员对 v1.17 版本开发的支持与贡献,未来 KubeEdge 将一连在新场景探索与支持、稳固性、安全性、可扩展性等方面一连发展与演进!
相关链接

Release Notes:https://github.com/kubeedge/kubeedge/blob/master/CHANGELOG/CHANGELOG-1.17.md
 
点击关注,第一时间了解华为云奇怪技术~
 

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: KubeEdge v1.17.0发布!数据处置处罚能力与易用性全面提拔