Skip to content

Commit ef9c6ba

Browse files
committed
update doc and add links
Signed-off-by: Hannah Hunter <[email protected]>
1 parent 7d276d9 commit ef9c6ba

File tree

2 files changed

+137
-35
lines changed

2 files changed

+137
-35
lines changed

articles/aks/dapr-workflow.md

Lines changed: 135 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: hannahhunter
66
ms.reviewer: nuversky
77
ms.service: azure-kubernetes-service
88
ms.topic: article
9-
ms.date: 03/02/2023
9+
ms.date: 03/03/2023
1010
ms.custom: devx-track-azurecli
1111
---
1212

@@ -31,81 +31,147 @@ The workflow example is an ASP.NET Core project with:
3131
3232
## Pre-requisites
3333

34-
- An Azure subscription. [Don't have one? Create a free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F)
34+
- An [Azure subscription](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) with Owner or Admin role.
3535
- The latest version of the [Azure CLI][install-cli]
36-
- Create an [AKS cluster][deploy-cluster]
37-
- [An Azure Kubernetes Service RBAC Admin role](../role-based-access-control/built-in-roles.md#azure-kubernetes-service-rbac-admin)
38-
- Log into [ghcr.io][gh-pat] using your GitHub Personal Access Token to authenticate to the container registry.
39-
- Install .NET 6+
40-
- Install Docker
36+
- [Docker][docker]
4137

4238
## Set up the environment
4339

44-
Clone the example workflow application.
40+
### Download the sample project
41+
42+
Fork and clone the example workflow application.
4543

4644
```sh
47-
git clone https://github.com/shubham1172/dapr-workflows-aks-sample.git
45+
git clone https://github.com/<your-repo>/dapr-workflows-aks-sample.git
4846
```
4947

50-
Navigate to the root directory.
48+
Navigate to the sample's root directory.
5149

5250
```sh
5351
cd dapr-workflows-aks-sample
5452
```
5553

56-
If you haven't already, log into [ghcr.io][gh-pat].
54+
### Prepare the Docker image
55+
56+
Run the following commands to test that the Docker image works for the application.
57+
58+
```sh
59+
docker build -t ghcr.io/<your-repo>/dwf-sample:0.1.0 -f Deploy/Dockerfile .
60+
docker push ghcr.io/<your-repo>/dwf-sample:0.1.0
61+
```
5762

58-
## Prepare the Docker image
63+
### Create an Azure Container Registry
5964

60-
Run the following commands to build and push the Docker image for the application.
65+
Create an Azure Container Registry (ACR) and log in to retrieve the ACR Login Server.
6166

6267
```sh
63-
docker build -t ghcr.io/shubham1172/dwf-sample:0.1.0 -f Deploy/Dockerfile .
64-
docker push ghcr.io/shubham1172/dwf-sample:0.1.0
68+
az group create --name myResourceGroup --location eastus
69+
az acr create --resource-group myResourceGroup --name acrName --sku Basic
70+
az acr login --name acrName
71+
az acr list --resource-group myResourceGroup --query "[].{acrLoginServer:loginServer}" --output table
72+
acrName.azurecr.io
6573
```
6674

67-
## Install Dapr on your AKS cluster
75+
Tag the [Docker image](#prepare-the-docker-image) you prepared earlier to your new ACR.
76+
77+
```sh
78+
docker tag ghcr.io/<your-repo>/dwf-sample:0.1.0 acrName.azurecr.io/dwf-sample:0.1.0
79+
docker push acrName.azurecr.io/dwf-sample:0.1.0
80+
```
6881

69-
Once you've built the Docker image, install the Dapr extension on your AKS cluster. Before you do this, make sure you've [installed or updated the `k8s-extension`][k8s-ext].
82+
For more details, see the [Deploy and use ACR][acr] tutorial.
83+
84+
### Create a Kubernetes cluster
85+
86+
Create an AKS cluster and attach to your ACR:
7087

7188
```sh
72-
az k8s-extension create --cluster-type managedClusters \
73-
--cluster-name <myAKSCluster> \
74-
--resource-group <myResourceGroup> \
75-
--name dapr \
76-
--extension-type Microsoft.Dapr
89+
az aks create --resource-group myResourceGroup --name myAKSCluster --node-count 2 --generate-ssh-keys --attach-acr acrName
7790
```
7891

79-
## Deploy to AKS
92+
Make sure `kubectl` is installed and pointed to your AKS cluster.
93+
94+
For more information, see the [Deploy an AKS cluster][cluster] tutorial.
8095

81-
Run the following commands to the cluster:
96+
## Deploy the application to AKS
8297

83-
- Install the Redis state store component and the sample app
84-
- Expose the Dapr sidecar and the sample app
98+
### Update the containers for deployment
8599

86-
**Install Redis**
100+
Navigate to the [`deployment.yaml` file in your fork of the sample project][deployment-yaml] and open in your chosen code editor.
101+
102+
```sh
103+
cd Deploy
104+
code .
105+
```
106+
107+
In the `deployment.yaml` file, update the `containers` spec value to your new ACR name and image:
108+
109+
```yaml
110+
containers:
111+
- name: dwf-sample
112+
image: acrName.azurecr.io/dwf-sample:0.1.0
113+
```
114+
115+
Save and close the `deployment.yaml` file.
116+
117+
### Install Dapr on your AKS cluster
118+
119+
Install the Dapr extension on your AKS cluster. Before you do this, make sure you've:
120+
- [Installed or updated the `k8s-extension`][k8s-ext].
121+
- [Registered the `Microsoft.KubernetesConfiguration` service provider][k8s-sp]
122+
123+
```sh
124+
az k8s-extension create --cluster-type managedClusters --cluster-name myAKSCluster --resource-group myResourceGroup --name dapr --extension-type Microsoft.Dapr
125+
```
126+
127+
Verify Dapr has been installed by running either of the following commands:
128+
129+
```sh
130+
az k8s-extension show --cluster-type managedClusters --cluster-name myAKSCluster --resource-group myResourceGroup --name dapr
131+
```
132+
133+
```sh
134+
kubectl get pods -A
135+
```
136+
137+
### Run the application
138+
139+
To run the application, start by navigating to the `Deploy` directory in your forked version of the sample:
140+
141+
```sh
142+
cd Deploy
143+
```
144+
145+
Run Redis:
87146

88147
```sh
89148
helm repo add bitnami https://charts.bitnami.com/bitnami
90149
helm install redis bitnami/redis
91-
k apply -f Deploy/redis.yaml
150+
kubectl apply -f redis.yaml
151+
```
152+
153+
Run the application:
154+
155+
```sh
156+
kubectl apply -f deployment.yaml
92157
```
93158

94-
**Install the sample app**
159+
Expose the Dapr sidecar and the sample app
95160

96161
```sh
97-
k apply -f Deploy/deployment.yaml
162+
kubectl apply -f service.yaml
163+
export SAMPLE_APP_URL=$(kubectl get svc/workflows-sample -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
164+
export DAPR_URL=$(kubectl get svc/workflows-sample-dapr -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
98165
```
99166

100-
**Expose the Dapr sidecar and the sample app**
167+
Verify that the above commands were exported:
101168

102169
```sh
103-
k apply -f Deploy/service.yaml
104-
export SAMPLE_APP_URL=$(k get svc/workflows-sample -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
105-
export DAPR_URL=$(k get svc/workflows-sample-dapr -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
170+
echo $SAMPLE_APP_URL
171+
echo $DAPR_URL
106172
```
107173

108-
## Run the workflow
174+
## Start the workflow
109175

110176
Now that the application and Dapr have been deployed to the AKS cluster, you can now start and query workflow instances. Begin by making an API call to the sample app to restock items in the inventory:
111177

@@ -121,18 +187,50 @@ curl -i -X POST $DAPR_URL/v1.0-alpha1/workflows/dapr/OrderProcessingWorkflow/123
121187
-d '{ "input" : {"Name": "Paperclips", "TotalCost": 99.95, "Quantity": 1}}'
122188
```
123189

190+
Expected output:
191+
192+
```json
193+
HTTP/1.1 202 Accepted
194+
Date: Fri, 03 Mar 2023 19:19:15 GMT
195+
Content-Type: application/json
196+
Content-Length: 22
197+
Traceparent: 00-00000000000000000000000000000000-0000000000000000-00
198+
199+
{"instance_id":"1234"}
200+
```
201+
124202
Check the workflow status:
125203

126204
```sh
127205
curl -i -X GET $DAPR_URL/v1.0-alpha1/workflows/dapr/OrderProcessingWorkflow/1234
128206
```
129207

208+
Expected output:
209+
210+
```json
211+
HTTP/1.1 202 Accepted
212+
Date: Fri, 03 Mar 2023 19:19:44 GMT
213+
Content-Type: application/json
214+
Content-Length: 388
215+
Traceparent: 00-00000000000000000000000000000000-0000000000000000-00
216+
217+
{"WFInfo":{"instance_id":"1234"},"start_time":"2023-03-03T19:19:16Z","metadata":{"dapr.workflow.custom_status":"","dapr.workflow.input":"{\"Name\":\"Paperclips\",\"Quantity\":1,\"TotalCost\":99.95}","dapr.workflow.last_updated":"2023-03-03T19:19:33Z","dapr.workflow.name":"OrderProcessingWorkflow","dapr.workflow.output":"{\"Processed\":true}","dapr.workflow.runtime_status":"COMPLETED"}}
218+
```
219+
220+
Notice that the workflow status is marked as completed.
221+
130222
## Next steps
131223

224+
[Learn how to add configuration settings to the Dapr extension][dapr-config]
225+
132226
<!-- Links Internal -->
133227
[deploy-cluster]: ./tutorial-kubernetes-deploy-cluster.md
134228
[install-cli]: /cli/azure/install-azure-cli
135229
[k8s-ext]: ./dapr.md#set-up-the-azure-cli-extension-for-cluster-extensions
230+
[acr]: ./tutorial-kubernetes-prepare-acr.md
231+
[cluster]: ./tutorial-kubernetes-deploy-cluster.md
232+
[k8s-sp]: ./dapr.md#register-the-kubernetesconfiguration-service-provider
233+
[dapr-config]: ./dapr-settings.md
136234

137235
<!-- Links External -->
138236
[dapr-workflow-sample]: https://github.com/shubham1172/dapr-workflows-aks-sample
@@ -141,3 +239,5 @@ curl -i -X GET $DAPR_URL/v1.0-alpha1/workflows/dapr/OrderProcessingWorkflow/1234
141239
[dapr-activities-dir]: https://github.com/shubham1172/dapr-workflows-aks-sample/tree/main/Activities
142240
[dapr-workflow-alpha]: https://docs.dapr.io/operations/support/support-preview-features/#current-preview-features
143241
[gh-pat]: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic
242+
[deployment-yaml]: https://github.com/hhunter-ms/dapr-workflows-aks-sample/blob/main/Deploy/deployment.yaml
243+
[docker]: https://docs.docker.com/get-docker/

articles/aks/dapr.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ az k8s-extension delete --resource-group myResourceGroup --cluster-name myAKSClu
210210

211211
- Learn more about [additional settings and preferences you can set on the Dapr extension][dapr-settings].
212212
- Once you have successfully provisioned Dapr in your AKS cluster, try deploying a [sample application][sample-application].
213+
- Try out [Dapr Workflow on your Dapr extension for AKS][dapr-workflow]
213214

214215
<!-- LINKS INTERNAL -->
215216
[deploy-cluster]: ./tutorial-kubernetes-deploy-cluster.md
@@ -223,6 +224,7 @@ az k8s-extension delete --resource-group myResourceGroup --cluster-name myAKSClu
223224
[install-cli]: /cli/azure/install-azure-cli
224225
[dapr-migration]: ./dapr-migration.md
225226
[dapr-settings]: ./dapr-settings.md
227+
[dapr-workflow]: ./dapr-workflow.md
226228

227229
<!-- LINKS EXTERNAL -->
228230
[kubernetes-production]: https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-production

0 commit comments

Comments
 (0)