Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,24 @@ push_images: build
@echo "Pushing the images to docker registry"
docker compose -f $(DOCKER_COMPOSE_FILE) push


# Generate helm packages
.PHONY: gen_helm_charts
gen_helm_charts:
@echo "Generating Helm packages"
@cp -f configs/grafana/* helm/
@cp -f configs/influxdb/config/*.conf helm/
@cp -f configs/influxdb/init-influxdb.sh helm/
@cp -f configs/mqtt-broker/*.conf helm/
@cp -f configs/telegraf/config/*.conf helm/
@cp -f configs/telegraf/entrypoint.sh helm/telegraf_entrypoint.sh
@cp -f configs/time-series-analytics-microservice/config.json helm/
@cp -f configs/nginx/nginx-cert-gen.sh helm/nginx-cert-gen.sh
@cp -f configs/nginx/nginx.conf helm/nginx.conf
@cp -f configs/dlstreamer-pipeline-server/config.json helm/dlstreamer-pipeline-server.json
@sed -i 's/"auto_start": true,/"auto_start": false,/' helm/dlstreamer-pipeline-server.json
@echo "Helm packages generated"

# Help
.PHONY: help
help:
Expand All @@ -183,4 +201,5 @@ help:
@echo " make restart - Restart Docker containers"
@echo " make clean - Remove all stopped containers and unused images"
@echo " make push_images - Push the images to docker registry"
@echo " make gen_helm_charts - Generate Helm packages for the selected sample app"
@echo " make help - Display this help message"
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
# Deploy with Helm

This guide provides step-by-step instructions for deploying the MultiModal - Weld Defect Detection sample application using Helm.

## Prerequisites

- [System Requirements](system-requirements.md)
- K8s installation on single or multi node must be done as prerequisite to continue the following deployment. Note: The Kubernetes cluster is set up with `kubeadm`, `kubectl` and `kubelet` packages on single and multi nodes with `v1.30.2`.
Refer to tutorials such as <https://adamtheautomator.com/installing-kubernetes-on-ubuntu> and many other
online tutorials to setup kubernetes cluster on the web with host OS as Ubuntu 22.04.
- For Helm installation, refer to [helm website](https://helm.sh/docs/intro/install/)

> **Note**
> If Ubuntu Desktop is not installed on the target system, follow the instructions from Ubuntu to [install Ubuntu desktop](https://ubuntu.com/tutorials/install-ubuntu-desktop). The target system refers to the system where you are installing the application.

## Step 1: Generate or download the Helm charts

You can either generate or download the Helm charts.


- To download the Helm charts:

Follow this procedure on the target system to install the package.

1. Download Helm chart with the following command:

`helm pull oci://registry-1.docker.io/intel/multimodal-weld-defect-detection-sample-app --version 1.0.0-weekly`

2. Unzip the package using the following command:

`tar -xvzf multimodal-weld-defect-detection-sample-app-1.0.0-weekly.tgz`

- Get into the Helm directory:

`cd multimodal-weld-defect-detection-sample-app`

- To generate the Helm charts:

```bash
cd edge-ai-suites/manufacturing-ai-suite/industrial-edge-insights-multimodal # path relative to git clone folder

make gen_helm_charts

cd helm/
```

## Step 2: Configure and update the environment variables

1. Update the following fields in `values.yaml` file of the helm chart

```bash
WORK_DIR: # Update with the absolute path to your industrial-edge-insights-multimodal directory
INFLUXDB_USERNAME:
INFLUXDB_PASSWORD:
VISUALIZER_GRAFANA_USER:
VISUALIZER_GRAFANA_PASSWORD:
HTTP_PROXY: # example: http_proxy: http://proxy.example.com:891
HTTPS_PROXY: # example: http_proxy: http://proxy.example.com:891
MTX_WEBRTCICESERVERS2_0_USERNAME:
MTX_WEBRTCICESERVERS2_0_PASSWORD:
HOST_IP: # IP address of server where DL Streamer Pipeline Server is running
```

## Step 3: Install Helm charts

> **Note:**
> 1. Uninstall the Helm charts if already installed.
> 2. Note the `helm install` command fails if the above required fields are not populated
> as per the rules called out in `values.yaml` file.

To install Helm charts, use one of the following options:

```bash
helm install multimodal-weld-defect-detection . -n multimodal-sample-app --create-namespace
```

**Verify Installation:**

> **Note:**
> 1. `deployment-coturn`, `deployment-fusion-analytics`, `deployment-ia-weld-data-simulator` and `deployment-telegraf` pods might restart since its depended on `deployment-mqtt-broker` and `deployment-mediamtx`

Use the following command to verify if all the application resources got installed w/ their status:

```bash
kubectl get all -n multimodal-sample-app
```

## Step 4: Copy the udf package for helm deployment

**DL Streamer Pipeline Server**

To copy your own or existing model into DL Streamer Pipeline Server in order to run this sample application in Kubernetes environment:

The model package is available in the repository at `edge-ai-suites/manufacturing-ai-suite/industrial-edge-insights-multimodal/configs/dlstreamer-pipeline-server/`.

Copy the resources such as video and model from local directory to the to the `dlstreamer-pipeline-server` pod to make them available for application while launching pipelines.

```bash
cd edge-ai-suites/manufacturing-ai-suite/industrial-edge-insights-multimodal/configs/dlstreamer-pipeline-server/

POD_NAME=$(kubectl get pods -n multimodal-sample-app -o jsonpath='{.items[*].metadata.name}' | tr ' ' '\n' | grep deployment-dlstreamer-pipeline-server | head -n 1)

kubectl cp models $POD_NAME:/home/pipeline-server/resources/ -c dlstreamer-pipeline-server -n multimodal-sample-app
```

**Time Series Analytics Microservice**

To copy your own or existing model into Time Series Analytics Microservice in order to run this sample application in Kubernetes environment:

1. The following udf package is placed in the repository under `edge-ai-suites/manufacturing-ai-suite/industrial-edge-insights-multimodal/configs/time-series-analytics-microservice`.

```
- time-series-analytics-microservice/
- models/
- weld_anomaly_detector.cb
- tick_scripts/
- weld_anomaly_detector.tick
- udfs/
- requirements.txt
- weld_anomaly_detector.py
```

2. Copy your new UDF package to the `time-series-analytics-microservice` pod:
```bash
cd edge-ai-suites/manufacturing-ai-suite/industrial-edge-insights-multimodal/configs/time-series-analytics-microservice # path relative to git clone folder
mkdir -p weld_anomaly_detector
cp -r models tick_scripts udfs weld_anomaly_detector/.

POD_NAME=$(kubectl get pods -n multimodal-sample-app -o jsonpath='{.items[*].metadata.name}' | tr ' ' '\n' | grep deployment-time-series-analytics-microservice | head -n 1)

kubectl cp weld_anomaly_detector $POD_NAME:/tmp/ -n multimodal-sample-app
```

> **Note:**
> Run the commands only after performing the Helm install.

## Step 5: Activate the Pipeline/UDF Deployment Package


**DL Streamer Pipeline Server**

You use a Client URL (cURL) command to start the pipeline. Start this pipeline with the following cURL command.

curl -k https://localhost:30001/dsps-api/pipelines/user_defined_pipelines/weld_defect_classification -X POST -H 'Content-Type: application/json' -d '{
"destination": {
"metadata": {
"type": "mqtt",
"topic": "vision_weld_defect_classification"
},
"frame": {
"type": "webrtc",
"peer-id": "samplestream"
}
},
"parameters": {
"classification-properties": {
"model": "/home/pipeline-server/resources/models/weld-defect-classification-f16-DeiT/deployment/Classification/model/model.xml",
"device": "CPU"
}
}
}'

**Time Series Analytics Microservice**

> **NOTE**: UDF inferencing on GPU is not supported.

Run the following command to activate the UDF deployment package:

```bash
curl -k -X 'GET' \
'https://localhost:30001/ts-api/config?restart=true' \
-H 'accept: application/json'
```

## Step 6: Verify the Results

Follow the verification steps in the [Get Started guide](get-started.md#verify-the-weld-defect-detection-results)

## Uninstall Helm Charts

To uninstall Helm charts:

```bash
helm uninstall multimodal-weld-defect-detection -n multimodal-sample-app
kubectl get all -n multimodal-sample-app # It may take a few minutes for all application resources to be cleaned up.
```

## Configure Alerts in Time Series Analytics Microservice

To configure alerts in Time Series Analytics Microservice, follow the steps [here](./how-to-configure-alerts.md#helm-deployment).

## Troubleshooting

- Check pod details or container logs to diagnose failures:
```bash
kubectl get pods -n multimodal-sample-app
kubectl describe pod <pod_name> -n multimodal-sample-app # Shows details of the pod
kubectl logs -f <pod_name> -n multimodal-sample-app # Shows logs of the container in the pod
```

## Known Issues

- The video stream is not rendering in the Grafana.
- Time Series data and Fusion analytics results are initially displayed for the first 2-3 minutes, but then stop updating and no new results are loaded.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,47 @@ docker exec -ti ia-mqtt-broker mosquitto_sub -h localhost -v -t vision_weld_defe
docker exec -ti ia-mqtt-broker mosquitto_sub -h localhost -v -t fusion/anomaly_detection_results -p 1883
```

## Helm Deployment

### Helm - Publish MQTT Alerts

For detailed instructions on configuring and publishing MQTT alerts, refer to the [Publish MQTT Alerts](#docker---publish-mqtt-alerts) section.

### Helm - Subscribe to MQTT Alerts

Follow the steps to subscribe to the published MQTT alerts.

To subscribe to MQTT topics in a Helm deployment, execute the following command:

- Identify the MQTT broker pod name by running:

```bash
kubectl get pods -n multimodal-sample-app | grep mqtt-broker
```

- Use the pod name from the output of the above command to subscribe to all topics:
```bash
kubectl exec -it -n multimodal-sample-app <mqtt_broker_pod_name> -- mosquitto_sub -h localhost -v -t '#' -p 1883
```

#### Helm - Subscribing to Time Series Analytics Microservice Alerts

```bash
kubectl exec -it -n multimodal-sample-app <mqtt_broker_pod_name> -- mosquitto_sub -h localhost -v -t alerts/weld_defect_detection -p 1883
```

#### Helm - Subscribing to DL Streamer Pipeline Server Results

```bash
kubectl exec -it -n multimodal-sample-app <mqtt_broker_pod_name> -- mosquitto_sub -h localhost -v -t vision_weld_defect_classification -p 1883
```

#### Helm - Subscribing to Fusion Analytics Results

```bash
kubectl exec -it -n multimodal-sample-app <mqtt_broker_pod_name> -- mosquitto_sub -h localhost -v -t fusion/anomaly_detection_results -p 1883
```

## Supporting Resources

- [Kapacitor MQTT Alert Documentation](https://docs.influxdata.com/kapacitor/v1/reference/event_handlers/mqtt/).
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Apache v2 license
# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#

apiVersion: v2
name: multimodal-weld-defect-detection-sample-app
description: Helm charts for multimodal-weld-defect-detection sample app

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0-weekly

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0-weekly"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please refer [link](../docs/user-guide/how-to-deploy-with-helm.md) for the helm deployment
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}

** Please be patient while the chart is being deployed **

Get the list of pods by executing:

`kubectl get pods --namespace {{ $.Values.namespace }}`

By default, all our helm charts are deployed with `{{ $.Values.namespace }}` namespace, below commands will help us to deploy helm chart and kube pods with specific namespace


`helm install --set namespace=<namespace> <helm_app_name> <helm_charts_directory>/ --namespace <namespace> --create-namespace`

Access the pod you want to debug by executing

`kubectl exec --namespace {{ $.Values.namespace }} -ti <NAME OF THE POD> -- bash`

Verify the pod logs by executing

`kubectl logs -f <NAME OF THE POD>`

Access Grafana at `https://nodeip:{{ $.Values.config.nginx.ext.https_port }}`

Loading
Loading