Upgrade on Azure

To upgrade your Materialize instances, upgrade the Materialize operator first and then the Materialize instances. The following tutorial upgrades your Materialize deployment running on Azure Kubernetes Service (AKS)

The tutorial assumes you have installed Materialize on Azure Kubernetes Service (AKS) using the instructions on Install on Azure (either from the examples/simple directory or the root).

Version compatibility

When upgrading, you need to specify the Materialize Operator version, orchestratord version, and the environmentd versions. The following table presents the versions compatibility for the operator and the applications:

Materialize Operator orchestratord version environmentd version
v25.1.2 v0.130.4 v0.130.4

Prerequisites

! Important:

The following procedure performs an in-place upgrade, which incurs downtime.

To perform a rolling upgrade(where both the old and new Materialize instances are running before the the old instances are removed), you can specify inPlaceRollout to false. When performing a rolling upgrade, ensure you have enough resources to support having both the old and new Materialize instances running.

Azure subscription

If you do not have an Azure subscription to use for this tutorial, create one.

Azure CLI

If you don’t have Azure CLI installed, install Azure CLI.

Terraform

If you don’t have Terraform installed, install Terraform.

kubectl

If you do not have kubectl, install kubectl.

Python (v3.12+) and pip

If you don’t have Python (v3.12 or greater) installed, install it. See Python.org. If pip is not included with your version of Python, install it.

Helm 3.2.0+

If you don’t have Helm version 3.2.0+ installed, install. For details, see to the Helm documentation.

jq (Optional)

Optional. jq is used to parse the AKS cluster name and region from the Terraform outputs. Alternatively, you can manually specify the name and region. If you want to use jq and do not have jq installed, install.

A. Authenticate with Azure

  1. Open a Terminal window.

  2. Authenticate with Azure.

    az login
    

    The command opens a browser window to sign in to Azure. Sign in.

  3. Select the subscription and tenant to use. After you have signed in, back in the terminal, your tenant and subscription information is displayed.

    Retrieving tenants and subscriptions for the selection...
    
    [Tenant and subscription selection]
    
    No     Subscription name    Subscription ID                       Tenant
    -----  -------------------  ------------------------------------  ----------------
    [1]*   ...                  ...                                   ...
    
    The default is marked with an *; the default tenant is '<Tenant>' and
    subscription is '<Subscription Name>' (<Subscription ID>).
    

    Select the subscription and tenant.

  4. Set ARM_SUBSCRIPTION_ID to the subscription ID.

    export ARM_SUBSCRIPTION_ID=<subscription-id>
    

