or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
Akri Bug Bash - September 2023
tags:
Bug Bash
The goal of this bug bash is to discover any bugs before Akri creates a new release (v0.13.1). This release contains changes for agent refactory and directly using kube-rs client structure in the agent.
Please leave a comment in the scenario outcomes section with the scenario's you tested and whether it was successful. If you find issues, please create an issue on Akri's GitHub and comment it in the discovered issues section.
As always, feel free to post any questions on Akri's Slack.
Background
Akri is an Open Source project that automates the discovery and usage of IoT devices around Kubernetes clusters on the Edge. Akri can automatically deploy user-provided workloads to the discovered devices. It handles device appearance and disappearance, allowing device deployments to expand and contract and enabling high resource utilization.
Setting Up an Environment
Akri is regularly tested on K3s, MicroK8s, and standard Kubernetes clusters versioned 1.28-1.31 (see previous release for list of exact versions tested) with Ubuntu 20.04 node. While we only test on these K8s distributions, feel free to try it out on the distribution and Linux OS of your choice. Here are some examples of what you can do:
It is recommmended to setup a muli-node cluster as your test environment. The following bug bash scenarios are using 3-node cluster as an example.
Scenarios
Choose any of the following scenarios (none are pre-requisite of the others). Make sure to use the akri-dev chart (
helm install akri akri-helm-charts/akri-dev
) when installing Akri with Helm. If you have previously installed akri, be sure to runhelm repo update
.Scenario A: Validate the configuration-level resource support with debug echo
Set up the Kubernetes distribution being used, here we use 'k8s', make sure to replace it with a value that matches the Kubernetes distribution you used. Refer to Kubernetes Cluster Setup | Akri for details.
Install an Akri configuration named
akri-debug-echo-foo
that uses debug echo discovery handlerThe command installs an Akri configuration with debug echo discovery handler, which will discover 2 debug echo devices (
foo0
andfoo1
), capacity is5
, each pod request1
instance-level resource.Here is the result of running the installation command above on a cluster with 1 control plane and 2 work nodes. There are 2 pods running on each node.
Request configuration-level resources exceeds the limit
Now deploy a deployment that requests 3 configuration-level resources in a container, since only 2 instances are available, the deployment will be in 'Pending' state.
Create a yaml file
nginx-deployment-3-resource.yaml
to deploy a DeploymentDeploy the deployment and check the pod status, it should be in
Pending
state due to insufficient resources.Delete the deployment
Request configuration-level resources within the limit
Now deploy a deployment that requests 1 configuration-level resources in a container, the deployment should succeed.
Copy the yaml and save it to a file named
nginx-deployment-1-resource.yaml
Deploy the deployment and check the pod status, the pod should be in
Running
state.Configuration-level resources and instance-level resources share the same set of device usage slots, so if in the Configuration the capacity is 5 and 2 devices are discovered, then the total number of virtual devices can be used is
5 * 2 = 10
. Total allocated configuration-level resource + allocated instance-level resource cannot exceed 10. If the requested resource count exceeds the available resource count, the pod will be pending waiting for resource becomes available.We can check the resource usage on each node to see the Configuration-level and Instance-level resource number. In the example below, the Configuration-level resource is allocated on node
kube-03
andit's mapped to Instance
akri-debug-echo-foo-8120fe
, so the Allocatable resource forakri-debug-echo-foo-8120fe
is 3 (5 - 1 Instance-level - 1 Configuration-level). Compare it to the allocatable resource number of Instanceakri-debug-echo-foo-a19705
(4, 5 - 1 Instance-level) that only 1 resource claimed at Instance-level.Clean up
Delete deployment and Akri installation to clean up the system.
Scenario B: Passing credentials to discover authenticated devices
Make sure you have at least one Onvif camera that is reachable so Onvif discovery handler can discovery your Onvif camera. To test accessing Onvif with credentials, make sure your Onvif camera is authentication-enabled. Write down the username and password, they are required in the test flow.
Acquire Onvif camera's device uuid
First use the following helm chart to deploy an Akri Configuration that uses ONVIF discovery handler and see if your camera is discovered.
Set up the Kubernetes distribution being used, here we use 'k8s', make sure to replace it with a value that matches the Kubernetes distribution you used
Install an Akri configuration named
akri-onvif
that uses debug echo discovery handlerHere is the result of running the installation command above on a cluster with 1 control plane and 2 work nodes. There is one Onvif camera connects to the network, thus 1 pods running on each node.
Dump the environment variables from the container to check the device uuid from the container's environment variables. Below is an example, the Onvif discovery handler discovers the camera and expose the device's uuid. Write down the device uuid for later use. Note that in real product scenarios, the device uuids are acquired directly from the vendors or already known before installing Akri Configuration.
Set up Kubernetes secrets
Now we can set up the credential information to Kubernetes Secret. Replace the device uuid and the values of username/password with information of your camera.
Upgrade the Akri configuration
Upgrade the Akri Configuration to include the secret information and the sample video broker container.
With the secret information, the Onvif discovery handler is able to discovery the Onvif camera and the video broker is up and running
Deploying the sample video streaming application
Deploy the sample video streaming application Instructions described from the step 4 of camera demo
Deploy a video streaming web application that points to both the Configuration and Instance level services that were automatically created by Akri.
Copy and paste the contents into a file and save it as
akri-video-streaming-app.yaml
Deploy the video stream app
Determine which port the service is running on. Save this port number for the next step:
SSH port forwarding can be used to access the streaming application. In a new terminal, enter your ssh command to to access your machine followed by the port forwarding request. The following command will use port 50000 on the host. Feel free to change it if it is not available. Be sure to replace
<streaming-app-port>
with the port number outputted in the previous step.Navigate to http://localhost:50000/ using browser. The large feed points to Configuration level service, while the bottom feed points to the service for each Instance or camera.
Clean up
Close the page http://localhost:50000/ from the browser
Delete the sample streaming application resources
Delete the Secret information
Delete deployment and Akri installation to clean up the system.
Scenario C: Documentation Walkthrough
It would be great to walk through the documentation with the bug bash and note which changes to docs we would need to make. There are some pending PRs on the documentations as well that go with the release.
Discovered Issues or Enhancements
Scenario Outcomes
Please write the environment you used (Kubernetes distro/version and VM), the scenarios you tested, and whether it was a success or had issues.