在Kubernetes集群上部署Dapr

    你可以使用 Dapr CLI 或 Helm 在 Kubernetes 中部署 Dapr

    For more information on what is deployed to your Kubernetes cluster read the

    • Install Dapr CLI
    • 安装
    • Kubernetes 集群 (如有需要可参考下文)

    你可以在任何 Kubernetes 集群上安装 Dapr. 下面的链接可以提供帮助: 下面的链接可以提供帮助:

    Hybrid clusters

    Dapr CLI 和 Dapr Helm 图表都会自动关联地部署到带有标签的节点上。 如果你的应用程序有需要,你也可以将 Dapr 部署到 Windows 节点。 For more information see .

    You can install Dapr to a Kubernetes cluster using the Dapr CLI.

    安装 Dapr

    -k 标志在当前上下文中初始化 Kubernetes 集群上的 Dapr.

    Ensure correct cluster is set

    在您的本地机器上运行以下命令,在您的集群上启动Dapr:

    1. Making the jump to hyperspace...
    2. Deploying the Dapr control plane to your cluster...
    3. 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

    在自定义命名空间安装

    初始化 Dapr 时默认的命名空间是dapr-system。 你可以用 -n 标志来覆盖它。

    You can run Dapr with 3 replicas of each control plane pod in the dapr-system namespace for production scenarios.

    1. dapr init -k --enable-ha=true

    关闭 mTLS

    Dapr is initialized by default with mTLS. 你可以用下面的命令关闭:

    Wait for the installation to complete

    您可以使用 --want 标志来等待安装完成。

    默认超时是 300s (5分钟),但可以使用 --timeout 标志自定义超时。

    1. dapr init -k --wait --timeout 600
    1. dapr uninstall -k

    你可以使用 Helm 3 图表在 Kubernetes 上安装 Dapr 。

    Ensure you are on Helm v3

    最新的 Dapr Helm 图表不再支持 Helm v2。 请按照这篇文章 从Helm v2 迁移到Helm v3。

    添加和安装 Dapr Helm 图表

    1. 添加 Helm 库并更新

      1. helm repo add dapr https://dapr.github.io/helm-charts/
      2. helm repo update
      3. # See which chart versions are available
      4. helm search repo dapr --devel --versions
    2. 将 Dapr 图表安装在你的集群的 命名空间中。

      以高可用的方式安装:

      1. helm upgrade --install dapr dapr/dapr \
      2. --version=1.2 \
      3. --namespace dapr-system \
      4. --create-namespace \
      5. --set global.ha.enabled=true \
      6. --wait

    卸载 Kubernetes 上的 Dapr

    1. helm uninstall dapr --namespace dapr-system
    • Read this guide for recommended Helm chart values for production setups
    • 请参阅,了解有关Dapr Helm图表的详细信息。

    当图表安装完成后,验证dapr-operator、dapr-placement、dapr-sidecar-injector和dapr-sentry 的pods是否在dapr-system命名空间中运行。

    1. kubectl get pods --namespace dapr-system