Requesting Akri Resources
Akri discovers tiny devices, advertizes them as resources, and automatically deploys workloads to utilize those devices. The latter functionality is optional. You can use Akri solely to discover and advertize devices by omitting a broker pod image from a Configuration. Then, you can schedule your own pods, requesting the discovered Akri Instances (which represent each tiny device) as resource limits.
Lets walk through how this works, using the ONVIF Discovery Handler as an example. Install Akri with the ONVIF Discovery Handler and Configuration, omitting a broker pod image.
Note: See the cluster setup steps for information on how to set the crictl configuration variable
AKRI_HELM_CRICTL_CONFIGURATION
After installing Akri and your Configuration, list all discovered instances by running kubectl get akrii
. Note akrii
is a short name for Akri Instance. All the instances will be named in the format <configuration-name>-<id>
, where id
varies whether or not the device is sharable or visible by multiple nodes.
For unshared devices,
id
is a hash of a descriptor of the device and the name of the node that can see the device. For example, theid
of an Instance representing a usb camera at devnode/dev/video0
on a node named workerA would behash(/dev/video0workerA)
.For shared devices,
id
is only a hash of the descriptor of the device. This way, all agents create or modify an Instance with the same name for the same device. For example, since IP cameras are sharable, theid
for an IP camera would behash(uri)
.
You can change the name of the Configuration and resultant Instances to be onvif-camera
by adding --set onvif.configuration.name=onvif-camera
to your installation command. Now, you can schedule pods that request these Instances as resources. Assuming the Configuration name has been set to onvif-camera
, you can request the onvif-camera-<id>
Instance as a resource by adding the following to the PodSpec of your Deployment or Job:
As an example, a Deployment that would deploy an nginx broker to one of the devices discovered by the ONVIF Discovery Handler may look like this:
Apply your Deployment to the cluster and watch the broker start to run. If you inspect the Instance of the resource you requested in your deployment, you will see one of the slots has now been reserved by the node that is currently running the broker.
Requesting resources at Configuration level
Akri also exposes all discovered devices as resources at Configuration level. Configuration level resources can be referred by the name of Configuration. With Configuration-level resources, instead of needing to know the specific Instances id onvif-camera-<id>
to request, you can use Configuration name <configuration-name>
to requst resources. Agent will behind the scenes do the work of selecting which Instances to reserve.
Last updated