Skip to content

Commit

Permalink
change validation order
Browse files Browse the repository at this point in the history
Signed-off-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com>
  • Loading branch information
mukundansundar committed Sep 22, 2023
1 parent ebda46f commit db1c134
Showing 1 changed file with 83 additions and 79 deletions.
162 changes: 83 additions & 79 deletions tutorials/hello-kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,86 @@ cd quickstarts/tutorials/hello-kubernetes

> **Note**: See https://github.com/dapr/quickstarts#supported-dapr-runtime-version for supported tags. Use `git clone https://github.com/dapr/quickstarts.git` when using the edge version of dapr runtime.

## Using Dapr Mutli-app run

### Step 1 - Setup Dapr dev mode on your Kubernetes cluster

Follow the steps below to deploy Dapr to it. For more details, see [Deploy Dapr on a Kubernetes cluster](https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-deploy/).

> Please note, any previous Dapr installations in the Kubernetes cluster need to be uninstalled first.
> Please note, the CLI will install to the dapr-system namespace by default. If this namespace does not exist, the CLI will create it.
> If you need to deploy to a different namespace, you can use `-n mynamespace`.
> Please note, the CLI will install `dapr-dev-redis` and `dapr-dev-zipkin` in the `default` namespace.
> Please note, the `statestore`, `pubsub` and `appconfig` default components and configuration will be applied in the `default` Kubernetes namespace only if they do not exist.
```bash
dapr init -k --dev
```

Expected output
```
⌛ Making the jump to hyperspace...
ℹ️ Note: To install Dapr using Helm, see here: https://docs.dapr.io/getting-started/install-dapr-kubernetes/#install-with-helm-advanced
ℹ️ Container images will be pulled from Docker Hub
✅ Deploying the Dapr control plane with latest version to your cluster...
✅ Deploying the Dapr dashboard with latest version to your cluster...
✅ Deploying the Dapr Redis with latest version to your cluster...
✅ Deploying the Dapr Zipkin with latest version to your cluster...
ℹ️ Applying "statestore" component to Kubernetes "default" namespace.
ℹ️ Applying "pubsub" component to Kubernetes "default" namespace.
ℹ️ Applying "appconfig" zipkin configuration to Kubernetes "default" namespace.
✅ Success! Dapr has been installed to namespace dapr-system. To verify, run `dapr status -k' in your terminal. To get started, go here: https://aka.ms/dapr-getting-started
```
### Step 2 - Run the Multi-app run template to deploy both the Node.js and Python apps

To run both the Node.js and Python apps, run the following command from the `hello-kubernetes` directory:
<!-- STEP
name: "Run hello-kubernetes multi-app run tempalte"
sleep: 15
timeout_seconds: 60
expected_stdout_lines:
- 'Deploying app "nodeapp" to Kubernetes'
- 'Deploying app "pythonapp" to Kubernetes'
- '== APP - nodeapp == Got a new order! Order ID: 12'
- '== APP - nodeapp == Successfully persisted state for Order ID: 12'
expected_stderr_lines:
output_match_mode: substring
match_order: none
-->
```bash
dapr run -k -f dapr.yaml
```
<!-- END_STEP -->

Expected output
```
ℹ️ This is a preview feature and subject to change in future releases.
ℹ️ Validating config and starting app "nodeapp"
ℹ️ Deploying app "nodeapp" to Kubernetes
ℹ️ Deploying service YAML "/path/quickstarts/tutorials/hello-kubernetes/node/.dapr/deploy/service.yaml" to Kubernetes
ℹ️ Deploying deployment YAML "/path/quickstarts/tutorials/hello-kubernetes/node/.dapr/deploy/deployment.yaml" to Kubernetes
ℹ️ Streaming logs for containers in pod "nodeapp-6dcddb44f5-q5gnr"
ℹ️ Writing log files to directory : /path/quickstarts/tutorials/hello-kubernetes/node/.dapr/logs
ℹ️ Validating config and starting app "pythonapp"
ℹ️ Deploying app "pythonapp" to Kubernetes
ℹ️ Deploying deployment YAML "/path/quickstarts/tutorials/hello-kubernetes/python/.dapr/deploy/deployment.yaml" to Kubernetes
== APP - nodeapp == Node App listening on port 3000!
ℹ️ Streaming logs for containers in pod "pythonapp-7479cdcb7b-z827w"
ℹ️ Writing log files to directory : /path/quickstarts/tutorials/hello-kubernetes/python/.dapr/logs
ℹ️ Starting to monitor Kubernetes pods for deletion.
== APP - nodeapp == Got a new order! Order ID: 2
== APP - nodeapp == Successfully persisted state for Order ID: 2
== APP - nodeapp == Got a new order! Order ID: 3
== APP - nodeapp == Successfully persisted state for Order ID: 3
== APP - nodeapp == Got a new order! Order ID: 4
== APP - nodeapp == Successfully persisted state for Order ID: 4
== APP - nodeapp == Got a new order! Order ID: 5
== APP - nodeapp == Successfully persisted state for Order ID: 5
```
On pressing `Ctrl+C` the CLI process exits after deleting the Kubernetes resources that were created for the run.

## Using the `kubectl` CLI
### Step 1 - Setup Dapr on your Kubernetes cluster

Expand Down Expand Up @@ -80,7 +160,7 @@ Dapr can use a number of different state stores (Redis, CosmosDB, DynamoDB, Cass
name: Deploy redis config
sleep: 1
expected_stdout_lines:
- "component.dapr.io/statestore created"
- "component.dapr.io/statestore configured"
-->

```bash
Expand All @@ -93,6 +173,8 @@ kubectl apply -f ./deploy/redis.yaml
component.dapr.io/statestore created
```

> Note: If `dapr` dev mode installtion was used previously, the `statestore` component will be already installed in the `default` namespace. In this case, the `statestore` component will be updated with the new configuration and the output would be `component.dapr.io/statestore configured`.
### Step 3 - Deploy the Node.js app with the Dapr sidecar

<!-- STEP
Expand Down Expand Up @@ -375,84 +457,6 @@ kubectl delete -f .

This will spin down each resource defined by the .yaml files in the `deploy` directory, including the state component.

## Using Dapr Mutli-app run

### Step 1 - Setup Dapr dev mode on your Kubernetes cluster

Follow the steps below to deploy Dapr to it. For more details, see [Deploy Dapr on a Kubernetes cluster](https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-deploy/).

> Please note, any previous Dapr installations in the Kubernetes cluster need to be uninstalled first.
> Please note, the CLI will install to the dapr-system namespace by default. If this namespace does not exist, the CLI will create it.
> If you need to deploy to a different namespace, you can use `-n mynamespace`.
> Please note, the CLI will install `dapr-dev-redis` and `dapr-dev-zipkin` in the `default` namespace.
> Please note, the `statestore`, `pubsub` and `appconfig` default components and configuration will be applied in the `default` Kubernetes namespace only if they do not exist.
```bash
dapr init -k --dev
```

Expected output
```
⌛ Making the jump to hyperspace...
ℹ️ Note: To install Dapr using Helm, see here: https://docs.dapr.io/getting-started/install-dapr-kubernetes/#install-with-helm-advanced
ℹ️ Container images will be pulled from Docker Hub
✅ Deploying the Dapr control plane with latest version to your cluster...
✅ Deploying the Dapr dashboard with latest version to your cluster...
✅ Deploying the Dapr Redis with latest version to your cluster...
✅ Deploying the Dapr Zipkin with latest version to your cluster...
ℹ️ Applying "statestore" component to Kubernetes "default" namespace.
ℹ️ Applying "pubsub" component to Kubernetes "default" namespace.
ℹ️ Applying "appconfig" zipkin configuration to Kubernetes "default" namespace.
✅ Success! Dapr has been installed to namespace dapr-system. To verify, run `dapr status -k' in your terminal. To get started, go here: https://aka.ms/dapr-getting-started
```
### Step 2 - Run the Multi-app run template to deploy both the Node.js and Python apps

