升级适用于 Kubernetes 的 Redis Enterprise

此任务介绍如何通过 Operator 升级 Redis Enterprise 集群。

适用于 Kubernetes 的 Redis Enterprise

Redis 在 Kubernetes 部署中为软件升级实施滚动更新。升级过程包括更新三个组件:

  1. 升级 Redis Enterprise operator
  2. 升级 Redis Enterprise 集群 (REC)
  3. 升级 Redis Enterprise 数据库 (REDB)

先决条件

  1. 检查支持的 Kubernetes 发行版,确保您的 Kubernetes 发行版受支持。

  2. kubectl get rec并验证LICENSE STATE在您的 REC 上有效,然后再开始升级过程。

  3. 验证您是从 Redis Enterprise作员版本 6.2.10-45 或更高版本升级的。否则,必须先升级到 6.2.10-45,然后再升级到版本 6.2.18 或更高版本。

警告:
升级集群作系统如果您的数据库使用模块,则需要在升级作系统之前,将集群中的所有节点更新到 Redis Enterprise 7.2.4 或更高版本。有关更多详细信息,请参阅 Redis Enterprise Software 文档中的升级集群的作系统

升级 Operator

下载捆绑包

确保提取 bundle 的正确版本。您可以找到版本标签 通过在 GitHub 上查看 operator releases 或使用 GitHub API 来获取。

您可以使用以下内容下载最新版本的捆绑包curl命令:

VERSION=`curl --silent https://api.github.com/repos/RedisLabs/redis-enterprise-k8s-docs/releases/latest | grep tag_name | awk -F'"' '{print $4}'`
curl --silent -O https://raw.githubusercontent.com/RedisLabs/redis-enterprise-k8s-docs/$VERSION/bundle.yaml

If you need a different release, replace VERSION in the above with a specific release tag.

Apply the bundle

Apply the bundle to deploy the new operator binary. This will also apply any changes in the new release to custom resource definitions, roles, role binding, or operator service accounts.

Note:
If you are not pulling images from Docker Hub, update the operator image spec to point to your private repository. If you have made changes to the role, role binding, RBAC, or custom resource definition (CRD) in the previous version, merge them with the updated declarations in the new version files.

Upgrade the bundle and operator with a single command, passing in the bundle YAML file:

kubectl apply -f bundle.yaml

After running this command, you should see a result similar to this:

role.rbac.authorization.k8s.io/redis-enterprise-operator configured
serviceaccount/redis-enterprise-operator configured
rolebinding.rbac.authorization.k8s.io/redis-enterprise-operator configured
customresourcedefinition.apiextensions.k8s.io/redisenterpriseclusters.app.redislabs.com configured
customresourcedefinition.apiextensions.k8s.io/redisenterprisedatabases.app.redislabs.com configured
deployment.apps/redis-enterprise-operator configured

Reapply the admission controller webhook

If you have the admission controller enabled, you need to manually reapply the ValidatingWebhookConfiguration.

Note:

Versions 6.4.2 and later uses a new ValidatingWebhookConfiguration resource to replace redb-admission. To use newer releases, delete the old webhook resource and apply the new file.

  1. Delete the existing ValidatingWebhookConfiguration on the Kubernetes cluster (named redb-admission).

     ```sh
     kubectl delete ValidatingWebhookConfiguration redb-admission
     ```
    
  2. Apply the resource from the new file.

     ```sh
     kubectl apply -f deploy/admission/webhook.yaml
     ```
    
  1. Verify the admission-tls secret exists.

    kubectl get secret admission-tls
    

    The output should look similar to

    NAME            TYPE     DATA   AGE
    admission-tls   Opaque   2      2m43s
    
  2. Save the certificate to a local environment variable.

    CERT=`kubectl get secret admission-tls -o jsonpath='{.data.cert}'`
    
  3. Create a Kubernetes validating webhook, replacing <namespace> with the namespace where the REC was installed.

    The webhook.yaml template can be found in redis-enterprise-k8s-docs/admission

    sed 's/OPERATOR_NAMESPACE/<namespace>/g' webhook.yaml | kubectl create -f -
    
  4. Create a patch file for the Kubernetes validating webhook.

    cat > modified-webhook.yaml <<EOF
    webhooks:
    - name: redisenterprise.admission.redislabs
      clientConfig:
       caBundle: $CERT
    EOF
    
  5. Patch the webhook with the certificate.

    kubectl patch ValidatingWebhookConfiguration \
        redis-enterprise-admission --patch "$(cat modified-webhook.yaml)"
    

