Application Deployment
Definition of terms
Container application: It is an application composed of container service configuration and data volume configuration.
Function application: It is an application composed of function service configuration and data volume configuration.
Feature Introduction
You can use the application to define the deployment task on one or a group of edge nodes. It will distribute the Service Configuration and Storage Volume Configuration to the matching target devices and deploy them. The application matches the target device according to the tag of edge nodes. Every change in the application information will be distributed to the target device automatically, the service will be redeployed, and the configuration will be updated.
The application consists of Container Application and Function Application.
Usage Process
There are two ways to create an application process, i.e., create a Container Application process and create a Function Application process.
Application list
It will display all application information under the current instance on the Application List page.
Click Application Deployment on the left menu of the Instance Details page, and you will see the interface as follows.
The search box in the upper right corner supports the fuzzy query of the application name.
Create container application
Basic information
Click Create Application on the Application List page to enter the Create page.
Fill in the Basic Information of the application.
- [Name] indicates the name of the application, which cannot be empty or duplicated.
- [Application Type] indicates the type of application, and the container application is selected here.
- [Description] indicates the literal description of the application.
- [Tag] indicates the information used to identify the application.
Click Add Tag to enter the Tag Setting page and fill in the application tag.
Service Configuration
Click Next to enter the Service Configuration interface.
Click Add Service to enter the Service Configuration page.
Fill in the Basic Information of container service.
- [Name] represents the name of service, which cannot be empty. The service names in the same application cannot be duplicated. If different applications with the same service name are deployed to the same node, it will cause that one of the deployed applications reports an error.
- [Image Address] indicates the image address corresponding to the service, which cannot be empty. This address shall be filled in the image address that can be retrieved through docker on the edge node (device).
- [Volume Configuration] represents the storage volume information mounted by the container, which supports the mount of three volumes, such as hostPath, configuration item, and ciphertext. hostPath: Mount the host directory to the container directory. Configuration item: the configuration information in the configuration management. Ciphertext: The ciphertext in the configuration management. The configuration item is created here, the ciphertext is created here, and the certificate is created here.
- [Port Mapping] represents the port mapping between container and host, and the TCP and UDP port mappings are supported.
Click Add Volume to configure the volume.
Click Port Mapping to configure the port mapping.
If you need more configuration, click Advanced Settings at the bottom of the page to enter the configuration settings.
Fill in Advanced Settings.
- [Number of Copies] represents the number of containers started by the service.
- [Environment Variable] represents the environment variable of the service container.
- [Startup Parameter] represents the parameters of service during startup.
- [Resource Constraint] represents the resource constraint for starting the service container. At present, it supports the CPU and memory settings.
- [Host Network] represents whether the service container uses the host network, and the bridge network is used by default.
- [Privilege Option] represents whether the resource is mounted in the privilege mode. In general, it is set to yes for the camera, GPU, or FPGA to be accessed with high privilege.
At this point, the Service Configuration is set successfully. Click OK to close the Service Configuration interface.
If you need to set the image credential, click Import Credential to enter the Import Credential interface.
Fill in Image Registry Credential.
- 【Image Registry Credential】 represents the credential information required to retrieve the image. In general, it is used for the configuration of image registry that requires the credential, and the image registry credential is created here.
Target device
After the Service Configuration is set successfully, click Next to enter the Target Device Matching interface.
Click Match Tag to pop up the Tag Matching interface.
Enter the name and value of the node tag to be matched, and click OK< to match the eligible nodes automatically.
Click Create to complete the creation of an application and jump to the Application List interface, and then you can see the application information created just now.
The creation steps of Container Application are completed.
Create function application
Basic information
Click Create Application on the Application List page to enter the Create page.
Fill in the Basic Information of the application.
- [Name] indicates the application name, which cannot be empty or duplicated.
- [Application Type] represents the type of application, and the function application is selected here.
- [Description] indicates the literal description of the application.
- [Tag] indicates the information used to identify the application.
Click Add Tag to enter the Tag Setting page and fill in the application tag.
Function Service
Click Next to enter the Function Service interface.
Click Add Service to enter the Service Configuration page.
Fill in the Basic Information of function service.
- [Name] represents the name of function service, which cannot be empty. The service names in the same application cannot be duplicated. If different applications with the same service name are deployed to the same node, it will cause that one of the deployed applications reports an error.
- 【Function Configuration Item】 represents that the pre-configured function is selected in the configuration management, and the function configuration is created [here](IoTCore/Operation Guide/IoT Edge/Configuration Management/Function.md).
- [Runtime] represents the function runtime environment to be selected. At present, the python3, nodejs10, and SQL runtime environments are supported.
- [Function List] represents to set the call entry of functions selected in the function configuration item, and the multiple function calls are supported.
The Function Name is unique in the【Function List】. We can access this function service through Function Service Name/Function Name. The Function Entry represents the execution function. The Python/Node runtime consists of function script and handler name. The SQL runtime consists of function script only. It is the SQL statement written by users in the function script. The Container Directory represents the path of code. For example, we write the following configuration in the function configuration item:
index.js is the function script, hander is the process function, and index.js is in the root directory of the configuration item. And then, we introduce this function in the function list:
After that, we can call this function through the test-node/process interface in the cloud. test-node is the service name, and the process is the function name in the function list.
For the SQL runtime, the configuration is slightly different as shown below:
Fill in Advanced Settings.
- [Number of Copies] represents the number of containers started by the service.
- [Volume Configuration] represents the directory of containers for storing the configuration function.
- [Resource Constraint] represents the resource constraint for starting the service container. At present, it supports the CPU and memory settings.
At this point, the Function Service is set successfully. Click OK to close the Service Configuration interface.
Target device
Click Next to enter the Target Device Matching interface.
Click Match Tag to pop up the Tag Matching interface.
Enter the name and value of the node tag to be matched, and click OK< to match the eligible nodes automatically.
Click Create to complete the creation of an application and jump to the Application List interface. Then, you can see the application information created just now.
The creation steps of Function Application are complete.
Modify application
Click "Prepare to Modify Application Name or View on the Application List page. For example, click function-test to enter the Application Details page.
Refer to the application's new function for modification operation.
Note: After the application modification, the latest application configuration will be automatically distributed to the matching edge node and updated.
Delete application
Click the Delete button behind the application to be deleted on the Application List page.
Application Deployment
After the application creation, you need to know the deployment of the application in the edge node. Open the Application Details page.
Click Node Name in Target Node, and jump to the Node Details page. The edge node is created [here](IoTCore/Operation Guide/IoT Edge/Node Management.md).
If the current Edge Node is not installed on the device, click the Install button to pop up the installation command window. The following will take the edge device running k3s and docker as an example:
If failed to install k3s on the edge device, copy the docker installation command and execute the docker installation. Then, copy the k3s installation command for installation and the node installation command to execute it on the device. Note: You need to the device to the network, the device can access our cloud service, and k3s is installed on the device. If k8s and docker have been installed on the device, copy the node installation command directly and execute it on the device.
The following will take the installation method of edge device installed with k3s and docker as an example:
You may need to enter the user password during the installation.
After the installation, you can see that you have deployed the application.