Akri, an open source project for establishing connections between Kubernetes and edge computing

Akri allows you to easily expose heterogeneous leaf devices (such as IP cameras and USB devices) as resources in a Kubernetes cluster. It also supports the disclosure of embedded hardware resources (such as GPUs and FPGAs). Akri constantly detects the nodes that have access to these devices and schedules workloads based on these nodes.

Why Akri

At the edge, there are various sensors, controllers, and MCU-like devices that are generating data and performing actions. In order to make Kubernetes a viable edge computing solution, Kubernetes clusters need to easily utilize these heterogeneous “leaf devices”. However, many of these leaf devices are too small to run Kubernetes on their own. Akri is an open source project that exposes these leaf devices as resources in the Kubernetes cluster. It utilizes and extends the Kubernetes device plug-in framework, which is created with the cloud in mind and focuses on static resources such as GPUs and other system hardware. Akri took this framework and applied it to the edge, which contains a set of leaf devices with unique communication protocols and intermittent availability.

Akri is designed for the edge and can handle the dynamic creation and destruction of leaf devices. Akri provides an abstraction layer similar to CNI, but it does not abstract the underlying network details. The operator only needs to apply the Akri configuration to the cluster to specify the discovery protocol (such as ONVIF) and the Pod that should be deployed (such as a video frame server). Then Akri will do the rest. Operators can also allow multiple nodes to use branch devices to provide high availability when the node is offline. In addition, Akri will automatically create Kubernetes services for each type of leaf device (or Akri Configuration), eliminating the need to use applications to track the status of Pods or nodes.

Most importantly, Akri is built to be extensible. We currently have ONVIF and udev discovery protocols, and are working hard to implement OPC UA, and community members can easily add more protocols. The more protocols Akri supports, the wider the range of leaf devices that Akri can discover.

How Akri works

Akri’s architecture consists of four key components:

  • Akri Configuration CRD
  • Akri Instance CRD
  • Agent (implemented by a device plug-in)
  • A custom controller
  • Agent (implemented by a device plug-in)
  • A custom controller

You can name it in the first custom resource Akri Configuration. This tells Akri which device to look for. Akri’s device plugin implementation uses Akri Instance, Akri’s second custom resource, to find devices and track their availability. After finding the device, Akri Controller can help you use it. It looks at each Akri instance (representing a leaf device) and deploys a “broker” Pod that knows how to connect to resources and use them.

Image for post
Image for post

Example

We use an official example to deepen our understanding of Arki. As an example of handling dynamic shared leaf devices, an implementation has been created for the ONVIF camera protocol. ONVIF is a standard used by many IP cameras. It defines the discovery and access of RTSP camera streams. In addition to the protocol implementation for ONVIF, Akri also provides ONVIF configuration and sample broker (akri-onvif-video-broker), which acts as a frame server. Use Akri’s default ONVIF configuration to discover and utilize ONVIF cameras as follows.

Image for post
Image for post
  • The operator applies the ONVIF configuration to the cluster.
  • Akri Agent uses the ONVIF protocol to discover IP cameras and creates an instance for each discovered camera.
  • The Akri controller will see the instance and deploy the akri-onvif-video-broker pod specified in the configuration. The controller will also create a Kubernetes service for each ONVIF camera and a service for all ONVIF cameras.

The operator applies the ONVIF configuration to the cluster.

Akri Agent uses the ONVIF protocol to discover IP cameras and creates an instance for each discovered camera.

The Akri controller will see the instance and deploy the akri-onvif-video-broker pod specified in the configuration. The controller will also create a Kubernetes service for each ONVIF camera and a service for all ONVIF cameras.

The project is led by Microsoft’s open source, which can perfectly cooperate with k3s and other edge frameworks based on k8s. The project implementation language is rust.

Written by

Digital Nomad

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store