Verify the operator is running

You can check your deployment to verify the operator is running in your namespace.

kubectl get deployment/redis-enterprise-operator

You should see a result similar to this:

NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
redis-enterprise-operator   1/1     1            1           0m36s
Warning:
We recommend upgrading the REC as soon as possible after updating the operator. After the operator upgrade completes, the operator suspends the management of the REC and its associated REDBs, until the REC upgrade completes.

Upgrade the Redis Enterprise cluster (REC)

Warning:

Verify your license is valid before upgrading. Invalid licenses will cause the upgrade to fail.

Use kubectl get rec and verify the LICENSE STATE is valid on your REC before you start the upgrade process.

The Redis Enterprise cluster (REC) can be updated automatically or manually. To trigger automatic upgrade of the REC after the operator upgrade completes, specify autoUpgradeRedisEnterprise: true in your REC spec. If you don't have automatic upgrade enabled, follow the below steps for the manual upgrade.

Before beginning the upgrade of the Redis Enterprise cluster, check the K8s operator release notes to find the Redis Enterprise image tag. For example, in Redis Enterprise K8s operator release 6.0.12-5, the Images section shows the Redis Enterprise tag is 6.0.12-57.

After the operator upgrade is complete, you can upgrade Redis Enterprise cluster (REC).

Upgrade an REC with an Active-Active database

We recommend upgrading all participating clusters to the same operator version.

If you are upgrading from a preview version of the Active-Active controller, you can remove the following environment variables: ACTIVE_ACTIVE_DATABASE_CONTROLLER_ENABLED, REMOTE_CLUSTER_CONTROLLER_ENABLED, and ENABLE_ALPHA_FEATURES.

Edit redisEnterpriseImageSpec in the REC spec

  1. Edit the REC custom resource YAML file.

    kubectl edit rec <your-rec.yaml>
    
  2. Replace the versionTag: declaration under redisEnterpriseImageSpec with the new version tag.

    spec:
      redisEnterpriseImageSpec:
        imagePullPolicy:  IfNotPresent
        repository:       redislabs/redis
        versionTag:       <new-version-tag>
    
  3. Save the changes to apply.

Reapply roles and role bindings

If your operator is monitoring multiple namespaces, you'll need to reapply your role and role bindings for each managed namespace. See Manage databases in multiple namespaces for more details.

Monitor the upgrade

You can view the state of the REC with kubectl get rec.

During the upgrade, the state should be Upgrade. When the upgrade is complete and the cluster is ready to use, the state will change to Running. If the state is InvalidUpgrade, there is an error (usually relating to configuration) in the upgrade.

$ kubectl get rec
NAME   NODES   VERSION      STATE     SPEC STATUS   LICENSE STATE   SHARDS LIMIT   LICENSE EXPIRATION DATE   AGE
rec    3       6.2.10-107   Upgrade   Valid         Valid           4              2022-07-16T13:59:00Z      92m

To see the status of the current rolling upgrade, run:

kubectl rollout status sts <REC_name>

Upgrade databases

After the cluster is upgraded, you can upgrade your databases. The process for upgrading databases is the same for both Kubernetes and non-Kubernetes deployments.

For more details on how to upgrade a database, see the Upgrade an existing Redis Enterprise Software deployment documentation.

For Active-Active databases, see Upgrade an Active-Active database.

Note that if your cluster redisUpgradePolicy or your database redisVersion are set to major, you won't be able to upgrade those databases to minor versions. See Redis upgrade policy for more details.

RATE THIS PAGE
Back to top ↑