Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubeedge-counter-demo #14

Merged
merged 43 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f53ecd1
KubeEdge v1.14.2
sarthaksarthak9 Oct 11, 2023
c21e08e
Readme.md
sarthaksarthak9 Oct 11, 2023
3c28e61
intro.md
sarthaksarthak9 Oct 11, 2023
58fea04
README.md
sarthaksarthak9 Oct 22, 2023
9f845c0
KubeEdge v1.14.2
sarthaksarthak9 Oct 22, 2023
4fcadc6
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Oct 22, 2023
472b7f7
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 16, 2023
ff4523d
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 16, 2023
016dd74
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 16, 2023
0dd9a0f
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 16, 2023
2826a8f
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 16, 2023
73872c7
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 16, 2023
fabde73
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 16, 2023
0f8c458
integrate all steps
sarthaksarthak9 Nov 18, 2023
1afd008
step1
sarthaksarthak9 Nov 18, 2023
3b403a8
step2
sarthaksarthak9 Nov 18, 2023
aee1025
step 3
sarthaksarthak9 Nov 18, 2023
a8422bd
step 4
sarthaksarthak9 Nov 18, 2023
ca86c7e
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
fabba4e
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
15f3054
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
0c45eaf
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
010494b
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
44096bd
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
4954043
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
6a1b92c
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
093eeb4
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
f25030d
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
97a8eb5
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
4aa663d
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
e244761
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
f84a5de
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
4c3a6e7
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
6fb356d
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
893d649
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
3e8dc29
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
f0c31e3
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
758d349
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
efdd43a
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
e45ce9b
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
2c3c0fd
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
d26311d
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
9ccafb0
Signed-off-by: sarthaksarthak9 <[email protected]>
sarthaksarthak9 Nov 18, 2023
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
23 changes: 23 additions & 0 deletions KubeEdge v1.14.2/Apache-beam-analysis/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Data Analytics with Apache Beam

## Description

![High level architecture](images/High_level_Arch.png "High Level Architecture")

The main aim of analytics engine is to get data from mqtt broker in stream format and apply rules on incoming data in real time and produce alert/action on mqtt broker. Getting data through pipeline and applying analysis function is done by using Apache Beam.

### Apache Beam

Apache Beam is an open source, unified model for defining both batch and streaming data-parallel processing pipelines. Using one of the open source Beam SDKs, we can build a program that defines the pipeline.


#### Why use Apache Beam for analytics

There are many frameworks like Hadoop, Spark, Flink, Google Cloud Dataflow etc for stream processing. But there was no unified API to binds all such frameworks and data sources. It was needed to abstract out the application logic from these Big Data frameworks. Apache Beam framework provides this abstraction between your application logic and big data ecosystem.
- A generic dataflow-based model for building an abstract pipeline which could be run on any runtime like Flink/Samza etc.
- The same pipeline code can be executed on cloud(eg. Huawei Cloud Stream based on Apache Flink) and on the edge with a custom backend which can efficiently schedule workloads in an edge cluster and perform distributed analytics.
- Apache Beam integrates well with TensorFlow for machine learning which is a key use-case for edge.
- Beam has support for most of the functions required for stream processing and analytics.



30 changes: 30 additions & 0 deletions KubeEdge v1.14.2/Apache-beam-analysis/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"title": "KubeEdge Deployment",
"description": "Data Analytics with Apache Beam",
"details": {
"steps": [
{
"title": "Step 1/4",
"text": "step1.md"
},
{
"title": "Step 2/4",
"text": "step2.md"
},
{
"title": "Step 3/4",
"text": "step3.md"
},
{
"title": "Step 4/4",
"text": "step4.md"
}
],
"intro": {
"text": "intro.md"
}
},
"backend": {
"imageid": "ubuntu"
}
}
31 changes: 31 additions & 0 deletions KubeEdge v1.14.2/Apache-beam-analysis/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Data Analytics with Apache Beam

## Description

![High level architecture](images/High_level_Arch.png "High Level Architecture")

