Dapr can be run in either Standalone or Kubernetes modes. Running Dapr runtime in Standalone mode enables you to develop Dapr applications in your local development environment and then deploy and run them in other Dapr supported environments. For example, you can develop Dapr applications in Standalone mode and then deploy them to any Kubernetes cluster.
- Prerequisites
- Installing Dapr CLI
- Installing Dapr in standalone mode
- Installing Dapr on Kubernetes cluster
- Install Docker
For Windows user, ensure that
Docker Desktop For Windowsuses Linux containers.
Windows
Install the latest windows Dapr cli to c:\dapr and add this directory to User PATH environment variable.
powershell -Command "iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1 | iex"Linux
Install the latest linux Dapr CLI to /usr/local/bin
wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bashMacOS
Install the latest darwin Dapr CLI to /usr/local/bin
curl -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | /bin/bashEach release of Dapr CLI includes various OSes and architectures. These binary versions can be manually downloaded and installed.
- Download the Dapr CLI
- Unpack it (e.g. dapr_linux_amd64.tar.gz, dapr_windows_amd64.zip)
- Move it to your desired location.
- For Linux/MacOS -
/usr/local/bin - For Windows, create a directory and add this to your System PATH. For example create a directory called
c:\daprand add this directory to your path, by editing your system environment variable.
- For Linux/MacOS -
Install Dapr by running dapr init from a command prompt
For Linux users, if you run your docker cmds with sudo, you need to use "sudo dapr init"
For Windows users, make sure that you run the cmd terminal in administrator mode
Note: See Dapr CLI for details on the usage of Dapr CLI
$ dapr init
⌛ Making the jump to hyperspace...
Downloading binaries and setting up components
✅ Success! Dapr is up and runningTo see that Dapr has been installed successful, from a command prompt run the docker ps command and check that the daprio/dapr:latest and redis container images are both running.
You can install or upgrade to a specific version of the Dapr runtime using dapr init --runtime-version. You can find the list of versions in Dapr Release.
# Install v0.1.0 runtime
$ dapr init --runtime-version 0.1.0
# Check the versions of cli and runtime
$ dapr --version
cli version: v0.1.0
runtime version: v0.1.0Uninstalling will remove the placement container.
$ dapr uninstallIt won't remove the redis container by default in case you were using it for other purposes. To remove both the placement and redis container:
$ dapr uninstall --allYou should always run a dapr uninstall before running another dapr init.
When setting up Kubernetes you can do this either via the Dapr CLI or Helm
You can install Dapr to Kubernetes cluster using CLI.
Please note, that using the CLI does not support non-default namespaces.
If you need a non-default namespace, Helm has to be used (see below).
$ dapr init --kubernetes
ℹ️ Note: this installation is recommended for testing purposes. For production environments, please use Helm
⌛ Making the jump to hyperspace...
✅ Deploying the Dapr Operator to your cluster...
✅ Success! Dapr has been installed. To verify, run 'kubectl get pods -w' in your terminalDapr CLI installs Dapr to default namespace of Kubernetes cluster.
$ dapr uninstall --kubernetesYou can install Dapr to Kubernetes cluster using a Helm chart.
-
Make sure Helm is initialized in your running Kubernetes cluster.
-
Add Azure Container Registry as a Helm repo
helm repo add dapr https://daprio.azurecr.io/helm/v1/repo
helm repo update- Install the Dapr chart on your cluster in the
dapr-systemnamespace
helm install dapr/dapr --name dapr --namespace dapr-systemOnce the chart installation is complete, verify the dapr-operator, dapr-placement and dapr-sidecar-injector pods are running in the dapr-system namespace:
$ kubectl get pods -n dapr-system -w
NAME READY STATUS RESTARTS AGE
dapr-operator-7bd6cbf5bf-xglsr 1/1 Running 0 40s
dapr-placement-7f8f76778f-6vhl2 1/1 Running 0 40s
dapr-sidecar-injector-8555576b6f-29cqm 1/1 Running 0 40shelm del --purge -n daprNote: See here for details on Dapr helm charts.