Skip to main content

Upgrade with the operator

Contributors juliantap

You can easily upgrade an existing Astra Trident installation using the operator.

What you'll need

To upgrade by using the operator, the following conditions should be met:

  • You should have a CSI-based Astra Trident installation. To check if you are running CSI Trident, examine the pods in your Trident namespace. If they follow the trident-csi-* naming pattern, you are running CSI Trident.

  • You should have a CRD-based Trident installation. This represents all releases from 19.07 and later. If you have a CSI-based installation, you most likely have a CRD-based installation.

  • If you have uninstalled CSI Trident and the metadata from the installation persists, you can upgrade by using the operator.

  • Only one Astra Trident installation should exist across all the namespaces in a given Kubernetes cluster.

  • You should be using a Kubernetes cluster that runs version 1.17 and later.

  • If alpha snapshot CRDs are present, you should remove them with tridentctl obliviate alpha-snapshot-crd. This deletes the CRDs for the alpha snapshot spec. For existing snapshots that should be deleted/migrated, see this blog.

Warning When upgrading Trident by using the operator on OpenShift Container Platform, you should upgrade to Trident 21.01.1 or later. The Trident operator released with 21.01.0 contains a known issue that has been fixed in 21.01.1. For more details, see the issue details on GitHub.

Upgrade a cluster-scoped operator installation

To upgrade from Trident 21.01 and later, here is the set of steps to be followed.

Steps
  1. Delete the Trident operator that was used to install the current Astra Trident instance. For example, if you are upgrading from 21.01, run the following command:

    kubectl delete -f 21.01/trident-installer/deploy/bundle.yaml -n trident
  2. (Optional) If you want to modify the installation parameters, edit the TridentOrchestrator object that you created when installing Trident.
    This can include changes, such as modifying the custom Trident image, private image registry to pull container images from, enabling debug logs, or specifying image pull secrets.

  3. Install Astra Trident by using the bundle.yaml file that sets up the Trident operator for the new version. Run the following command:

    kubectl create -f 21.10.0/trident-installer/deploy/bundle.yaml -n trident

As part of this step, the 21.10.0 Trident operator will identify an existing Astra Trident installation and upgrade it to the same version as the operator.

Upgrade a namespace-scoped operator installation

To upgrade from an instance of Astra Trident installed using the namespace-scoped operator (versions 20.07 through 20.10), here is the set of steps to be followed:

Steps
  1. Verify the status of the existing Trident installation. To do this, check the Status of TridentProvisioner. The status should be Installed.

    $ kubectl describe tprov trident -n trident | grep Message: -A 3
    Message:  Trident installed
    Status:   Installed
    Version:  v20.10.1
    Note If status shows Updating, ensure you resolve it before proceeding. For a list of possible status values, see here.
  2. Create the TridentOrchestrator CRD by using the manifest provided with the Trident installer.

    # Download the release required [21.01]
    $ mkdir 21.07.1
    $ cd 21.07.1
    $ wget https://github.com/NetApp/trident/releases/download/v21.07.1/trident-installer-21.07.1.tar.gz
    $ tar -xf trident-installer-21.07.1.tar.gz
    $ cd trident-installer
    $ kubectl create -f deploy/crds/trident.netapp.io_tridentorchestrators_crd_post1.16.yaml
  3. Delete the namespace-scoped operator by using its manifest. To complete this step, you require the bundle.yaml file used to deploy the namespace-scoped operator. You can obtain bundle.yaml from the Trident repository. Make sure to use the appropriate branch.

    Note You should make the necessary changes to the Trident install parameters (for example, changing the values for tridentImage, autosupportImage, private image repository, and providing imagePullSecrets) after deleting the namespace-scoped operator and before installing the cluster-scoped operator. For a complete list of parameters that can be updated, see the list of parameters.
    #Ensure you are in the right directory
    $ pwd
    $ /root/20.10.1/trident-installer
    
    #Delete the namespace-scoped operator
    $ kubectl delete -f deploy/bundle.yaml
    serviceaccount "trident-operator" deleted
    clusterrole.rbac.authorization.k8s.io "trident-operator" deleted
    clusterrolebinding.rbac.authorization.k8s.io "trident-operator" deleted
    deployment.apps "trident-operator" deleted
    podsecuritypolicy.policy "tridentoperatorpods" deleted
    
    #Confirm the Trident operator was removed
    $ kubectl get all -n trident
    NAME                               READY   STATUS    RESTARTS   AGE
    pod/trident-csi-68d979fb85-dsrmn   6/6     Running   12         99d
    pod/trident-csi-8jfhf              2/2     Running   6          105d
    pod/trident-csi-jtnjz              2/2     Running   6          105d
    pod/trident-csi-lcxvh              2/2     Running   8          105d
    
    NAME                  TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)              AGE
    service/trident-csi   ClusterIP   10.108.174.125   <none>        34571/TCP,9220/TCP   105d
    
    NAME                         DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR                                     AGE
    daemonset.apps/trident-csi   3         3         3       3            3           kubernetes.io/arch=amd64,kubernetes.io/os=linux   105d
    
    NAME                          READY   UP-TO-DATE   AVAILABLE   AGE
    deployment.apps/trident-csi   1/1     1            1           105d
    
    NAME                                     DESIRED   CURRENT   READY   AGE
    replicaset.apps/trident-csi-68d979fb85   1         1         1       105d

    At this stage, the trident-operator-xxxxxxxxxx-xxxxx pod is deleted.

  4. (Optional) If the install parameters need to be modified, update the TridentProvisioner spec. These could be changes such as modifying the private image registry to pull container images from, enabling debug logs, or specifying image pull secrets.

    $  kubectl patch tprov <trident-provisioner-name> -n <trident-namespace> --type=merge -p '{"spec":{"debug":true}}'
  5. Install the cluster-scoped operator.

    Note Installing the cluster-scoped operator initiates the migration of TridentProvisioner objects to TridentOrchestrator objects, deletes TridentProvisioner objects and the tridentprovisioner CRD, and upgrades Astra Trident to the version of the cluster-scoped operator being used. In the example that follows, Trident is upgraded to 21.07.1.
    Important Upgrading Astra Trident by using the cluster-scoped operator results in the migration of tridentProvisioner to a tridentOrchestrator object with the same name. This is automatically handled by the operator. The upgrade will also have Astra Trident installed in the same namespace as before.
    #Ensure you are in the correct directory
    $ pwd
    $ /root/21.07.1/trident-installer
    
    #Install the cluster-scoped operator in the **same namespace**
    $ kubectl create -f deploy/bundle.yaml
    serviceaccount/trident-operator created
    clusterrole.rbac.authorization.k8s.io/trident-operator created
    clusterrolebinding.rbac.authorization.k8s.io/trident-operator created
    deployment.apps/trident-operator created
    podsecuritypolicy.policy/tridentoperatorpods created
    
    #All tridentProvisioners will be removed, including the CRD itself
    $ kubectl get tprov -n trident
    Error from server (NotFound): Unable to list "trident.netapp.io/v1, Resource=tridentprovisioners": the server could not find the requested resource (get tridentprovisioners.trident.netapp.io)
    
    #tridentProvisioners are replaced by tridentOrchestrator
    $ kubectl get torc
    NAME      AGE
    trident   13s
    
    #Examine Trident pods in the namespace
    $ kubectl get pods -n trident
    NAME                                READY   STATUS    RESTARTS   AGE
    trident-csi-79df798bdc-m79dc        6/6     Running   0          1m41s
    trident-csi-xrst8                   2/2     Running   0          1m41s
    trident-operator-5574dbbc68-nthjv   1/1     Running   0          1m52s
    
    #Confirm Trident has been updated to the desired version
    $ kubectl describe torc trident | grep Message -A 3
    Message:                Trident installed
    Namespace:              trident
    Status:                 Installed
    Version:                v21.07.1

