更新 Kubernetes 集群中的 Dapr

按照这些步骤升级 Kubernetes 上的 Dapr,并确保顺利升级.

先决条件

Upgrade existing cluster to 1.1.2

有两种方法可以使用Dapr CLI或Helm升级Kubernetes集群上的Dapr control plane。

Dapr CLI

The example below shows how to upgrade to version 1.1.2:

  1. dapr upgrade -k --runtime-version=1.1.2

Note

If you are using Dapr CLI v1.1.0 there is a known issue where mTLS will be enabled by default, even on clusters where it is disabled. If your cluster has mTLS disabled, and you would like it to stay disabled, add --set global.mtls.enabled=false to your upgrade command:

  1. dapr upgrade -k --runtime-version 1.1.1 --set global.mtls.enabled=false

You can track the issue here: #664.

您可以使用Dapr CLI提供所有可用的Helm chart配置。 请参阅 这里 以获取更多信息。

Troubleshooting upgrade using the CLI

There is a known issue running upgrades on clusters that may have previously had a version prior to 1.0.0-rc.2 installed on a cluster.

Most users should not encounter this issue, but there are a few upgrade path edge cases that may leave an incompatible CustomResourceDefinition installed on your cluster. The error message for this case looks like this:

  1. Failed to upgrade Dapr: Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
  2. The CustomResourceDefinition "configurations.dapr.io" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema

To resolve this issue please run the follow command to upgrade the CustomResourceDefinition to a compatible version:

  1. kubectl replace -f https://raw.githubusercontent.com/dapr/dapr/5a15b3e0f093d2d0938b12f144c7047474a290fe/charts/dapr/crds/configuration.yaml

Then proceed with the dapr upgrade --runtime-version 1.1.2 -k command as above.

Helm

从1.0.0版本开始,使用Helm升级Dapr不再是一个破坏性的动作,因为现有的证书值将自动被重新使用。

  1. 将Dapr从1.0.0(或更新)升级到任何[新版本] > v1.0.0。

    1. helm repo update
    1. helm upgrade dapr dapr/dapr --version [NEW VERSION] --namespace dapr-system --wait

    如果你使用的是values文件,记得在运行升级命令时添加--values选项。

  2. 确保所有pod正在运行:

    1. kubectl get pods -n dapr-system -w
    2. NAME READY STATUS RESTARTS AGE
    3. dapr-dashboard-69f5c5c867-mqhg4 1/1 Running 0 42s
    4. dapr-operator-5cdd6b7f9c-9sl7g 1/1 Running 0 41s
    5. dapr-placement-server-0 1/1 Running 0 41s
    6. dapr-sentry-84565c747b-7bh8h 1/1 Running 0 35s
    7. dapr-sidecar-injector-68f868668f-6xnbt 1/1 Running 0 41s
  3. 重新启动您的应用程序 deployments 以更新 Dapr 运行时。

    1. kubectl rollout restart deploy/<DEPLOYMENT-NAME>
  4. 全部完成!

下一步