This is the multi-page printable view of this section. Click here to print.
Dapr CLI reference
- 1: Dapr command line interface (CLI) reference
- 2: annotate CLI command reference
- 3: build-info CLI command reference
- 4: completion CLI command reference
- 5: components CLI command reference
- 6: configurations CLI command reference
- 7: dashboard CLI command reference
- 8: help CLI command reference
- 9: init CLI command reference
- 10: invoke CLI command reference
- 11: list CLI command reference
- 12: logs CLI command reference
- 13: mtls CLI command reference
- 13.1: mtls export CLI command reference
- 13.2: mtls expiry CLI command reference
- 13.3: mtls renew certificate CLI command reference
- 14: publish CLI command reference
- 15: run CLI command reference
- 16: status CLI command reference
- 17: stop CLI command reference
- 18: uninstall CLI command reference
- 19: upgrade CLI command reference
- 20: version CLI command reference
1 - Dapr command line interface (CLI) reference
The Dapr CLI allows you to setup Dapr on your local dev machine or on a Kubernetes cluster, provides debugging support, and launches and manages Dapr instances.
__
____/ /___ _____ _____
/ __ / __ '/ __ \/ ___/
/ /_/ / /_/ / /_/ / /
\__,_/\__,_/ .___/_/
/_/
===============================
Distributed Application Runtime
Usage:
dapr [command]
Available Commands:
annotate Add dapr annotations to a Kubernetes configuration. Supported platforms: Kubernetes
build-info Print build info of Dapr CLI and runtime
completion Generates shell completion scripts
components List all Dapr components. Supported platforms: Kubernetes
configurations List all Dapr configurations. Supported platforms: Kubernetes
dashboard Start Dapr dashboard. Supported platforms: Kubernetes and self-hosted
help Help about any command
init Install Dapr on supported hosting platforms. Supported platforms: Kubernetes and self-hosted
invoke Invoke a method on a given Dapr application. Supported platforms: Self-hosted
list List all Dapr instances. Supported platforms: Kubernetes and self-hosted
logs Get Dapr sidecar logs for an application. Supported platforms: Kubernetes
mtls Check if mTLS is enabled. Supported platforms: Kubernetes
publish Publish a pub-sub event. Supported platforms: Self-hosted
run Run Dapr and (optionally) your application side by side. Supported platforms: Self-hosted
status Show the health status of Dapr services. Supported platforms: Kubernetes
stop Stop Dapr instances and their associated apps. Supported platforms: Self-hosted
uninstall Uninstall Dapr runtime. Supported platforms: Kubernetes and self-hosted
upgrade Upgrades a Dapr control plane installation in a cluster. Supported platforms: Kubernetes
version Print the Dapr runtime and CLI version
Flags:
-h, --help help for dapr
--log-as-json Log output in JSON format
-v, --version version for dapr
Use "dapr [command] --help" for more information about a command.
Command Reference
You can learn more about each Dapr command from the links below.
dapr annotate
dapr build-info
dapr completion
dapr components
dapr configurations
dapr dashboard
dapr help
dapr init
dapr invoke
dapr list
dapr logs
dapr mtls
dapr publish
dapr run
dapr status
dapr stop
dapr uninstall
dapr upgrade
dapr version
Environment Variables
Some Dapr flags can be set via environment variables (e.g. DAPR_NETWORK
for the --network
flag of the dapr init
command). Note that specifying the flag on the command line overrides any set environment variable.
2 - annotate CLI command reference
Description
Add Dapr annotations to a Kubernetes configuration. This enables you to add/change the Dapr annotations on a deployment files. See Kubernetes annotations for a full description of each annotation available in the following list of flags.
Supported platforms
Usage
dapr annotate [flags] CONFIG-FILE
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--kubernetes, -k |
Apply annotations to Kubernetes resources. Required | ||
--api-token-secret |
The secret to use for the API token | ||
--app-id, -a |
The app id to annotate | ||
--app-max-concurrency |
-1 |
The maximum number of concurrent requests to allow | |
--app-port, -p |
-1 |
The port to expose the app on | |
--app-protocol |
The protocol to use for the app: http (default), grpc , https , grpcs , h2c |
||
--app-token-secret |
The secret to use for the app token | ||
--config, -c |
The config file to annotate | ||
--cpu-limit |
The CPU limit to set for the sidecar. See valid values here. | ||
--cpu-request |
The CPU request to set for the sidecar. See valid values here. | ||
--dapr-image |
The image to use for the dapr sidecar container | ||
--enable-debug |
false |
Enable debug | |
--enable-metrics |
false |
Enable metrics | |
--enable-profile |
false |
Enable profiling | |
--env |
Environment variables to set (key value pairs, comma separated) | ||
--graceful-shutdown-seconds |
-1 |
The number of seconds to wait for the app to shutdown | |
--help, -h |
help for annotate | ||
--listen-addresses |
The addresses for sidecar to listen on. To listen to all IPv4 addresses, use 0.0.0.0 . To listen to all IPv6 addresses, use [::] . |
||
--liveness-probe-delay |
-1 |
The delay for sidecar to use for the liveness probe. Read more here. | |
--liveness-probe-period |
-1 |
The period used by the sidecar for the liveness probe. Read more here. | |
--liveness-probe-threshold |
-1 |
The threshold used by the sidecar for the liveness probe. Read more here. | |
--liveness-probe-timeout |
-1 |
The timeout used by the sidecar for the liveness probe. Read more here. | |
--log-level |
The log level to use | ||
--max-request-body-size |
-1 |
The maximum request body size to use | |
--http-read-buffer-size |
-1 |
The maximum size of HTTP header read buffer in kilobytes | |
--memory-limit |
The memory limit to set for the sidecar. See valid values here | ||
--memory-request |
The memory request to set for the sidecar | ||
--metrics-port |
-1 |
The port to expose the metrics on | |
--namespace, -n |
The namespace the resource target is in (can only be set if --resource is also set) |
||
--readiness-probe-delay |
-1 |
The delay to use for the readiness probe in the sidecar. Read more here. | |
--readiness-probe-period |
-1 |
The period to use for the readiness probe in the sidecar. Read more here. | |
--readiness-probe-threshold |
-1 |
The threshold to use for the readiness probe in the sidecar. Read more here. | |
--readiness-probe-timeout |
-1 |
The timeout to use for the readiness probe in the sidecar. Read more here. | |
--resource, -r |
The Kubernetes resource target to annotate | ||
--enable-api-logging |
Enable API logging for the Dapr sidecar | ||
--unix-domain-socket-path |
Linux domain socket path to use for communicating with the Dapr sidecar | ||
--volume-mounts |
List of pod volumes to be mounted to the sidecar container in read-only mode | ||
--volume-mounts-rw |
List of pod volumes to be mounted to the sidecar container in read-write mode | ||
--disable-builtin-k8s-secret-store |
Disable the built-in Kubernetes secret store | ||
--placement-host-address |
Comma separated list of addresses for Dapr actor placement servers |
Warning
If an application ID is not provided using--app-id, -a
, an ID is generated using the format <namespace>-<kind>-<name>
.
Examples
# Annotate the first deployment found in the input
kubectl get deploy -l app=node -o yaml | dapr annotate -k - | kubectl apply -f -
# Annotate multiple deployments by name in a chain
kubectl get deploy -o yaml | dapr annotate -k -r nodeapp - | dapr annotate -k -r pythonapp - | kubectl apply -f -
# Annotate deployment in a specific namespace from file or directory by name
dapr annotate -k -r nodeapp -n namespace mydeploy.yaml | kubectl apply -f -
# Annotate deployment from url by name
dapr annotate -k -r nodeapp --log-level debug https://raw.githubusercontent.com/dapr/quickstarts/master/tutorials/hello-kubernetes/deploy/node.yaml | kubectl apply -f -
3 - build-info CLI command reference
Description
Get the version and git commit data for dapr
and daprd
executables.
Supported platforms
Usage
dapr build-info
Related facts
You can get daprd
build information directly by invoking daprd --build-info
command.
4 - completion CLI command reference
Description
Generates shell completion scripts
Usage
dapr completion [flags]
dapr completion [command]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--help , -h |
Prints this help message |
Examples
Installing bash completion on macOS using Homebrew
If running Bash 3.2 included with macOS:
brew install bash-completion
Or, if running Bash 4.1+:
brew install bash-completion@2
Add the completion to your completion directory:
dapr completion bash > $(brew --prefix)/etc/bash_completion.d/dapr
source ~/.bash_profile
Installing bash completion on Linux
If bash-completion is not installed on Linux, please install the bash-completion’ package via your distribution’s package manager.
Load the dapr completion code for bash into the current shell:
source <(dapr completion bash)
Write bash completion code to a file and source if from .bash_profile:
dapr completion bash > ~/.dapr/completion.bash.inc
printf "source '$HOME/.dapr/completion.bash.inc'" >> $HOME/.bash_profile
source $HOME/.bash_profile
Installing zsh completion on macOS using homebrew
If zsh-completion is not installed on macOS, please install the ‘zsh-completion’ package:
brew install zsh-completions
Set the dapr completion code for zsh[1] to autoload on startup:
dapr completion zsh > "${fpath[1]}/_dapr"
source ~/.zshrc
Installing zsh completion on Linux
If zsh-completion is not installed on Linux, please install the ‘zsh-completion’ package via your distribution’s package manager.
Load the dapr completion code for zsh into the current shell:
source <(dapr completion zsh)
Set the dapr completion code for zsh[1] to autoload on startup:
dapr completion zsh > "${fpath[1]}/_dapr"
Installing Powershell completion on Windows
Create $PROFILE if it not exists:
if (!(Test-Path -Path $PROFILE )){ New-Item -Type File -Path $PROFILE -Force }
Add the completion to your profile:
dapr completion powershell >> $PROFILE
Available Commands
bash Generates bash completion scripts
powershell Generates powershell completion scripts
zsh Generates zsh completion scripts
5 - components CLI command reference
Description
List all Dapr components.
Supported platforms
Usage
dapr components [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--kubernetes , -k |
false |
List all Dapr components in a Kubernetes cluster (required) | |
--all-namespaces , -A |
true |
If true, list all Dapr components in all namespaces | |
--help , -h |
Print this help message | ||
--name , -n |
The components name to be printed (optional) | ||
--namespace |
List all components in the specified namespace | ||
--output , -o |
list |
Output format (options: json or yaml or list) |
Examples
# List Dapr components in all namespaces in Kubernetes mode
dapr components -k
# List Dapr components in specific namespace in Kubernetes mode
dapr components -k --namespace default
# Print specific Dapr component in Kubernetes mode
dapr components -k -n mycomponent
# List Dapr components in all namespaces in Kubernetes mode
dapr components -k --all-namespaces
Warning messages
This command can issue warning messages.
Root certificate renewal warning
If the mtls root certificate deployed to the Kubernetes cluster expires in under 30 days the following warning message is displayed:
Dapr root certificate of your Kubernetes cluster expires in <n> days. Expiry date: <date:time> UTC.
Please see docs.dapr.io for certificate renewal instructions to avoid service interruptions.
6 - configurations CLI command reference
Description
List all Dapr configurations.
Supported platforms
Usage
dapr configurations [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--kubernetes , -k |
false |
List all Dapr configurations in Kubernetes cluster (required). | |
--all-namespaces , -A |
true |
If true, list all Dapr configurations in all namespaces (optional) | |
--namespace |
List Dapr configurations in specific namespace. | ||
--name , -n |
Print specific Dapr configuration. (optional) | ||
--output , -o |
list |
Output format (options: json or yaml or list) | |
--help , -h |
Print this help message |
Examples
# List Dapr configurations in all namespaces in Kubernetes mode
dapr configurations -k
# List Dapr configurations in specific namespace in Kubernetes mode
dapr configurations -k --namespace default
# Print specific Dapr configuration in Kubernetes mode
dapr configurations -k -n appconfig
# List Dapr configurations in all namespaces in Kubernetes mode
dapr configurations -k --all-namespaces
Warning messages
This command can issue warning messages.
Root certificate renewal warning
If the mtls root certificate deployed to the Kubernetes cluster expires in under 30 days the following warning message is displayed:
Dapr root certificate of your Kubernetes cluster expires in <n> days. Expiry date: <date:time> UTC.
Please see docs.dapr.io for certificate renewal instructions to avoid service interruptions.
7 - dashboard CLI command reference
Description
Start Dapr dashboard.
Supported platforms
Usage
dapr dashboard [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--address , -a |
localhost |
Address to listen on. Only accepts IP address or localhost as a value | |
--help , -h |
Prints this help message | ||
--kubernetes , -k |
false |
Opens Dapr dashboard in local browser via local proxy to Kubernetes cluster | |
--namespace , -n |
dapr-system |
The namespace where Dapr dashboard is running | |
--port , -p |
8080 |
The local port on which to serve Dapr dashboard | |
--version , -v |
false |
Print the version for Dapr dashboard |
Examples
# Start dashboard locally
dapr dashboard
# Start dashboard service locally on a specified port
dapr dashboard -p 9999
# Port forward to dashboard service running in Kubernetes
dapr dashboard -k
# Port forward to dashboard service running in Kubernetes on all addresses on a specified port
dapr dashboard -k -p 9999 --address 0.0.0.0
# Port forward to dashboard service running in Kubernetes on a specified port
dapr dashboard -k -p 9999
Warning messages - Kubernetes Mode
This command can issue warning messages.
Root certificate renewal warning
If the mtls root certificate deployed to the Kubernetes cluster expires in under 30 days the following warning message is displayed:
Dapr root certificate of your Kubernetes cluster expires in <n> days. Expiry date: <date:time> UTC.
Please see docs.dapr.io for certificate renewal instructions to avoid service interruptions.
8 - help CLI command reference
Description
Help provides help for any command in the application.
Usage
dapr help [command] [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--help , -h |
Prints this help message |
9 - init CLI command reference
Description
Install Dapr on supported hosting platforms.
Supported platforms
Usage
dapr init [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--dashboard-version |
latest |
The version of the Dapr dashboard to install, for example: 1.0.0 |
|
--enable-ha |
false |
Enable high availability (HA) mode | |
--enable-mtls |
true |
Enable mTLS in your cluster | |
--from-dir |
Path to a local directory containing a downloaded “Dapr Installer Bundle” release which is used to init the airgap environment |
||
--help , -h |
Print this help message | ||
--image-registry |
Pulls container images required by Dapr from the given image registry | ||
--kubernetes , -k |
false |
Deploy Dapr to a Kubernetes cluster | |
--namespace , -n |
dapr-system |
The Kubernetes namespace to install Dapr in | |
--network |
The Docker network on which to install and deploy the Dapr runtime | ||
--runtime-version |
latest |
The version of the Dapr runtime to install, for example: 1.0.0 |
|
--image-variant |
The image variant to use for the Dapr runtime, for example: mariner |
||
--set |
Configure options on the command line to be passed to the Dapr Helm chart and the Kubernetes cluster upon install. Can specify multiple values in a comma-separated list, for example: key1=val1,key2=val2 |
||
--slim , -s |
false |
Exclude placement service, scheduler service, and the Redis and Zipkin containers from self-hosted installation | |
--timeout |
300 |
The wait timeout for the Kubernetes installation | |
--wait |
false |
Wait for Kubernetes initialization to complete | |
N/A | DAPR_DEFAULT_IMAGE_REGISTRY | It is used to specify the default container registry to pull images from. When its value is set to GHCR or ghcr it pulls the required images from Github container registry. To default to Docker hub, unset the environment variable or leave it blank |
|
N/A | DAPR_HELM_REPO_URL | Specifies a private Dapr Helm chart url | |
N/A | DAPR_HELM_REPO_USERNAME | A username for a private Helm chart | The username required to access the private Dapr Helm chart. If it can be accessed publicly, this env variable does not need to be set |
N/A | DAPR_HELM_REPO_PASSWORD | A password for a private Helm chart | The password required to access the private Dapr Helm chart. If it can be accessed publicly, this env variable does not need to be set |
--container-runtime |
docker |
Used to pass in a different container runtime other than Docker. Supported container runtimes are: docker , podman |
|
--dev |
Creates Redis and Zipkin deployments when run in Kubernetes. | ||
--scheduler-volume |
Self-hosted only. Optionally, you can specify a volume for the scheduler service data directory. By default, without this flag, scheduler data is not persisted and not resilient to restarts. |
Examples
Install
Install Dapr by pulling container images for Placement, Scheduler, Redis, and Zipkin. By default, these images are pulled from Docker Hub.
By default, a
dapr_scheduler
local volume is created for Scheduler service to be used as the database directory. The host file location for this volume is likely located at/var/lib/docker/volumes/dapr_scheduler/_data
or~/.local/share/containers/storage/volumes/dapr_scheduler/_data
, depending on your container runtime.
dapr init
Dapr can also run Slim self-hosted mode, without Docker.
dapr init -s
To switch to Dapr Github container registry as the default registry, set the
DAPR_DEFAULT_IMAGE_REGISTRY
environment variable value to beGHCR
. To switch back to Docker Hub as default registry, unset this environment variable.
Specify a runtime version
You can also specify a specific runtime version. By default, the latest version is used.
dapr init --runtime-version 1.13.4
Install with image variant
You can also install Dapr with a particular image variant, for example: mariner.
dapr init --image-variant mariner
Use Dapr Installer Bundle
In an offline or airgap environment, you can download a Dapr Installer Bundle and use this to install Dapr instead of pulling images from the network.
dapr init --from-dir <path-to-installer-bundle-directory>
Dapr can also run in slim self-hosted mode without Docker in an airgap environment.
dapr init -s --from-dir <path-to-installer-bundle-directory>
Specify private registry
You can also specify a private registry to pull container images from. These images need to be published to private registries as shown below to enable Dapr CLI to pull them successfully via the dapr init
command:
- Dapr runtime container image(dapr) (Used to run Placement) - dapr/dapr:
- Redis container image(rejson) - dapr/3rdparty/rejson
- Zipkin container image(zipkin) - dapr/3rdparty/zipkin
All the required images used by Dapr needs to be under the dapr
path. The 3rd party images have to be published under dapr/3rdparty
path.
image-registry
uri follows the docker.io/<username>
format.
dapr init --image-registry docker.io/username
This command resolves the complete image URI as shown below -
- Placement container image(dapr) - docker.io/username/dapr/dapr:
- Redis container image(rejson) - docker.io/username/dapr/3rdparty/rejson
- zipkin container image(zipkin) - docker.io/username/dapr/3rdparty/zipkin
You can specify a different container runtime while setting up Dapr. If you omit the --container-runtime
flag, the default container runtime is Docker.
dapr init --container-runtime podman
Use Docker network
You can deploy local containers into Docker networks, which is useful for deploying into separate networks or when using Docker Compose for local development to deploy applications.
Create the Docker network.
docker network create mynet
Initialize Dapr and specify the created Docker network.
dapr init --network mynet
Verify all containers are running in the specified network.
docker ps
Uninstall Dapr from that Docker network.
dapr uninstall --all --network mynet
dapr init -k
Using the --dev
flag initializes Dapr in dev mode, which includes Zipkin and Redis.
dapr init -k --dev
You can wait for the installation to complete its deployment with the --wait
flag.
The default timeout is 300s (5 min), but can be customized with the --timeout
flag.
dapr init -k --wait --timeout 600
You can also specify a specific runtime version.
dapr init -k --runtime-version 1.4.0
Use the --set
flag to configure a set of Helm Chart values during Dapr installation to help set up a Kubernetes cluster.
dapr init -k --set global.tag=1.0.0 --set dapr_operator.logLevel=error
You can also specify a private registry to pull container images from. As of now dapr init -k
does not use specific images for sentry, operator, placement, scheduler, and sidecar. It relies on only Dapr runtime container image dapr
for all these images.
Scenario 1 : dapr image hosted directly under root folder in private registry -
dapr init -k --image-registry docker.io/username
Scenario 2 : dapr image hosted under a new/different directory in private registry -
dapr init -k --image-registry docker.io/username/<directory-name>
10 - invoke CLI command reference
Description
Invoke a method on a given Dapr application.
Supported platforms
Usage
dapr invoke [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--app-id , -a |
APP_ID |
The application id to invoke | |
--help , -h |
Print this help message | ||
--method , -m |
The method to invoke | ||
--data , -d |
The JSON serialized data string (optional) | ||
--data-file , -f |
A file containing the JSON serialized data (optional) | ||
--verb , -v |
POST |
The HTTP verb to use |
Examples
# Invoke a sample method on target app with POST Verb
dapr invoke --app-id target --method sample --data '{"key":"value"}'
# Invoke a sample method on target app with GET Verb
dapr invoke --app-id target --method sample --verb GET
11 - list CLI command reference
Description
List all Dapr instances.
Supported platforms
Usage
dapr list [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--all-namespaces , -A |
false |
List all Dapr pods in all namespaces (optional) | |
--help , -h |
Print this help message | ||
--kubernetes , -k |
false |
List all Dapr pods in a Kubernetes cluster (optional) | |
--namespace , -n |
default |
List the Dapr pods in the defined namespace in Kubernetes. Only with -k flag (optional) |
|
--output , -o |
table |
The output format of the list. Valid values are: json , yaml , or table |
Examples
# List Dapr instances in self-hosted mode
dapr list
# List Dapr instances in all namespaces in Kubernetes mode
dapr list -k
# List Dapr instances in JSON format
dapr list -o json
# List Dapr instances in a specific namespace in Kubernetes mode
dapr list -k --namespace default
# List Dapr instances in all namespaces in Kubernetes mode
dapr list -k --all-namespaces
Warning messages - Kubernetes Mode
This command can issue warning messages.
Root certificate renewal warning
If the mtls root certificate deployed to the Kubernetes cluster expires in under 30 days the following warning message is displayed:
Dapr root certificate of your Kubernetes cluster expires in <n> days. Expiry date: <date:time> UTC.
Please see docs.dapr.io for certificate renewal instructions to avoid service interruptions.
12 - logs CLI command reference
Description
Get Dapr sidecar logs for an application.
Supported platforms
Usage
dapr logs [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--app-id , -a |
APP_ID |
The application id for which logs are needed | |
--help , -h |
Print this help message | ||
--kubernetes , -k |
true |
Get logs from a Kubernetes cluster | |
--namespace , -n |
default |
The Kubernetes namespace in which your application is deployed | |
--pod-name , -p |
The name of the pod in Kubernetes, in case your application has multiple pods (optional) |
Examples
# Get logs of sample app from target pod in custom namespace
dapr logs -k --app-id sample --pod-name target --namespace custom
Warning messages
This command can issue warning messages.
Root certificate renewal warning
If the mtls root certificate deployed to the Kubernetes cluster expires in under 30 days the following warning message is displayed:
Dapr root certificate of your Kubernetes cluster expires in <n> days. Expiry date: <date:time> UTC.
Please see docs.dapr.io for certificate renewal instructions to avoid service interruptions.
13 - mtls CLI command reference
Description
Check if mTLS is enabled.
Supported platforms
Usage
dapr mtls [flags]
dapr mtls [command]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--help , -h |
Print this help message | ||
--kubernetes , -k |
false |
Check if mTLS is enabled in a Kubernetes cluster |
Available Commands
expiry Checks the expiry of the root Certificate Authority (CA) certificate
export Export the root Certificate Authority (CA), issuer cert and issuer key to local files
renew-certificate Rotates the existing root Certificate Authority (CA), issuer cert and issuer key
Command Reference
You can learn more about each sub command from the links below.
Examples
# Check if mTLS is enabled on the Kubernetes cluster
dapr mtls -k
Warning messages
This command can issue warning messages.
Root certificate renewal warning
If the mtls root certificate deployed to the Kubernetes cluster expires in under 30 days the following warning message is displayed:
Dapr root certificate of your Kubernetes cluster expires in <n> days. Expiry date: <date:time> UTC.
Please see docs.dapr.io for certificate renewal instructions to avoid service interruptions.
13.1 - mtls export CLI command reference
Description
Export the root Certificate Authority (CA), issuer cert and issuer key to local files
Supported platforms
Usage
dapr mtls export [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--help , -h |
help for export | ||
--out , -o |
current directory | The output directory path to save the certs |
Examples
# Check expiry of Kubernetes certs
dapr mtls export -o ./certs
Warning messages
This command can issue warning messages.
Root certificate renewal warning
If the mtls root certificate deployed to the Kubernetes cluster expires in under 30 days the following warning message is displayed:
Dapr root certificate of your Kubernetes cluster expires in <n> days. Expiry date: <date:time> UTC.
Please see docs.dapr.io for certificate renewal instructions to avoid service interruptions.
13.2 - mtls expiry CLI command reference
Description
Checks the expiry of the root Certificate Authority (CA) certificate
Supported platforms
Usage
dapr mtls expiry [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--help , -h |
help for expiry |
Examples
# Check expiry of Kubernetes certs
dapr mtls expiry
13.3 - mtls renew certificate CLI command reference
Description
This command can be used to renew expiring Dapr certificates. For example the Dapr Sentry service can generate default root and issuer certificates used by applications. For more information see secure Dapr to Dapr communication
Supported platforms
Usage
dapr mtls renew-certificate [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--help , -h |
help for renew-certificate | ||
--kubernetes , -k |
false |
supported platform | |
--valid-until |
365 days | Validity for newly created certificates | |
--restart |
false | Restarts Dapr control plane services (Sentry service, Operator service and Placement server) | |
--timeout |
300 sec | The timeout for the certificate renewal process | |
--ca-root-certificate |
File path to user provided PEM root certificate | ||
--issuer-public-certificate |
File path to user provided PEM issuer certificate | ||
--issuer-private-key |
File path to user provided PEM issue private key | ||
--private-key |
User provided root.key file which is used to generate root certificate |
Examples
Renew certificates by generating brand new certificates
Generates new root and issuer certificates for the Kubernetes cluster with a default validity of 365 days. The certificates are not applied to the Dapr control plane.
dapr mtls renew-certificate -k
Generates new root and issuer certificates for the Kubernetes cluster with a default validity of 365 days and restarts the Dapr control plane services.
dapr mtls renew-certificate -k --restart
Generates new root and issuer certificates for the Kubernetes cluster with a given validity time.
dapr mtls renew-certificate -k --valid-until <no of days>
Generates new root and issuer certificates for the Kubernetes cluster with a given validity time and restarts the Dapr control plane services.
dapr mtls renew-certificate -k --valid-until <no of days> --restart
Renew certificate by using user provided certificates
Rotates certificates for the Kubernetes cluster with the provided ca.pem, issuer.pem and issuer.key file paths and restarts the Dapr control plane services
dapr mtls renew-certificate -k --ca-root-certificate <ca.pem> --issuer-private-key <issuer.key> --issuer-public-certificate <issuer.pem> --restart
Rotates certificates for the Kubernetes cluster with the provided ca.pem, issuer.pem and issuer.key file paths.
dapr mtls renew-certificate -k --ca-root-certificate <ca.pem> --issuer-private-key <issuer.key> --issuer-public-certificate <issuer.pem>
Renew certificates by generating brand new certificates using the provided root private key
Uses existing private root.key to generate new root and issuer certificates for the Kubernetes cluster with a given validity time for created certs.
dapr mtls renew-certificate -k --private-key myprivatekey.key --valid-until <no of days>
Uses the existing private root.key to generate new root and issuer certificates for the Kubernetes cluster.
dapr mtls renew-certificate -k --private-key myprivatekey.key
14 - publish CLI command reference
Description
Publish a pub-sub event.
Supported platforms
Usage
dapr publish [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--publish-app-id , -i |
The ID that represents the app from which you are publishing | ||
--pubsub , -p |
The name of the pub/sub component | ||
--topic , -t |
The topic to be published to | ||
--data , -d |
The JSON serialized string (optional) | ||
--data-file , -f |
A file containing the JSON serialized data (optional) | ||
--help , -h |
Print this help message | ||
--metadata , -m |
A JSON serialized publish metadata (optional) | ||
--unix-domain-socket , -u |
The path to the unix domain socket (optional) |
Examples
# Publish to sample topic in target pubsub via a publishing app
dapr publish --publish-app-id appId --topic sample --pubsub target --data '{"key":"value"}'
# Publish to sample topic in target pubsub via a publishing app using Unix domain socket
dapr publish --enable-domain-socket --publish-app-id myapp --pubsub target --topic sample --data '{"key":"value"}'
# Publish to sample topic in target pubsub via a publishing app without cloud event
dapr publish --publish-app-id myapp --pubsub target --topic sample --data '{"key":"value"}' --metadata '{"rawPayload":"true"}'
15 - run CLI command reference
Description
Run Dapr and (optionally) your application side by side. A full list comparing daprd arguments, CLI arguments, and Kubernetes annotations can be found here.
Supported platforms
Usage
dapr run [flags] [command]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--app-id , -a |
APP_ID |
The id for your application, used for service discovery. Cannot contain dots. | |
--app-max-concurrency |
unlimited |
The concurrency level of the application; default is unlimited | |
--app-port , -p |
APP_PORT |
The port your application is listening on | |
--app-protocol , -P |
http |
The protocol Dapr uses to talk to the application. Valid values are: http , grpc , https (HTTP with TLS), grpcs (gRPC with TLS), h2c (HTTP/2 Cleartext) |
|
--resources-path , -d |
Linux/Mac: $HOME/.dapr/components Windows: %USERPROFILE%\.dapr\components |
The path for resources directory. If you’ve organized your resources into multiple folders (for example, components in one folder, resiliency policies in another), you can define multiple resource paths. See example below. | |
--app-channel-address |
127.0.0.1 |
The network address the application listens on | |
--runtime-path |
Dapr runtime install path | ||
--config , -c |
Linux/Mac: $HOME/.dapr/config.yaml Windows: %USERPROFILE%\.dapr\config.yaml |
Dapr configuration file | |
--dapr-grpc-port , -G |
DAPR_GRPC_PORT |
50001 |
The gRPC port for Dapr to listen on |
--dapr-internal-grpc-port , -I |
50002 |
The gRPC port for the Dapr internal API to listen on. Set during development for apps experiencing temporary errors with service invocation failures due to mDNS caching, or configuring Dapr sidecars behind firewall. Can be any value greater than 1024 and must be different for each app. | |
--dapr-http-port , -H |
DAPR_HTTP_PORT |
3500 |
The HTTP port for Dapr to listen on |
--enable-profiling |
false |
Enable “pprof” profiling via an HTTP endpoint | |
--help , -h |
Print the help message | ||
--run-file , -f |
Linux/MacOS: $HOME/.dapr/dapr.yaml |
Run multiple applications at once using a Multi-App Run template file. Currently in alpha and only available in Linux/MacOS | |
--image |
Use a custom Docker image. Format is repository/image for Docker Hub, or example.com/repository/image for a custom registry. |
||
--log-level |
info |
The log verbosity. Valid values are: debug , info , warn , error , fatal , or panic |
|
--enable-api-logging |
false |
Enable the logging of all API calls from application to Dapr | |
--metrics-port |
DAPR_METRICS_PORT |
9090 |
The port that Dapr sends its metrics information to |
--profile-port |
7777 |
The port for the profile server to listen on | |
--placement-host-address |
Linux/Mac: $HOME/.dapr/components Windows: %USERPROFILE%\.dapr\components |
Run in any containers within your Docker network. Uses <hostname> or <hostname>:<port> . If the port is omitted, it will default to:
|
|
--scheduler-host-address |
Linux/Mac: $HOME/.dapr/components Windows: %USERPROFILE%\.dapr\components |
Run in any containers within your Docker network. Uses <hostname> or <hostname>:<port> . If the port is omitted, it will default to:
|
|
--enable-app-health-check |
false |
Enable health checks for the application using the protocol defined with app-protocol | |
--app-health-check-path |
Path used for health checks; HTTP only | ||
--app-health-probe-interval |
Interval to probe for the health of the app in seconds | ||
--app-health-probe-timeout |
Timeout for app health probes in milliseconds | ||
--app-health-threshold |
Number of consecutive failures for the app to be considered unhealthy | ||
--unix-domain-socket , -u |
Path to a unix domain socket dir mount. If specified, communication with the Dapr sidecar uses unix domain sockets for lower latency and greater throughput when compared to using TCP ports. Not available on Windows. | ||
--dapr-http-max-request-size |
4 |
Max size of the request body in MB. | |
--dapr-http-read-buffer-size |
4 |
Max size of the HTTP read buffer in KB. This also limits the maximum size of HTTP headers. The default 4 KB | |
--kubernetes , -k |
Running Dapr on Kubernetes, and used for Multi-App Run template files on Kubernetes. | ||
--components-path , -d |
Linux/Mac: $HOME/.dapr/components Windows: %USERPROFILE%\.dapr\components |
Deprecated in favor of --resources-path |
Examples
# Run a .NET application
dapr run --app-id myapp --app-port 5000 -- dotnet run
# Run a .Net application with unix domain sockets
dapr run --app-id myapp --app-port 5000 --unix-domain-socket /tmp -- dotnet run
# Run a Java application
dapr run --app-id myapp -- java -jar myapp.jar
# Run a NodeJs application that listens to port 3000
dapr run --app-id myapp --app-port 3000 -- node myapp.js
# Run a Python application
dapr run --app-id myapp -- python myapp.py
# Run sidecar only
dapr run --app-id myapp
# Run a gRPC application written in Go (listening on port 3000)
dapr run --app-id myapp --app-port 5000 --app-protocol grpc -- go run main.go
# Run a NodeJs application that listens to port 3000 with API logging enabled
dapr run --app-id myapp --app-port 3000 --enable-api-logging -- node myapp.js
# Pass multiple resource paths
dapr run --app-id myapp --resources-path path1 --resources-path path2
# Run the multi-app run template file
dapr run -f dapr.yaml
# Run the multi-app run template file on Kubernetes
dapr run -k -f dapr.yaml
16 - status CLI command reference
Description
Show the health status of Dapr services.
Supported platforms
Usage
dapr status -k
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--help , -h |
Print this help message | ||
--kubernetes , -k |
false |
Show the health status of Dapr services on Kubernetes cluster |
Examples
# Get status of Dapr services from Kubernetes
dapr status -k
Warning messages
This command can issue warning messages.
Root certificate renewal warning
If the mtls root certificate deployed to the Kubernetes cluster expires in under 30 days the following warning message is displayed:
Dapr root certificate of your Kubernetes cluster expires in <n> days. Expiry date: <date:time> UTC.
Please see docs.dapr.io for certificate renewal instructions to avoid service interruptions.
17 - stop CLI command reference
Description
Stop Dapr instances and their associated apps.
Supported platforms
Usage
dapr stop [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--app-id , -a |
APP_ID |
The application id to be stopped | |
--help , -h |
Print this help message | ||
--run-file , -f |
Stop running multiple applications at once using a Multi-App Run template file. Currently in alpha and only available in Linux/MacOS |
Examples
# Stop Dapr application
dapr stop --app-id <ID>
18 - uninstall CLI command reference
Description
Uninstall Dapr runtime.
Supported platforms
Usage
dapr uninstall [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--all |
false |
Remove Redis, Zipkin containers in addition to the Scheduler service and the actor Placement service containers. Remove default Dapr dir located at $HOME/.dapr or %USERPROFILE%\.dapr\ . |
|
--help , -h |
Print this help message | ||
--kubernetes , -k |
false |
Uninstall Dapr from a Kubernetes cluster | |
--namespace , -n |
dapr-system |
The Kubernetes namespace from which Dapr is uninstalled | |
--container-runtime |
docker |
Used to pass in a different container runtime other than Docker. Supported container runtimes are: docker , podman |
Examples
Uninstall from self-hosted mode
dapr uninstall
You can also use option --all
to remove .dapr directory, Redis, Placement, Scheduler, and Zipkin containers
dapr uninstall --all
You can specify a different container runtime while setting up Dapr. If you omit the --container-runtime
flag, the default container runtime is Docker.
dapr uninstall --all --container-runtime podman
Uninstall from Kubernetes
dapr uninstall -k
19 - upgrade CLI command reference
Description
Upgrade or downgrade Dapr on supported hosting platforms.
Warning
Version steps should be done incrementally, including minor versions as you upgrade or downgrade.
Prior to downgrading, confirm components are backwards compatible and application code does ultilize APIs that are not supported in previous versions of Dapr.
Supported platforms
Usage
dapr upgrade [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--help , -h |
Print this help message | ||
--kubernetes , -k |
false |
Upgrade/Downgrade Dapr in a Kubernetes cluster | |
--runtime-version |
latest |
The version of the Dapr runtime to upgrade/downgrade to, for example: 1.0.0 |
|
--set |
Set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) | ||
--image-registry |
Pulls container images required by Dapr from the given image registry |
Examples
# Upgrade Dapr in Kubernetes to latest version
dapr upgrade -k
# Upgrade or downgrade to a specified version of Dapr runtime in Kubernetes
dapr upgrade -k --runtime-version 1.2
# Upgrade or downgrade to a specified version of Dapr runtime in Kubernetes with value set
dapr upgrade -k --runtime-version 1.2 --set global.logAsJson=true
# Upgrade or downgrade using private registry, if you are using private registry for hosting dapr images and have used it while doing `dapr init -k`
# Scenario 1 : dapr image hosted directly under root folder in private registry -
dapr init -k --image-registry docker.io/username
# Scenario 2 : dapr image hosted under a new/different directory in private registry -
dapr init -k --image-registry docker.io/username/<directory-name>
Warning messages
This command can issue warning messages.
Root certificate renewal warning
If the mtls root certificate deployed to the Kubernetes cluster expires in under 30 days the following warning message is displayed:
Dapr root certificate of your Kubernetes cluster expires in <n> days. Expiry date: <date:time> UTC.
Please see docs.dapr.io for certificate renewal instructions to avoid service interruptions.
Related links
20 - version CLI command reference
Description
Print the version for dapr
CLI and daprd
executables either in normal or JSON formats.
Supported platforms
Usage
dapr version [flags]
Flags
Name | Environment Variable | Default | Description |
---|---|---|---|
--help , -h |
Print this help message | ||
--output , -o |
Output format (options: json) |
Examples
# Version for Dapr CLI and runtime
dapr version --output json
Related facts
You can get daprd
version directly by invoking daprd --version
command.
You can also get the normal version output by running dapr --version
flag.