Upgrading the MetalLB

If you are currently running version 4.10 or an earlier version of the MetalLB Operator, please note that automatic updates to any version later than 4.10 do not work. Upgrading to a newer version from any version of the MetalLB Operator that is 4.11 or later is successful. For example, upgrading from version 4.12 to version 4.13 will occur smoothly.

A summary of the upgrade procedure for the MetalLB Operator from 4.10 and earlier is as follows:

  1. Delete the installed MetalLB Operator version for example 4.10. Ensure that the namespace and the metallb custom resource are not removed.

  2. Using the CLI, install the MetalLB Operator 4.14 in the same namespace where the previous version of the MetalLB Operator was installed.

This procedure does not apply to automatic z-stream updates of the MetalLB Operator, which follow the standard straightforward method.

For detailed steps to upgrade the MetalLB Operator from 4.10 and earlier, see the guidance that follows. As a cluster administrator, start the upgrade process by deleting the MetalLB Operator by using the OpenShift CLI (oc) or the web console.

Deleting the MetalLB Operator from a cluster using the web console

Cluster administrators can delete installed Operators from a selected namespace by using the web console.

Prerequisites

  • Access to an OKD cluster web console using an account with cluster-admin permissions.

Procedure

  1. Navigate to the OperatorsInstalled Operators page.

  2. Search for the MetalLB Operator. Then, click on it.

  3. On the right side of the Operator Details page, select Uninstall Operator from the Actions drop-down menu.

    An Uninstall Operator? dialog box is displayed.

  4. Select Uninstall to remove the Operator, Operator deployments, and pods. Following this action, the Operator stops running and no longer receives updates.

    This action does not remove resources managed by the Operator, including custom resource definitions (CRDs) and custom resources (CRs). Dashboards and navigation items enabled by the web console and off-cluster resources that continue to run might need manual clean up. To remove these after uninstalling the Operator, you might need to manually delete the Operator CRDs.

Deleting MetalLB Operator from a cluster using the CLI

Cluster administrators can delete installed Operators from a selected namespace by using the CLI.

Prerequisites

  • Access to an OKD cluster using an account with cluster-admin permissions.

  • oc command installed on workstation.

Procedure

  1. Check the current version of the subscribed MetalLB Operator in the currentCSV field:

    1. $ oc get subscription metallb-operator -n metallb-system -o yaml | grep currentCSV

    Example output

    1. currentCSV: metallb-operator.4.10.0-202207051316
  2. Delete the subscription:

    1. $ oc delete subscription metallb-operator -n metallb-system

    Example output

    1. subscription.operators.coreos.com "metallb-operator" deleted
  3. Delete the CSV for the Operator in the target namespace using the currentCSV value from the previous step:

    1. $ oc delete clusterserviceversion metallb-operator.4.10.0-202207051316 -n metallb-system

    Example output

    1. clusterserviceversion.operators.coreos.com "metallb-operator.4.10.0-202207051316" deleted

Editing the MetalLB Operator Operator group

When upgrading from any MetalLB Operator version up to and including 4.10 to 4.11 and later, remove spec.targetNamespaces from the Operator group custom resource (CR). You must remove the spec regardless of whether you used the web console or the CLI to delete the MetalLB Operator.

The MetalLB Operator version 4.11 or later only supports the AllNamespaces install mode, whereas 4.10 or earlier versions support OwnNamespace or SingleNamespace modes.

Prerequisites

  • You have access to an OKD cluster with cluster-admin permissions.

  • You have installed the OpenShift CLI (oc).

Procedure

  1. List the Operator groups in the metallb-system namespace by running the following command:

    1. $ oc get operatorgroup -n metallb-system

    Example output

    1. NAME AGE
    2. metallb-system-7jc66 85m
  2. Verify that the spec.targetNamespaces is present in the Operator group CR associated with the metallb-system namespace by running the following command:

    1. $ oc get operatorgroup metallb-system-7jc66 -n metallb-system -o yaml

    Example output

    1. apiVersion: operators.coreos.com/v1
    2. kind: OperatorGroup
    3. metadata:
    4. annotations:
    5. olm.providedAPIs: ""
    6. creationTimestamp: "2023-10-25T09:42:49Z"
    7. generateName: metallb-system-
    8. generation: 1
    9. name: metallb-system-7jc66
    10. namespace: metallb-system
    11. resourceVersion: "25027"
    12. uid: f5f644a0-eef8-4e31-a306-e2bbcfaffab3
    13. spec:
    14. targetNamespaces:
    15. - metallb-system
    16. upgradeStrategy: Default
    17. status:
    18. lastUpdated: "2023-10-25T09:42:49Z"
    19. namespaces:
    20. - metallb-system
  3. Edit the Operator group and remove the targetNamespaces and metallb-system present under the spec section by running the following command:

    1. $ oc edit n metallb-system

    Example output

    1. operatorgroup.operators.coreos.com/metallb-system-7jc66 edited
  4. Verify the spec.targetNamespaces is removed from the Operator group custom resource associated with the metallb-system namespace by running the following command:

    1. $ oc get operatorgroup metallb-system-7jc66 -n metallb-system -o yaml

    Example output

    1. apiVersion: operators.coreos.com/v1
    2. kind: OperatorGroup
    3. metadata:
    4. annotations:
    5. olm.providedAPIs: ""
    6. creationTimestamp: "2023-10-25T09:42:49Z"
    7. generateName: metallb-system-
    8. generation: 2
    9. name: metallb-system-7jc66
    10. namespace: metallb-system
    11. resourceVersion: "61658"
    12. uid: f5f644a0-eef8-4e31-a306-e2bbcfaffab3
    13. spec:
    14. upgradeStrategy: Default
    15. status:
    16. lastUpdated: "2023-10-25T14:31:30Z"
    17. namespaces:
    18. - ""

Upgrading the MetalLB Operator

Prerequisites

  • Access the cluster as a user with the cluster-admin role.

Procedure

  1. Verify that the metallb-system namespace still exists:

    1. $ oc get namespaces | grep metallb-system

    Example output

    1. metallb-system Active 31m
  2. Verify the metallb custom resource still exists:

    1. $ oc get metallb -n metallb-system

    Example output

    1. NAME AGE
    2. metallb 33m
  3. Follow the guidance in “Installing from OperatorHub using the CLI” to install the latest 4.14 version of the MetalLB Operator.

    When installing the latest 4.14 version of the MetalLB Operator, you must install the Operator to the same namespace it was previously installed to.

  4. Verify the upgraded version of the Operator is now the 4.14 version.

    1. $ oc get csv -n metallb-system

    Example output

    1. NAME DISPLAY VERSION REPLACES PHASE
    2. metallb-operator.4.14.0-202207051316 MetalLB Operator 4.14.0-202207051316 Succeeded

Additional resources