IndustryFusion SmartBox Gateway Setup and Onboarding Gateway Devices - IndustryFusion/IndustryFusion GitHub Wiki
This Framework Blueprint for Onboarding Gateway Devices for Industry Fusion.
In order to setup and onboard assets on your gateway you need to do the following: (for access ask Konstantin):
GitHub repos:
platform-launcher (public repo)
Docker Hub:
OISP Platform:
https://platform.industry-fusion.com
Install the Lightweight Kubernetes k3s on gateway (root rights required). For further information on k3s visit https://k3s.io/. Note: Currently each SmartBox-Gateway is used as k3s master. In future versions a local k3s cluster of the gateways on the shopfloor will be used.
curl -sfL https://get.k3s.io | sh -
# Check for Ready node,
takes maybe 30 seconds
k3s kubectl get node
kubectl create namespace oisp-devices
kubectl -n oisp-devices create secret docker-registry regcred --docker-server=docker.io --docker-username=YOUR_DOCKER_USERNAME --docker-password=YOUR_DOCKER_PASSWORD [email protected]
sudo apt install python3
sudo apt install python3-pip
pip3 install -r requirements.txt
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=2592000'
Get access to OISP Platform Dashboard.
- Clone this repository under your gateway. oisp-iot-agent git repo(Checkout "development" branch)
- Browse to the 'oisp-iot-agent/container/kubernetes/onboarding/' directory.
- gatewaydeployment.yaml is the sample gateway device onboarding config repo description file.
- Exchange default config.json through IndustryFusion config.json This will set hosts for rest, ws and mqtt correctly.
- Create app_config.yaml which should consist of OISP Instance URL and APP Version. Sample app_config.yaml description:
BASE_OISP_INSTANCE: <OISP_BASE_URL>
API_VERSION: <vX/api>
- Create gatewaydeployment.yaml which should consist of Application Name, Deployment Config, Machine Config details for this framework to parse and deploy the devices you want to onboard connected to your gateway. Sample gatewaydeployment.yaml description:
version: <DEPLOYMENT_YAML_VERSION_NUMBER>
namespace: <NAMESPACE_FOR_ALL_DEPLOYMENTS>
CreateDeployments:
- ApplicationName: <DEPLOYMENT_NAME>
NodeName: <K3S_NODE_NAME>
ToolVersion: <TOOL_VERSION>
DeploymentConfig:
URL: <DEPLOYMENT_GIT_CONFIG_URL>
Directory: <DEPLOYMENT_CONFIG_GIT_DIRECTORY_NAME>
GitTag: <DEPLOYMENT_GIT_TAG_OR_COMMITID_OR_BRANCH>
MachineConfig:
URL: <MACHINE_GIT_CONFIG_URL>,
Directory: <MACHINE_CONFIG_GIT_DIRECTORY_NAME>,
GitTag: <MACHINE_CONFIG_TAG_OR_COMMITID_OR_BRANCH>
- Please export KUBECONFIG to correct k3s_cluster_config.yaml
export KUBECONFIG=/home/tk/src/tools/oisp-iot-agent/container/kubernetes/onboarding/k3s_cluster_config.yaml
- Initiate the Deployment process based on three actions; create, update or delete. (deviceonboarding.py can be found here: https://github.com/Open-IoT-Service-Platform/oisp-iot-agent/tree/development/container/kubernetes/onboarding )
python3 deviceonboarding.py --action create --deployfilepath gatewaydeployment.yaml
OR
python3 deviceonboarding.py -a create -d gatewaydeployment.yaml
===================================================================================
python3 deviceonboarding.py --action update --deployfilepath gatewaydeployment.yaml
OR
python3 deviceonboarding.py -a update -d gatewaydeployment.yaml
===================================================================================
python3 deviceonboarding.py --action delete --deployfilepath gatewaydeployment.yaml
OR
python3 deviceonboarding.py -a delete -d gatewaydeployment.yaml
- Once the onboarding script it initiated it will ask you for OISP platform credentials.
Gateway:~/tools $python3 deviceonboarding.py --action delete --deployfilepath gatewaydeployment.yaml
Deleting Pods....
Enter OISP User Credentials
Username: [email protected]
Password:
Namespace oisp-devices already exists. Continue.
configmap "global-devices-config" deleted
configmap/global-devices-config created
secret "global-devices-secret" deleted
...........
- After Onboarding is complete you can see the deployment pod status using following command. Below is the current gateway onboarding status with Gateway and Machine connected to it.
kubectl -n oisp-devices get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
plasmacutter-mcc-58997d79c5-lgj79 4/4 Running 9 41d 10.42.0.120 tkgw00 <none> <none>
gasversorgung-5b96458747-zhqlq 4/4 Running 0 12d 10.42.2.95 tkgw04 <none> <none>
lasercutter-74d76dff95-csrll 4/4 Running 0 12d 10.42.3.123 tkgw06 <none> <none>
filteringunit-5c89579b78-64rpm 4/4 Running 0 12d 10.42.1.80 tkgw03 <none> <none>
airtracker-5d8c6b999b-vb98v 4/4 Running 4 7d11h 10.42.4.70 tkgw07 <none> <none>
plasmacutter-df8cbcb69-vjbnl 4/4 Running 3 12d 10.42.3.122 tkgw06 <none> <none>
- Get detailed information on pods and containers (exchange with correct name of pod and container e.g. oisp-iot-agent)
kubectl -n oisp-devices describe pods airtracker-deployment-testsensor-7b5bcfb77d-5knnf
kubectl -n oisp-devices logs airtracker-deployment-testsensor-7b5bcfb77d-w55dk oisp-iot-agent