The main aim of analytics engine is to get data from mqtt broker in stream format and apply rules on incoming data in real time and produce alert/action on mqtt broker. Getting data through pipeline and applying analysis function is done by using Apache Beam.

### Apache Beam

Apache Beam is an open source, unified model for defining both batch and streaming data-parallel processing pipelines. Using one of the open source Beam SDKs, we can build a program that defines the pipeline.


#### Demo 1.1 [Real-time alert]:Read batch data from MQTT,filter and generate alerts
- Basic mqtt read/write support in Apache Beam for batch data
- Reads data from an mqtt topic
- Create PCollection of read data and use it as the initial data for pipeline
- Do a filtering over the data
- Publish an alert on a topic if reading exceeds the value
![Demo1.1](images/Demo1.1.png "Demo1.1:Read batch data from MQTT,filter and generate alerts")

#### Demo 1.2 [Filter Streaming Data]: Reads streaming data from MQTT, filter at regular intervals
- Read streaming data using MQTT
- Do a filtering over the data at fixed time intervals
![demo1.2](images/Demo1.2.png "Demo1.2:Reads streaming data from MQTT, filter at regular intervals")

### Prerequisites
- Golang(version: 1.14+)
- KubeEdge(version: v1.5+)
- Docker(version: 18.09-ce+)

14 changes: 14 additions & 0 deletions KubeEdge v1.14.2/Apache-beam-analysis/step1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Deploy pipeline application

### Prerequisites

- Golang(version: 1.14+)
- KubeEdge(version: v1.5+)
- Docker(version: 18.09-ce+)

#### For demo 1.1: Pull the docker image from dockerhub by using following command

```
sudo docker pull containerise/ke_apache_beam:ke_apache_analysis_v1.1
```{{execute}}

22 changes: 22 additions & 0 deletions KubeEdge v1.14.2/Apache-beam-analysis/step2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Deploy pipeline application

### Prerequisites

- Golang(version: 1.14+)
- KubeEdge(version: v1.5+)
- Docker(version: 18.09-ce+)

#### For demo 1.2: Pull the docker image from dockerhub by using following command

```
sudo docker pull containerise/ke_apache_beam:ke_apache_analysis_v1.2
```{{execute}}

#### Run the command

This will shows all images created. Check image named ke_apache_analysis_v1.1 or ke_apache_analysis_v1.2

```
docker images
```{{execute}}

20 changes: 20 additions & 0 deletions KubeEdge v1.14.2/Apache-beam-analysis/step3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Setup the KubeEdge v.1.24.2
follow this link

```
https://killercoda.com/sarthak-009/scenario/deployment
```


### Try out a application deployment by following below steps.

```
kubectl apply -f https://github.com/kubeedge/examples/blob/master/apache-beam-analysis/deployment.yaml
```{{execute}}

### Then you can use below command to check if the application is normally running.

```
kubectl get pods
```{{execute}}

23 changes: 23 additions & 0 deletions KubeEdge v1.14.2/Apache-beam-analysis/step4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Clone the repository

```
git clone https://github.com/kubeedge/examples.git
```{{execute}}
Change the directory to apache-beam-analysis

```
cd examples/apache-beam-analysis
```{{execute}}

### Add following vendor packages:

```
go get -u github.com/yosssi/gmq/mqtt
go get -u github.com/yosssi/gmq/mqtt/client
```{{execute}}

run:
```
go build testmachine.go
./testmachine
```{{execute}}
34 changes: 34 additions & 0 deletions KubeEdge v1.14.2/Bluetooth-CC2650/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Bluetooth With KubeEdge Using CC2650