To run both the Node.js and Python apps, run the following command from the `hello-kubernetes` directory:
<!-- STEP
name: "Run hello-kubernetes multi-app run tempalte"
sleep: 15
timeout_seconds: 60
expected_stdout_lines:
- 'Deploying app "nodeapp" to Kubernetes'
- 'Deploying app "pythonapp" to Kubernetes'
- '== APP - nodeapp == Got a new order! Order ID: 12'
- '== APP - nodeapp == Successfully persisted state for Order ID: 12'
expected_stderr_lines:
output_match_mode: substring
match_order: none
-->
```bash
dapr run -k -f dapr.yaml
```
<!-- END_STEP -->

Expected output
```
ℹ️ This is a preview feature and subject to change in future releases.
ℹ️ Validating config and starting app "nodeapp"
ℹ️ Deploying app "nodeapp" to Kubernetes
ℹ️ Deploying service YAML "/path/quickstarts/tutorials/hello-kubernetes/node/.dapr/deploy/service.yaml" to Kubernetes
ℹ️ Deploying deployment YAML "/path/quickstarts/tutorials/hello-kubernetes/node/.dapr/deploy/deployment.yaml" to Kubernetes
ℹ️ Streaming logs for containers in pod "nodeapp-6dcddb44f5-q5gnr"
ℹ️ Writing log files to directory : /path/quickstarts/tutorials/hello-kubernetes/node/.dapr/logs
ℹ️ Validating config and starting app "pythonapp"
ℹ️ Deploying app "pythonapp" to Kubernetes
ℹ️ Deploying deployment YAML "/path/quickstarts/tutorials/hello-kubernetes/python/.dapr/deploy/deployment.yaml" to Kubernetes
== APP - nodeapp == Node App listening on port 3000!
ℹ️ Streaming logs for containers in pod "pythonapp-7479cdcb7b-z827w"
ℹ️ Writing log files to directory : /path/quickstarts/tutorials/hello-kubernetes/python/.dapr/logs
ℹ️ Starting to monitor Kubernetes pods for deletion.
== APP - nodeapp == Got a new order! Order ID: 2
== APP - nodeapp == Successfully persisted state for Order ID: 2
== APP - nodeapp == Got a new order! Order ID: 3
== APP - nodeapp == Successfully persisted state for Order ID: 3
== APP - nodeapp == Got a new order! Order ID: 4
== APP - nodeapp == Successfully persisted state for Order ID: 4
== APP - nodeapp == Got a new order! Order ID: 5
== APP - nodeapp == Successfully persisted state for Order ID: 5
```

## Deploying your code

Now that you're successfully working with Dapr, you probably want to update the code to fit your scenario. The Node.js and Python apps that make up this quickstart are deployed from container images hosted on a private [Azure Container Registry](https://azure.microsoft.com/en-us/services/container-registry/). To create new images with updated code, you'll first need to install docker on your machine. Next, follow these steps:
Expand Down

0 comments on commit db1c134

Please sign in to comment.