Discovering and Using Authentication-Enabled Onvif Cameras
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 flow below.
Preparation
Add Akri helm chart repo and set the environment variable AKRI_HELM_CRICTL_CONFIGURATION to proper value.
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.
See the cluster setup steps for information on how to set the crictl configuration variable AKRI_HELM_CRICTL_CONFIGURATION
In real product scenarios, the device uuids are acquired directly from the vendors or already known before installing Akri Configuration. If you already know the device uuids, you can skip this and go to the next step.
First use the following helm chart to deploy an Akri Configuration and see if your camera is discovered.
Here 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.
$ kubectl get nodes,akric,akrii,pods
NAME STATUS ROLES AGE VERSION
node/kube-01 Ready control-plane 22d v1.26.1
node/kube-02 Ready <none> 22d v1.26.1
node/kube-03 Ready <none> 22d v1.26.1
NAME CAPACITY AGE
configuration.akri.sh/akri-onvif 3 62s
NAME CONFIG SHARED NODES AGE
instance.akri.sh/akri-onvif-029957 akri-onvif true ["kube-03","kube-02"] 48s
NAME READY STATUS RESTARTS AGE
pod/akri-agent-daemonset-gnwb5 1/1 Running 0 62s
pod/akri-agent-daemonset-zn2gb 1/1 Running 0 62s
pod/akri-controller-deployment-56b9796c5-wqdwr 1/1 Running 0 62s
pod/akri-onvif-discovery-daemonset-wcp2f 1/1 Running 0 62s
pod/akri-onvif-discovery-daemonset-xml6t 1/1 Running 0 62s
pod/akri-webhook-configuration-75d9b95fbc-wqhgw 1/1 Running 0 62s
pod/kube-02-akri-onvif-029957-pod 1/1 Running 0 48s
pod/kube-03-akri-onvif-029957-pod 1/1 Running 0 48s
Get the device uuid from the Akri Instance. 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.
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.
SSH port forwarding can be used to access the streaming application. Open 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.
ssh someuser@<machine IP address> -L 50000:localhost:<streaming-app-port>
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
kubectldelete-f/tmp/akri-video-streaming-app.yaml
Delete the Secret information
kubectldelete-f/tmp/onvif-auth-secret.yaml
Delete deployment and Akri installation to clean up the system.