Users can make use of KubeEdge platform to connect and control their bluetooth devices, provided, the user is aware of the of the data sheet information for their device.
Kubernetes Custom Resource Definition (CRD) and KubeEdge bluetooth mapper is being used to support this feature, using which users can control their device from the cloud. Texas Instruments [CC2650 SensorTag device](http://processors.wiki.ti.com/index.php/CC2650_SensorTag_User%27s_Guide) is being shown here as an example.


## Description

KubeEdge support for bluetooth protocol has been demonstrated here by making use of Texas Instruments CC2650 SensorTag device.
This section contains instructions on how to make use of bluetooth mapper of KubeEdge to control CC2650 SensorTag device.

We will only be focusing on the following features of CC2650 :-

```
1. IR Temperature
2. IO-Control :
2.1 Red Light
2.2 Greem Light
2.3 Buzzer
2.4 Red Light with Buzzer
2.5 Green Light with Buzzer
2.6 Red Light along with Green Light
2.7 Red Light, Green Light along with Buzzer

```

The bluetooth mapper has the following major components :-
- Action Manager
- Scheduler
- Watcher
- Controller
- Data Converter

More details on bluetooth mapper can be found [here](https://github.com/kubeedge/kubeedge/blob/master/docs/mappers/bluetooth_mapper.md#bluetooth-mapper).
4 changes: 4 additions & 0 deletions KubeEdge v1.14.2/Bluetooth-CC2650/final.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Turn ON the CC2650 SensorTag device <br>

The bluetooth mapper is now running, You can monitor the logs of the mapper by using docker logs. You can also play around with the device twin state by altering the desired property in the device instance
and see the result reflect on the SensorTag device. The configurations of the bluetooth mapper can be altered at runtime Please click [Runtime Configurations](https://github.com/kubeedge/kubeedge/blob/master/docs/mappers/bluetooth_mapper.md#runtime-configuration-modifications) for more details.
48 changes: 48 additions & 0 deletions KubeEdge v1.14.2/Bluetooth-CC2650/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Bluetooth With KubeEdge Using CC2650


Users can make use of KubeEdge platform to connect and control their bluetooth devices, provided, the user is aware of the of the data sheet information for their device.
Kubernetes Custom Resource Definition (CRD) and KubeEdge bluetooth mapper is being used to support this feature, using which users can control their device from the cloud. Texas Instruments [CC2650 SensorTag device](http://processors.wiki.ti.com/index.php/CC2650_SensorTag_User%27s_Guide) is being shown here as an example.


## Description

KubeEdge support for bluetooth protocol has been demonstrated here by making use of Texas Instruments CC2650 SensorTag device.
This section contains instructions on how to make use of bluetooth mapper of KubeEdge to control CC2650 SensorTag device.

We will only be focusing on the following features of CC2650 :-

```shell
1. IR Temperature
2. IO-Control :
2.1 Red Light
2.2 Greem Light
2.3 Buzzer
2.4 Red Light with Buzzer
2.5 Green Light with Buzzer
2.6 Red Light along with Green Light
2.7 Red Light, Green Light along with Buzzer

```

The bluetooth mapper has the following major components :-
- Action Manager
- Scheduler
- Watcher
- Controller
- Data Converter

More details on bluetooth mapper can be found [here](https://github.com/kubeedge/kubeedge/blob/master/docs/mappers/bluetooth_mapper.md#bluetooth-mapper).


## Prerequisites

### Hardware Prerequisites

1. Texas instruments CC2650 bluetooth device
2. Linux based edge node with bluetooth support (An Ubuntu 18.04 laptop has been used in this demo)

### Software Prerequisites

1. Golang (1.14+)
2. KubeEdge (v1.5+)
22 changes: 22 additions & 0 deletions KubeEdge v1.14.2/Bluetooth-CC2650/step1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Prerequisites

### Hardware Prerequisites

1. Texas instruments CC2650 bluetooth device
2. Linux based edge node with bluetooth support (An Ubuntu 18.04 laptop has been used in this demo)

### Software Prerequisites

1. Golang (1.14+)
2. KubeEdge (v1.5+)

## Steps to reproduce

#### Clone and run KubeEdge.
Please ensure that the kubeedge setup is up and running before execution of step 4 (mentioned below).

#### Clone the kubeedge/examples repository.

```
git clone https://github.com/kubeedge/examples.git $GOPATH/src/github.com/kubeedge/examples
```{{execute}}
8 changes: 8 additions & 0 deletions KubeEdge v1.14.2/Bluetooth-CC2650/step2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Create the CC2650 SensorTag device model and device instance.

```
cd $GOPATH/src/github.com/kubeedge/examples/bluetooth-CC2650-demo/crds
kubectl apply -f CC2650-device-model.yaml
sed -i "s#edge-node#<your-edge-node-name>#g" CC2650-device-instance.yaml
kubectl apply -f CC2650-device-instance.yaml
```
7 changes: 7 additions & 0 deletions KubeEdge v1.14.2/Bluetooth-CC2650/step3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Please ensure that bluetooth service of your device is ON

#### Set 'bluetooth=true' label for the node (This label is a prerequisite for the scheduler to schedule bluetooth_mapper pod on the node [which meets the hardware / software prerequisites] )

```
kubectl label nodes <your-edge-node-name> bluetooth=true
```
24 changes: 24 additions & 0 deletions KubeEdge v1.14.2/Bluetooth-CC2650/step4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#### Copy the configuration file that has been provided, into its correct path. Please note that the configuration file can be altered as to suit your requirement

```
cp $GOPATH/src/github.com/kubeedge/examples/bluetooth-CC2650-demo/config.yaml

$GOPATH/src/github.com/kubeedge/kubeedge/mappers/bluetooth_mapper/configuration/
```

#### Build the mapper by following the steps given below.

```
cd $GOPATH/src/github.com/kubeedge/kubeedge
make bluetoothdevice_image
docker tag bluetooth_mapper:v1.0 <your_dockerhub_username>/bluetooth_mapper:v1.0
docker push <your_dockerhub_username>/bluetooth_mapper:v1.0
```

<br>
Note: Before trying to push the docker image to the remote repository please ensure that you have signed into docker from your node, if not please type the followig command to sign in
docker login
<br>
Please enter your username and password when prompted


12 changes: 12 additions & 0 deletions KubeEdge v1.14.2/Bluetooth-CC2650/step5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Deploy the mapper by following the steps given below.

```
cd $GOPATH/src/github.com/kubeedge/kubeedge/mappers/bluetooth_mapper
```
#### Please enter the following details in the deployment.yaml :-
1. Replace <edge_node_name> with the name of your edge node at spec.template.spec.voluems.configMap.name <br>
2. Replace <your_dockerhub_username> with your dockerhub username at spec.template.spec.containers.image <br>

```
kubectl create -f deployment.yaml
```
Binary file added KubeEdge v1.14.2/Images/scenarios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions KubeEdge v1.14.2/KubeEdge-Counter-Demo/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## KubeEdge Counter Demo

### Description

Counter is a pseudo device that user can run this demo without any extra physical devices.

Counter run at edge side, and user can control it in web from cloud side, also can get counter value in web from cloud side.
11 changes: 11 additions & 0 deletions KubeEdge v1.14.2/KubeEdge-Counter-Demo/finish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Control counter by visiting Web App Page

* Visit web app page by the web app link `MASTER_NODE_IP:80`.

* Choose `ON` option, and click `Execute`, then user can see counter start to count by `docker logs -f counter-container-id` at edge side.

* Choose `STATUS` option, then click `Execute` to get the counter status, finally counter status and current counter value will display in web.

also you can watch counter status by `kubectl get device counter -o yaml -w` at cloud side.

* Choose `OFF` option, and click `Execute`, counter stop work at edge side.
29 changes: 29 additions & 0 deletions KubeEdge v1.14.2/KubeEdge-Counter-Demo/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"title": "KubeEdge Deployment",
"description": "KubeEdge Counter Demo",
"details": {
"steps": [
{
"title": "Step 1/3",
"text": "step1.md"
},
{
"title": "Step 2/3",
"text": "step2.md"
},
{
"title": "Step 3/3",
"text": "step3.md"
}
],
"intro": {
"text": "intro.md"
},
"finish": {
"text": "finish.md"
}
},
"backend": {
"imageid": "ubuntu"
}
}
Loading