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.
helm repo add akri-helm-charts https://project-akri.github.io/akri/
helm install akri akri-helm-charts/akri \
--set onvif.discovery.enabled=true \
After installing Akri and your Configuration, list all discovered instances by running
kubectl get akrii. Note
akriiis a short name for Akri Instance. All the instances will be named in the format
idvaries whether or not the device is sharable or visible by multiple nodes.
- 1.For unshared devices,
idis a hash of a descriptor of the device and the name of the node that can see the device. For example, the
idof an Instance representing a usb camera at devnode
/dev/video0on a node named workerA would be
- 2.For shared devices,
idis 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, the
idfor an IP camera would be
You can change the name of the Configuration and resultant Instances to be
--set onvif.configuration.name=onvif-camerato 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:
- name: onvif-camera-broker
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.
kubectl apply -f deployment-requesting-onvif-camera.yaml
kubectl get akrii onvif-camera-<id> -o yaml