12 Akri #
Akri is a CNCF-Sandbox project that aims to discover leaf devices to present those as Kubernetes native resource. It also allows scheduling a pod or a job for each discovered device. Devices can be node-local or networked, and can use a wide variety of protocols.
Akri’s upstream documentation is available at: https://docs.akri.sh
12.1 How does SUSE Edge use Akri? #
Akri is currently tech-preview in the SUSE Edge stack.
Akri is available as part of the Edge Stack whenever there is a need to discover and schedule workload against leaf devices.
12.1.1 Installing Akri #
Akri is available as a Helm chart within the Edge Helm repository. The recommended way of configuring Akri is by using the given Helm chart to deploy the different components (agent, controller, discovery-handlers), and then use your preferred deployment mechanism to deploy Akri’s Configuration CRDs.
12.1.2 Configuring Akri #
Akri is configured using a akri.sh/Configuration
object, this object takes in all information about how to discover the devices, as well as what to do when a matching one is discovered.
Here is an example configuration breakdown with all fields explained:
apiVersion: akri.sh/v0
kind: Configuration
metadata:
name: sample-configuration
spec:
This part describes the configuration of the discovery handler, you have to specify its name (the handlers available as part of Akri’s chart are udev
, opcua
, onvif
).
The discoveryDetails
is handler specific, refer to the handler’s documentation on how to configure it.
discoveryHandler:
name: debugEcho
discoveryDetails: |+
descriptions:
- "foo"
- "bar"
This section defines the workload to be deployed for every discovered device.
The example shows a minimal version of a Pod
configuration in brokerPodSpec
, all usual fields of a Pod’s spec can be used here.
It also shows the Akri specific syntax to request the device in the resources
section.
You can alternatively use a Job instead of a Pod, using the brokerJobSpec
key instead, and providing the spec part of a Job to it.
brokerSpec:
brokerPodSpec:
containers:
- name: broker-container
image: rancher/hello-world
resources:
requests:
"{{PLACEHOLDER}}" : "1"
limits:
"{{PLACEHOLDER}}" : "1"
These two sections show how to configure Akri to deploy a service per broker (instanceService
), or pointing to all brokers (configurationService
).
These are containing all elements pertaining to a usual Service.
instanceServiceSpec:
type: ClusterIp
ports:
- name: http
port: 80
protocol: tcp
targetPort: 80
configurationServiceSpec:
type: ClusterIp
ports:
- name: https
port: 443
protocol: tcp
targetPort: 443
The brokerProperties
field is a key/value store that will be exposed as additional environment variables to any pod requesting a discovered device.
The capacity is the allowed number of concurrent users of a discovered device.
brokerProperties:
key: value
capacity: 1
12.1.3 Writing and deploying additional Discovery Handlers #
In case the protocol used by your device isn’t covered by an existing discovery handler, you can write your own using this guide
12.1.4 Akri Rancher Dashboard Extension #
Akri Dashboard Extension allows you to use Rancher Dashboard user interface to manage and monitor leaf devices and run workloads once these devices are discovered.
Once the extension is installed you can navigate to any Akri-enabled managed cluster using cluster explorer. Under Akri navigation group you can see Configurations and Instances sections.
The configurations list provides information about Configuration Discovery Handler and number of instances. Clicking the name opens a configuration detail page.
You can also edit or create a new Configuration. Extension allows you to select discovery handler, set up Broker Pod or Job, configure Configuration and Instance services and set the Configuration capacity.
Discovered devices are listed in the Instances list.
Clicking the Instance name opens a detail page allowing to view the workloads and instance service.