The documentation you are viewing is for Dapr v1.4 which is an older version of Dapr. For up-to-date documentation, see the latest version.

Kubernetes上的 Dapr 概述

如何在 Kubernetes 集群中运行 Dapr 的概述

Kubernetes上的 Dapr

Dapr can be configured to run on any supported versions of Kubernetes. 为了实现这一目标,Dapr首先部署了dapr-sidecar-injectordapr-operatordapr-placementdapr-sentryKubernetes服务。 这些都提供了一流的集成,使Dapr的应用运行变得简单。

  • dapr-operator: Manages component updates and Kubernetes services endpoints for Dapr (state stores, pub/subs, etc.)
  • dapr-sidecar-injector: 将 Dapr 注入 annotated deployment pods,并添加环境变量 DAPR_HTTP_PORTDAPR_GRPC_PORT,以使用户定义的应用程序能够轻松地与 Dapr 通信,而无需硬编码 Dapr 端口值。
  • dapr-placement: Used for actors only. 创建映射表,将 actor 实例映射到 pods。
  • dapr-sentry: 管理服务之间的mTLS并作为证书颁发机构。 For more information read the security overview.

在 Kubernetes 集群上部署 Dapr

Read this guide to learn how to deploy Dapr to your Kubernetes cluster.

将 Dapr 添加到 Kubernetes deployment

在 Kubernetes 集群中部署和运行启用 Dapr 的应用程序非常简单,只需向 deployment 方案添加一些注解。 要给您的服务提供一个 idport 已知的 Dapr, 通过配置进行追踪并启动 Dapr sidecar 容器, 你要像这样注释你的 Kubernetes deployment。 For more information check dapr annotations

  annotations: "true" "nodeapp" "3000" "tracing"

Pulling container images from private registries

Dapr works seamlessly with any user application container image, regardless of its origin. Simply init Dapr and add the Dapr annotations to your Kubernetes definition to add the Dapr sidecar.

The Dapr control-plane and sidecar images come from the daprio Docker Hub container registry, which is a public registry.

For information about pulling your application images from a private registry, reference the Kubernetes documentation. If you are using Azure Container Registry with Azure Kubernetes Service, reference the AKS documentation.


您可以 在这里 看到一些例子,在 Kubernetes 的入门示例中。

Supported versions

Dapr support for Kubernetes is aligned with Kubernetes Version Skew Policy.