DEV Community

Siri Varma Vegiraju
Siri Varma Vegiraju

Posted on

How to deploy Kubernetes and Dapr together

Deploying Dapr on Kubernetes - Summarized Guide

Dapr can be deployed on Kubernetes clusters using two main methods: the Dapr CLI or Helm charts. Both approaches automatically target Linux nodes and support hybrid Linux/Windows clusters.

Prerequisites

Before deployment, ensure you have:

  • Kubectl installed and configured
  • A running Kubernetes cluster
  • Dapr CLI installed (for CLI method) or Helm v3 (for Helm method)

Method 1: Deploy with Dapr CLI

Basic Installation

The simplest way to deploy Dapr is using the CLI with the -k flag:

# Verify your kubectl context
kubectl config get-contexts

# Initialize Dapr on your cluster
dapr init -k

# Launch the dashboard
dapr dashboard -k
Enter fullscreen mode Exit fullscreen mode

Development Installation

For development environments, add Redis and Zipkin components automatically:

dapr init -k --dev
Enter fullscreen mode Exit fullscreen mode

This creates additional pods for Redis (state store/pub-sub) and Zipkin (tracing) in the default namespace.

Advanced CLI Options

High Availability Mode:

dapr init -k --enable-ha=true
Enter fullscreen mode Exit fullscreen mode

Deploys three replicas of each control plane component for production scenarios.

Custom Namespace:

dapr init -k -n custom-namespace
Enter fullscreen mode Exit fullscreen mode

Disable mTLS:

dapr init -k --enable-mtls=false
Enter fullscreen mode Exit fullscreen mode

Wait for Completion:

dapr init -k --wait --timeout 600
Enter fullscreen mode Exit fullscreen mode

Uninstall with CLI

dapr uninstall -k
Enter fullscreen mode Exit fullscreen mode

Method 2: Deploy with Helm

Basic Helm Installation

# Add the Dapr Helm repository
helm repo add dapr https://dapr.github.io/helm-charts/
helm repo update

# Install Dapr
helm upgrade --install dapr dapr/dapr \
  --version=1.15 \
  --namespace dapr-system \
  --create-namespace \
  --wait
Enter fullscreen mode Exit fullscreen mode

High Availability with Helm

# Enable HA for all components
helm upgrade --install dapr dapr/dapr \
  --version=1.15 \
  --namespace dapr-system \
  --create-namespace \
  --set global.ha.enabled=true \
  --wait

# Or enable HA for specific components only
helm upgrade --install dapr dapr/dapr \
  --version=1.15 \
  --namespace dapr-system \
  --create-namespace \
  --set global.ha.enabled=false \
  --set dapr_scheduler.ha=true \
  --set dapr_placement.ha=true \
  --wait
Enter fullscreen mode Exit fullscreen mode

Optional: Install Dapr Dashboard

helm install dapr-dashboard dapr/dapr-dashboard --namespace dapr-system
Enter fullscreen mode Exit fullscreen mode

Uninstall with Helm

helm uninstall dapr --namespace dapr-system
Enter fullscreen mode Exit fullscreen mode

Verification

After installation, verify that all Dapr control plane components are running:

kubectl get pods --namespace dapr-system
Enter fullscreen mode Exit fullscreen mode

Expected pods:

  • dapr-operator - Manages Dapr components
  • dapr-placement - Handles actor placement
  • dapr-sidecar-injector - Injects Dapr sidecars
  • dapr-sentry - Manages mTLS certificates
  • dapr-dashboard (if installed) - Web UI

Alternative Container Images

Mariner-based Images

For compliance requirements, use Mariner-based container images instead of the default distroless images:

With CLI:

dapr init -k --image-variant mariner
Enter fullscreen mode Exit fullscreen mode

With Helm:

helm upgrade --install dapr dapr/dapr \
  --version=1.15 \
  --namespace dapr-system \
  --create-namespace \
  --set global.tag=1.15.5-mariner \
  --wait
Enter fullscreen mode Exit fullscreen mode

Key Considerations

  • Production deployments should use high availability mode and follow production guidelines
  • Development environments can use the --dev flag for convenient local testing
  • Custom namespaces can be used for multi-tenant scenarios
  • mTLS is enabled by default for secure sidecar-to-sidecar communication
  • Hybrid clusters are supported for mixed Linux/Windows environments

This streamlined approach gets Dapr running on your Kubernetes cluster quickly while providing flexibility for different deployment scenarios.

source: https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-deploy/

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.