You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot-operations/create-edge-apps/howto-deploy-dapr.md
+13-9Lines changed: 13 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,15 +44,15 @@ To create the yaml file, use the following component definitions:
44
44
> [!div class="mx-tdBreakAll"]
45
45
> | Component | Description |
46
46
> |-|-|
47
-
> |`metadata.name`| The component name is important and is how a Dapr application references the component. |
48
-
> | `metadata.annotations` | Component annotations used by Dapr sidecar injector, defining the image locationand required volume mounts
49
-
> |`spec.type`|[The type of the component](https://docs.dapr.io/operations/components/pluggable-components-registration/#define-the-component), which needs to be declared exactly as shown |
50
-
> |`spec.metadata.keyPrefix`| Defines the key prefix used when communicating to the statestore backend. See the [Dapr documentation](https://docs.dapr.io/developing-applications/building-blocks/state-management/howto-share-state) for more information |
51
-
> |`spec.metadata.hostname`| The MQTT broker hostname. Defaults to`aio-mq-dmqtt-frontend`|
52
-
> |`spec.metadata.tcpPort`| The MQTT broker port number. Default is `8883`|
53
-
> |`spec.metadata.useTls`| Define if TLS is used by the MQTT broker. Defaults to`true`|
54
-
> |`spec.metadata.caFile`| The certificate chain path for validating the MQTT broker. Required if `useTls` is `true`. This file must be mounted in the pod with the specified volume name |
55
-
> |`spec.metadata.satAuthFile `| The Service Account Token (SAT) file is used to authenticate the Dapr components with the MQTT broker. This file must be mounted in the pod with the specified volume name |
47
+
> |`metadata:name`| The component name is important and is how a Dapr application references the component. |
48
+
> |`metadata:annotations:dapr.io/component-container`| Component annotations used by Dapr sidecar injector, defining the image location, volume mounts and logging configuration |
49
+
> |`spec:type`|[The type of the component](https://docs.dapr.io/operations/components/pluggable-components-registration/#define-the-component), which needs to be declared exactly as shown |
50
+
> |`spec:metadata:keyPrefix`| Defines the key prefix used when communicating to the statestore backend. See the [Dapr documentation](https://docs.dapr.io/developing-applications/building-blocks/state-management/howto-share-state) for more information |
51
+
> |`spec:metadata:hostname`| The MQTT broker hostname. Default is`aio-mq-dmqtt-frontend`|
52
+
> |`spec:metadata:tcpPort`| The MQTT broker port number. Default is `8883`|
53
+
> |`spec:metadata:useTls`| Define if TLS is used by the MQTT broker. Default is`true`|
54
+
> |`spec:metadata:caFile`| The certificate chain path for validating the MQTT broker. Required if `useTls` is `true`. This file must be mounted in the pod with the specified volume name |
55
+
> |`spec:metadata:satAuthFile `| The Service Account Token (SAT) file is used to authenticate the Dapr components with the MQTT broker. This file must be mounted in the pod with the specified volume name |
56
56
57
57
1. Save the following yaml, which contains the Azure IoT Operations component definitions, to a file named `components.yaml`:
58
58
@@ -70,6 +70,10 @@ To create the yaml file, use the following component definitions:
Copy file name to clipboardExpand all lines: articles/iot-operations/create-edge-apps/howto-develop-dapr-apps.md
+19-18Lines changed: 19 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,17 +50,20 @@ After you finish writing the Dapr application, build the container:
50
50
51
51
## Deploy a Dapr application
52
52
53
-
The following [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) definition contains the volumes required to deploy the application along with the required containers. This deployment utilizes the Dapr sidecar injector to automatically add the pluggable component pod.
53
+
The following [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) definition contains volumes for SAT authentication and TLS certificate chain, as well as utilizing Dapr sidecar injection to automatically add the pluggable components to the Pod.
54
54
55
-
The yaml contains both a ServiceAccount, used to generate SATs for authentication with MQTT broker and the Dapr application Deployment.
56
-
57
-
To create the yaml file, use the following definitions:
55
+
The following definition components will typically require customization to your specific application:
58
56
59
57
>| Component | Description |
60
58
>|-|-|
61
-
>|`volumes.mqtt-client-token`| The System Authentication Token used for authenticating the Dapr pluggable components with the MQTT broker |
62
-
>|`volumes.aio-ca-trust-bundle`| The chain of trust to validate the MQTT broker TLS cert. This defaults to the test certificate deployed with Azure IoT Operations |
63
-
>|`containers.mq-dapr-app`| The Dapr application container you want to deploy |
59
+
>|`template:metadata:annotations:dapr.io/inject-pluggable-components`| Allows the IoT Operations pluggable components to be [automatically injected](https://docs.dapr.io/operations/components/pluggable-components-registration/) into the pod |
60
+
>|`template:metadata:annotations:dapr.io/app-port`| Tells Dapr which port your application is listening on. If your application us not using this feature (such as a pubsub subscription), then remove this line |
61
+
>|`volumes:mqtt-client-token`| The System Authentication Token used for authenticating the Dapr pluggable components with the MQTT broker |
62
+
>|`volumes:aio-ca-trust-bundle`| The chain of trust to validate the MQTT broker TLS cert. This defaults to the test certificate deployed with Azure IoT Operations |
63
+
>|`containers:mq-dapr-app`| The Dapr application container you want to deploy |
64
+
65
+
> [!CAUTION]
66
+
> If your Dapr application is not listening for traffic from the Dapr sidecar, then remove the `dapr.io/app-port` and `dapr.io/app-protocol` [annotations](https://docs.dapr.io/reference/arguments-annotations-overview/) otherwise the Dapr sidecar will fail to initialize.
64
67
65
68
1. Save the following yaml to a file named `dapr-app.yaml`:
66
69
@@ -76,21 +79,20 @@ To create the yaml file, use the following definitions:
76
79
apiVersion: apps/v1
77
80
kind: Deployment
78
81
metadata:
79
-
name: mq-dapr-app
82
+
name: my-dapr-app
80
83
namespace: azure-iot-operations
81
84
spec:
82
-
replicas: 1
83
85
selector:
84
86
matchLabels:
85
-
app: mq-dapr-app
87
+
app: my-dapr-app
86
88
template:
87
89
metadata:
88
90
labels:
89
-
app: mq-dapr-app
91
+
app: my-dapr-app
90
92
annotations:
91
93
dapr.io/enabled: "true"
92
94
dapr.io/inject-pluggable-components: "true"
93
-
dapr.io/app-id: "mq-dapr-app"
95
+
dapr.io/app-id: "my-dapr-app"
94
96
dapr.io/app-port: "6001"
95
97
dapr.io/app-protocol: "grpc"
96
98
spec:
@@ -124,23 +126,22 @@ To create the yaml file, use the following definitions:
124
126
kubectl get pods -w
125
127
```
126
128
127
-
The workload pod should report all pods running after a short interval, as shown in the following example output:
129
+
The pod should report 3 containers running after a short interval, as shown in the following example output:
128
130
129
131
```output
130
-
pod/dapr-workload created
131
132
NAME READY STATUS RESTARTS AGE
132
133
...
133
-
dapr-workload 3/3 Running 0 30s
134
+
my-dapr-app 3/3 Running 0 30s
134
135
```
135
136
136
137
## Troubleshooting
137
138
138
-
If the application doesn't start or you see the pods in `CrashLoopBackoff`, the logs for `daprd` are most helpful. The `daprd` is a container that automatically deploys with your Dapr application.
139
+
If the application doesn't start or you see the containers in `CrashLoopBackoff`, the logs for the `daprd` container often contains useful information.
139
140
140
-
Run the following command to view the logs:
141
+
Run the following command to view the logs for the daprd component:
Copy file name to clipboardExpand all lines: articles/iot-operations/create-edge-apps/tutorial-event-driven-with-dapr.md
+7-14Lines changed: 7 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,27 +106,20 @@ To start, create a yaml file that uses the following definitions:
106
106
1. Confirm that the application deployed successfully. The pod should report all containers are ready after a short interval, as shown with the following command:
107
107
108
108
```bash
109
-
kubectl get pods -n azure-iot-operations
109
+
kubectl get pods -l app=mq-event-driven-dapr -n azure-iot-operations
110
110
```
111
111
112
112
With the following output:
113
113
114
114
```output
115
-
NAME READY STATUS RESTARTS AGE
116
-
...
117
-
mq-event-driven-dapr 3/3 Running 0 30s
115
+
NAME READY STATUS RESTARTS AGE
116
+
mq-event-driven-dapr 3/3 Running 0 30s
118
117
```
119
118
120
119
## Deploy the simulator
121
120
122
121
Simulate test data by deploying a Kubernetes workload. It simulates a sensor by sending sample temperature, vibration, and pressure readings periodically to the MQTT broker using an MQTT client on the `sensor/data` topic.
123
122
124
-
1. Patch BrokerListener to allow unauthenticated connection, to simplify injection of simulated data:
1. Change to the Dapr tutorial directory in the [Explore IoT Operations](https://github.com/Azure-Samples/explore-iot-operations) repository:
270
+
1. Change to the Dapr tutorial directory:
278
271
279
272
```bash
280
273
cd explore-iot-operations/tutorials/mq-event-driven-dapr/src
@@ -297,12 +290,12 @@ The above tutorial uses a prebuilt container of the Dapr application. If you wou
297
290
298
291
## Troubleshooting
299
292
300
-
If the application doesn't start or you see the pods in `CrashLoopBackoff`, the logs for `daprd` are most helpful. The `daprd` is a container that is automatically deployed with your Dapr application.
293
+
If the application doesn't start or you see the containers in `CrashLoopBackoff`, the logs for the `daprd` container often contains useful information.
301
294
302
-
Run the following command to view the logs:
295
+
Run the following command to view the logs for the daprd component:
0 commit comments