---
title: "Walkthrough: Upgrading the DEF connector in Kubernetes"
slug: "walkthrough--upgrading-the-def-connector-in-kubernetes"
abstract: "How to upgrade Data Exchange Framework in a container deployment in Kubernetes."
---
# Walkthrough: Upgrading the DEF connector in Kubernetes

This topic explains how you upgrade Data Exchange Framework (DEF) Container versions below 7.0 to DEF 9.0. For upgrading to 9.0 from versions 7.0 or 8.0, follow the instructions in the guide to [Installing Data Exchange Framework on containers](https://doc.sitecore.com/xp/en/developers/def/90/data-exchange-framework/installing-data-exchange-framework-on-containers.html). DEF 9.0 is only compatible with Sitecore 10.4.

> [!note]
> Before you use the following guide to upgrade to DEF for container 9.0, you must have an existing SXP kubernetes deployment with a DEF connector version lower than 7.0. You must also back up your current mssql databases.

This walkthrough describes how to:

- Build and push the mssql-upgrade image
- Complete the upgrade

<details>
<summary><h2>Build and push the mssql-upgrade image</h2></summary>

To upgrade DEF you must build an mssql-upgrade image.

To build and push the mssql-upgrade image:

1. Build the images for DEF as explained in the *Build the mssql-upgrade image* section in [Walkthrough: Upgrading Data Exchange Framework in Docker](https://doc.sitecore.com/xp/en/developers/def/90/data-exchange-framework/walkthrough--upgrading-data-exchange-framework-in-docker.html "Walkthrough: Upgrading Data Exchange Framework in Docker").
2. Open a PowerShell window, go to the same path as the Dockerfile, and run the following command:

    ```text
    docker build. -t sitecore-def -xp1-cm:<imageVersionTag> $registry/sitecore-def-xp1-cm:<newTag>
    ```

3. Check that the image has been created:
4. Run the following command to push the image you created to your Azure registry. For example:

    ```text
    docker push $registry/sitecore-def-xp1-cm:<newTag>
    ```

</details>

<details>
<summary><h2>Complete the upgrade</h2></summary>

To complete the upgrade:

1. [Download](https://developers.sitecore.com/Downloads/Sitecore_Experience_Platform/104/Sitecore_Experience_Platform_104) the Sitecore container deployment package for 10.4, and extract it to your local workstation with the folder structure intact.
2. Navigate to the upgrade folder for the Windows version and topology you are using, for example, `k8s\ltsc2019\upgrade\xp1`. In the `kustomization.yaml` file, update the images section with `newName` and `newTag` of the custom mssql-upgrade image you created and pushed previously.
3. In the `configuration` folder, update the secrets files. For more information on the secrets files, refer to the *Installation Guide for Production Environment with Kubernetes* guide available on the [Sitecore download page](https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform.aspx).
4. Download the DEF container deployment package for 9.0 package from the [Sitecore download page](https://dev.sitecore.net/Downloads/Data_Exchange_Framework.aspx). Extract it to your local workstation with the folder structure intact. Copy the `DEF.Asset\k8s\<windows version>\overrides` folder and paste it into the `\k8s\<windows version>\` folder in the SXP 10.4 deployment structure.
5. In the `secrets` folder in the SXP 10.4 structure, for example, `k8s\ltsc2019\overrides\xp1\secrets`, update the `sitecore-tenant-service-connection-string.txt` secret file.
6. Log in to the Azure CLI and set a subscription:

    ```

    az login
    az account set --subscription "Your Subscription"
    ```

7. Get the credentials for the Kubernetes cluster that was created with the AKS cluster by running this command:

    ```text
    az aks get-credentials --resource-group <10.1 resource group>--name <10.1 cluster>
    ```

8. To deploy the Sitecore upgrade job, go to the folder where the updated files are, for example, `k8s\ltsc2019\upgrade\xp1`, and run this command:

    ```text
    kubectl apply -k .\
    ```

9. To check if the job has completed, run this command:

    ```text
    kubectl get pod
    ```

10. When the upgrade process is completed, you can delete the Kubernetes upgrade job and upgrade secrets. In the console, go to the folder you used in step 2, and run these commands:

    ```

    kubectl delete -f .\
    kubectl delete -k .\
    ```

> [!note]
> If you are upgrading from DEF version 6.0 and earlier, you must clean up DEF items from the database because DEF version 7.0 and later use resources files. This requires rebuilding and upgrading the Sitecore role instances cm, xconnect, and xdbsearchworker.
>
> For detailed instructions on how to build and deploy the Sitecore role instances refer to the Sitecore *Upgrade Container Deployment Guide* on the [Sitecore download page](https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform.aspx).

</details>