B. Upgrade process

  1. Go to the Terraform directory for your Materialize deployment. For example, if you deployed from the examples/simple directory:

    cd terraform-azurerm-materialize/examples/simple
    
  2. Optional. You may need to update your Materialize on Azure Terraform modules to upgrade.

  3. Optional. Create a virtual environment, specifying a path for the new virtual environment:

    python3 -m venv <path to the new virtual environment>
    

    Activate the virtual environment:

    source <path to the new virtual environment>/bin/activate
    
  4. Install the required packages.

    pip install -r requirements.txt
    
  5. Configure kubectl to connect to your cluster:

    • <cluster_name>. Your cluster name has the form <your prefix>-aks; e.g., mz-simple-aks.

    • <resource_group_name>, as specified in the output. You resource group name has the form <your prefix>-rg; e.g., mz-simple-rg.

    az aks get-credentials --resource-group <resource_group_name> --name <cluster_name>
    

    Alternatively, you can use the following command to get the cluster name and resource group name from the Terraform output (in your terraform.tfstate file):

    az aks get-credentials --resource-group $(terraform output -raw resource_group_name) --name $(terraform output -json aks_cluster | jq -r '.name')
    

    To verify that you have configured correctly, run the following command:

    kubectl get nodes
    

    For help with kubectl commands, see kubectl Quick reference.

  6. Back up your terraform.tfvars file.

    cp terraform.tfvars original_terraform.tfvars
    
  7. Update the terraform.tfvars to set the Materialize Operator version and the orchestratord version:

    Variable Description
    operator_version New Materialize Operator version.
    • If the variable does not exist, add the variable and set to the new version.
    • If the variable exists, update the value to the new version.
    orchestratord_version New orchestratord version.
    • If the variable does not exist, add the variable and set to the new version.
    • If the variable exists, update the value to the new version.
    ##... Existing content not shown for brevity
    ##... Leave the existing variables unchanged
    operator_version="v25.1.2"  # Set to the desired operator version
    orchestratord_version="v0.130.4"  # Set to the desired orchestratord version
    
  8. Initialize the terraform directory.

    terraform init
    
  9. Run terraform plan with both the terraform.tfvars and your mz_instances.tfvars files and review the changes to be made.

    terraform plan -var-file=terraform.tfvars -var-file=mz_instances.tfvars
    

    The plan should show the changes to be made for the materialize_operator.

  10. If you are satisfied with the changes, apply.

    terraform apply -var-file=terraform.tfvars -var-file=mz_instances.tfvars
    

    To approve the changes and apply, enter yes.

    Upon successful completion, you should see output with a summary of changes.

  11. Verify that the operator is running:

    kubectl -n materialize get all
    

    Verify the operator upgrade by checking its events:

    MZ_OPERATOR=$(kubectl -n materialize get pods --no-headers | grep operator  | awk '{print $1}')
    kubectl -n materialize describe pod/$MZ_OPERATOR
    
    • The Containers section should show the --helm-chart-version argument set to the new version.

    • The Events section should list that the new version of the orchestratord have been pulled.

  12. Back up your mz_instances.tfvars file.

    cp mz_instances.tfvars original_mz_instances.tfvars
    
  13. Update the mz_instances.tfvars to specify the upgrade variables for each instance:

    Variable Description
    create_database Set to false.
    environmentd_version New Materialize instance version.
    request_rollout or force_rollout A new UUID string. Can be generated with uuidgen.
    • request_rollout triggers a rollout only if changes exist.
    • force_rollout triggers a rollout even if no changes exist.
    inPlaceRollout Set to true to perform an in-place upgrade.
    Set to false to perform a rolling upgrade. For rolling upgrades, ensure you have enough resources to support having both the old and new Materialize instances running during the upgrade.

    For example, the following instance specifies:

    • a create_database of false,
    • an inPlaceRollout of true,
    • an environmentd_version of "v0.130.4", and
    • a request_rollout of "12345678-1305-1304-1304-123456781304".
    materialize_instances = [
        {
          name           = "demo"
          namespace      = "materialize-environment"
          database_name  = "demo_db"
          cpu_request    = "1"
          memory_request = "2Gi"
          memory_limit   = "2Gi"
          create_database = false
          inPlaceRollout = true
          environmentd_version = "v0.130.4"
          request_rollout="12345678-1305-1304-1304-123456781304"
        }
    ]
    
  14. Run terraform plan with both the terraform.tfvars and your mz_instances.tfvars files and review the changes to be made.

    terraform plan -var-file=terraform.tfvars -var-file=mz_instances.tfvars
    

    The plan should show the changes to be made for the Materialize instance.

  15. If you are satisfied with the changes, apply.

    terraform apply -var-file=terraform.tfvars -var-file=mz_instances.tfvars
    

    To approve the changes and apply, enter yes.

    Upon successful completion, you should see output with a summary of changes.

  16. Verify that the components are running after the upgrade:

    kubectl -n materialize-environment get all
    

    Verify upgrade by checking the balancerd events:

    MZ_BALANCERD=$(kubectl -n materialize-environment get pods --no-headers | grep balancerd  | awk '{print $1}')
    kubectl -n materialize-environment describe pod/$MZ_BALANCERD
    

    The Events section should list that the new version of the balancerd have been pulled.

    Verify the upgrade by checking the environmentd events:

    MZ_ENVIRONMENTD=$(kubectl -n materialize-environment get pods --no-headers | grep environmentd  | awk '{print $1}')
    kubectl -n materialize-environment describe pod/$MZ_ENVIRONMENTD
    

    The Events section should list that the new version of the environmentd have been pulled.

  17. Open the Materialize Console. The Console should display the new version.

Back to top ↑