/my-dapr

Dapr project to test/demo on kind kubernetes

Primary LanguageShell

Dapr on kind

Project used to test/demo dapr on kind kubernetes

Prerequisites

Dapr setup

Create a kind kubernetes cluster on your local machine:

HOST_VM_IP=192.168.1.90 ./kind.sh

NOTE: The kind cluster can be deleted using the argument ./kind.sh delete or during the creation KIND_DELETE=y ./kind.sh. You can also change the version of the cluster to be used K8S_VERSION=latest ./kind.sh or K8S_VERSION=1.24 ./kind.sh.

Next, install dapr using the bash script where you pass the HOST_VM_IP address which is used to expose the ingress route (e.g. dashboard, etc). The installation can be cleaned using ./setup-dapr.sh cleanup

HOST_VM_IP=192.168.1.90 ./setup-dapr.sh

You can define the following variables:

HOST_VM_IP=<HOST_VM_IP> (e.g. 127.0.0.1.nip.io)
DAPR_VERSION=<DAPR_VERSION> (e.g. version of dapr to be installed. Default: 1.9.6)
DAPR_NS=<DAPR_NS> (e.g. namespace where dapr is installed on the cluster. Default: dapr)

NOTE: You can access the dapr dashboard using the url: https://dapr.<HOST_VM_IP>.nip.io

Order quickstart

To play with the Order quickstart which is an application composed of 2 microservices: node order app and python backend issuing order requests, execute the following bash command:

HOST_VM_IP=192.168.1.90 ./demo_order.sh install

To get orders (or post orders), do some cUrl requests using the order nodeapp URL: export NODEAPP_URL='http://nodeapp.<HOST_VM_IP>.nip.io'

Post an order

curl --request POST --data \"@quickstarts/tutorials/hello-kubernetes/sample.json\" --header Content-Type:application/json "$NODEAPP_URL/neworder"

Get the last order:

curl "$NODEAPP_URL/order"

or using the demo bash script:

HOST_VM_IP=192.168.1.90 ./demo_order.sh play

To clean up the demo:

./demo_order.sh cleanup

Collect Metrics

  • To collect the Dapr metrics of the system like the sidecarss it is needed to install promethus, grafana and to deploy the grafana templates
helm install grafana grafana/grafana -n dapr-monitoring --create-namespace --set ingress.enabled=true --set ingress.hosts="{dapr-monitoring.127.0.0.1.nip.io}"

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install dapr-prom prometheus-community/prometheus -n dapr-monitoring
  • You can get the grafana admin user using the command kubectl get secret --namespace dapr-monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
  • Next configure the prometheus datasource
  • And import the templates