Upgrade a Helm-based operator installation

Perform the following steps to upgrade a Helm-based operator installation.

Steps
  1. Download the latest Astra Trident release.

  2. Use the helm upgrade command. See the following example:

    $ helm upgrade <name> trident-operator-21.07.1.tgz

    where trident-operator-21.07.1.tgz reflects the version that you want to upgrade to.

  3. Run helm list to verify that the chart and app version have both been upgraded.

Note To pass configuration data during the upgrade, use --set.

For example, to change the default value of tridentDebug, run the following command:

$ helm upgrade <name> trident-operator-21.07.1-custom.tgz --set tridentDebug=true

If you run $ tridentctl logs, you can see the debug messages.

Note If you set any non-default options during the initial installation, ensure that the options are included in the upgrade command, or else, the values will be reset to their defaults.

Upgrade from a non-operator installation

If you have a CSI Trident instance that meets the prerequisites listed above, you can upgrade to the latest release of the Trident operator.

Steps
  1. Download the latest Astra Trident release.

    # Download the release required [21.07.1]
    $ mkdir 21.07.1
    $ cd 21.07.1
    $ wget https://github.com/NetApp/trident/releases/download/v21.07.1/trident-installer-21.07.1.tar.gz
    $ tar -xf trident-installer-21.07.1.tar.gz
    $ cd trident-installer
  2. Create the tridentorchestrator CRD from the manifest.

    $ kubectl create -f deploy/crds/trident.netapp.io_tridentorchestrators_crd_post1.16.yaml
  3. Deploy the operator.

    #Install the cluster-scoped operator in the **same namespace**
    $ kubectl create -f deploy/bundle.yaml
    serviceaccount/trident-operator created
    clusterrole.rbac.authorization.k8s.io/trident-operator created
    clusterrolebinding.rbac.authorization.k8s.io/trident-operator created
    deployment.apps/trident-operator created
    podsecuritypolicy.policy/tridentoperatorpods created
    
    #Examine the pods in the Trident namespace
    NAME                                READY   STATUS    RESTARTS   AGE
    trident-csi-79df798bdc-m79dc        6/6     Running   0          150d
    trident-csi-xrst8                   2/2     Running   0          150d
    trident-operator-5574dbbc68-nthjv   1/1     Running   0          1m30s
  4. Create a TridentOrchestrator CR for installing Astra Trident.

    #Create a tridentOrchestrator to initate a Trident install
    $ cat deploy/crds/tridentorchestrator_cr.yaml
    apiVersion: trident.netapp.io/v1
    kind: TridentOrchestrator
    metadata:
      name: trident
    spec:
      debug: true
      namespace: trident
    
    $ kubectl create -f deploy/crds/tridentorchestrator_cr.yaml
    
    #Examine the pods in the Trident namespace
    NAME                                READY   STATUS    RESTARTS   AGE
    trident-csi-79df798bdc-m79dc        6/6     Running   0          1m
    trident-csi-xrst8                   2/2     Running   0          1m
    trident-operator-5574dbbc68-nthjv   1/1     Running   0          5m41s
    
    #Confirm Trident was upgraded to the desired version
    $ kubectl describe torc trident | grep Message -A 3
    Message:                Trident installed
    Namespace:              trident
    Status:                 Installed
    Version:                v21.07.1

The existing backends and PVCs are automatically available.