NamespaceIndex2 as specified in the OPC UA Configuration. The server will publish any time the value of that variable changes.
ca_crl). Specify the file paths such that they point to the credentials made in the previous section.
--set opcua.configuration.mountCertificates='true', the secret named
opcua-broker-credentialswill be mounted into the OPC UA monitoring brokers. It is mounted to the volume
mountPath/etc/opcua-certs/client-pki, as shown in the OPC UA Configuration Helm template. This is the path where the brokers expect to find the certificates.
Quickstarts.ReferenceServer.Config.xml. This application configuration file is where many features can be configured, such as the application description (application name, uri, etc), security configuration, and base address. Only the latter needs to be modified if using no security. On lines 76 and 77, modify the address of the server, by replacing
localhostwith the IP address of the machine the server is running on. If left as
localhostthe application will automatically replace it with the hostname of the machine which will be unreachable to the broker pod. On the same lines, modify the ports if they are already taken. Akri will preference using the tcp endpoint, since according to the OPC UA Security Specification, secure channels over HTTPS do not provide application authentication.
Quickstarts.Reference.Config.xmlto point to those certificates. After using the OPC UA certificate generator application, your first Server's certificate store folder should be named SomeServer0. In line 17, change the
/path/to/SomeServer0/own. Do the same in lines 24, 30, and 36, replacing
/path/to/SomeServer0. Finally, change the subject name in line 18 to be
CreateAddressSpaceon line 174 of
ReferenceNodeManager.csthat creates the AddressSpace of the OPC UA Server. To review some terms, OPC UA specification defines AddressSpace as the "collection of information that a Server makes visible to its Clients", a Node as "a fundamental component of an AddressSpace", and a Variable as a "Node that contains a value". Let create a thermometer Node which has a temperature variable. On line 195, insert the following:
rootfolder as the parent of the Thermometer node, which is the
CTTfolder created in line 185. The path to our Thermometer node is Server/CTT/Thermometer, making the NamespaceIndex of the Thermometer Node (and its variables) 2. We care about the
NamespaceIndexbecause it along with
Identifier, are the two fields to a
NodeId. If you inspect the
CreateDynamicVariablefunction, you will see that it creates an OPC UA variable, using the
pathparameter ("Thermometer_Temperature") as the
Identifierwhen creating the NodeID for that variable. It then adds the variable to the
m_dynamicNodeslist. At the bottom of
CreateAddressSpacethe following line initializes a simulation that will periodically change the value of all the variables in
variable.Value = GetNewValue(variable);with the following
opcua.discovery.enabled=true. We also specify that we want to create an OPC UA Configuration with
--set opcua.configuration.enabled=true. In the Configuration, any values that should be set as environment variables in brokers can be set in
opcua.configuration.brokerProperties. In this scenario, we will specify the
NamespaceIndexof the NodeID we want the brokers to monitor. In our case that is our temperature variable we made earlier, which has an
2. Finally, since we did not set up a Local Discovery Server -- see Setting up and using a Local Discovery Server in the Extensions section at the bottom of this document to use a LDS -- we must specify the DiscoveryURLs of the OPC UA Servers we want Agent to discover. Those are the tcp addresses that we modified in step 3 of Creating OPC UA Servers. Be sure to set the appropriate IP address and port number for the DiscoveryURLs in the Helm command below. If using security, uncomment
kubectl get crd, and you should see the CRDs listed.
kubectl get akric, and you should see
kubectl get akriiand
kubectl get akrii akri-opcua-monitoring-<ID> -o yaml
DoSimulationfunction in the OPC UA Servers.
<anomaly-app-port>with the port number outputted in the previous step.
Note we've noticed issues with port forwarding with WSL 2. Please use a different terminal.
http://localhost:50000/. It takes 3 seconds for the site to load, after which, you should see a log of the temperature values, which updates every few seconds. Note how the values are coming from two different DiscoveryURLs, namely the ones for each of the two OPC UA Servers.
microk8s add-node. In your new VM, run one of the join commands outputted in the previous step.
capacityfor OPC UA is 1, so by default only one Node is allowed to utilize a device via a broker.
helm upgradecommand to modify our OPC UA Monitoring Configuration such that the capacity is 2. On the control plane node, run the following, once again uncommenting
--set opcua.configuration.mountCertificates='true'if using security. Watch as the broker terminates and then four
microk8s kubectl get no):
opc.tcp://localhost:4840/. This is seen on line 205 of
applicationNameproperty of a server's
ApplicationDescriptionas specified by UA Specification 12). For example, to discover all servers registered with the default LDS except for the server named "SomeServer0", do the following.
NamespaceIndexas environment variables may still suit your needs; however, if targeting one NodeID is too limiting or irrelevant, instead of passing a specific NodeID to your broker Pods, you could specify any other environment variables via
--set opcua.configuration.brokerProperties.KEY='VALUE'. Or, your broker may not need additional information passed to it at all. Decide whether to pass environment variables, what servers to discover, and set the broker pod image to be your container image, say
opcua.configuration.brokerPod.image.tagto specify an image tag (defaults to
helm inspect values akri-helm-charts/akrito see what values of the generic OPC UA Configuration can be customized, such as the Configuration and Instance
capacity, and broker
PodSpec. We saw in the previous section how broker Pod environment variables can be specified via
--set opcua.configuration.brokerProperties.KEY='VALUE'. For more advanced configuration changes that are not aided by the generic OPC UA Configuration Helm chart, such as credentials naming, we suggest downloading the OPC UA Configuration file using Helm and then manually modifying it. See the documentation on customizing an Akri installation for more details.