Upgrade the Operator

      +

      Before Upgrading

      Make sure to consult the Release Notes and the What’s New? pages before upgrading, as there may be additional considerations or steps required on a per-release basis. Clusters with couchbaseclusters.spec.antiAffinity attribute enabled will require the addition of a temporary node for the upgrade — see here for further details.

      About Upgrading From Version 1.x.x

      There is no direct upgrade path to this release from versions prior to 2.0.x. To upgrade from a 1.x.x release, you must first upgrade to 2.0.x, paying particular attention to supported Kubernetes platforms and Couchbase Server versions. Refer to the 2.0.x version of this page if upgrading from a 1.x.x release.

      Step 1: Download the New Operator Package

      Download the Operator package for the version that you want to upgrade to, and unpack it on the same computer where you normally run kubectl or oc.

      The Operator package contains the YAML configuration files and command-line tools that you will use to upgrade and manage the Operator.

      After you unpack the download, the resulting directory will be titled something like couchbase-autonomous-operator-kubernetes_x.x.x-linux_x86_64. Make sure to cd into this directory before you run the commands in this guide.

      Step 2: Uninstall the Old DAC and Operator

      What needs to be uninstalled is dependent on the release you are upgrading from. For example, in releases prior to 1.2.0, the Operator used ClusterRole resources for simplicity of configuration. From 1.2.0 onward, the operator uses Role resources to increase security.

      In general, you’ll need to undo the installation steps in reverse order for the specific version of the Operator you are upgrading from, e.g. uninstall the operator, then uninstall the DAC.

      Never delete existing CRDs. If an existing CRD is deleted, any CouchbaseCluster resources will also be deleted.

      To uninstall the current Operator version, instructions are provided for Kubernetes and OpenShift.

      Step 3: Update the CRDs

      In the Operator package you downloaded, you’ll find the updated version of the CRDs: crd.yaml. Between releases of the Operator, the CRDs may undergo small changes that don’t affect backward compatibility, and may add new fields or make changes to validation, therefore must be reinstalled. New CRDs may also be introduced that need installing.

      CRDs are distributed as a single file. During the upgrade procedure, errors are expected during the apply operation if a CRD was previously created using a create operation. Using apply here allows the CRD to be replaced and created all in one operation.

      To update the CRDs, run the following command:

      • Kubernetes

      • OpenShift

      $ kubectl apply -f crd.yaml
      $ oc apply -f crd.yaml

      Step 4: Install the New Operator

      After all the previous steps, you can move on to upgrading the Operator itself. Upgrading the Operator is exactly the same as the initial installation, except that you don’t re-install the CRD. To re-install the Operator in all namespaces where previous instances operated on, see the relevant documentation for Kubernetes or OpenShift.