DEV Community

Tosin Akinosho
Tosin Akinosho

Posted on

1 1 1 1 1

How to Use Migration Toolkit for Virtualization 2.7 with OpenShift Internal Registry

Introduction

Migration Toolkit for Virtualization (MTV) 2.7 provides a comprehensive solution to migrate virtual machines (VMs) from VMware to OpenShift Virtualization. This guide outlines the steps required to install and configure MTV 2.7 while leveraging OpenShift's internal registry.

Prerequisites

Before proceeding, ensure you have met the following requirements:

  1. Review VMware Prerequisites: Familiarize yourself with the VMware prerequisites as outlined in the official documentation.
  2. Creating a VDDK Image: Follow the steps for creating a VDDK image for VMware disk introspection.
  3. OpenShift Cluster Requirements:
    • A functional OpenShift Container Platform (OCP) cluster with OpenShift Virtualization enabled.
    • Access to the OpenShift internal registry.
    • Sufficient resources (CPU, Memory, and Storage) to accommodate migrated workloads.

Step 1: Install Migration Toolkit for Virtualization

MTV 2.7 can be installed via the OperatorHub in OpenShift.

  1. Login to OpenShift:
   oc login --server=<OCP_API_SERVER> --token=<TOKEN>
Enter fullscreen mode Exit fullscreen mode
  1. Install MTV Operator:
    • Navigate to Operators > OperatorHub in the OpenShift Web Console.
    • Search for Migration Toolkit for Virtualization.
    • Click Install and follow the guided setup.
  2. Verify Installation:
   oc get pods -n openshift-mtv
Enter fullscreen mode Exit fullscreen mode

Ensure all pods in the openshift-mtv namespace are running.

Step 2: Configure OpenShift Internal Registry for MTV

MTV needs access to OpenShift’s internal image registry to store migrated VM images.

Expose the Internal Registry:

   oc patch configs.imageregistry.operator.openshift.io cluster \
   --type=merge -p '{"spec":{"defaultRoute":true}}'
Enter fullscreen mode Exit fullscreen mode

Retrieve the internal registry route:

   oc get route default-route -n openshift-image-registry --template='{{ .spec.host }}'
Enter fullscreen mode Exit fullscreen mode

Authenticate with the Registry:

   podman login -u kubeadmin -p $(oc whoami -t) \
   $(oc get route default-route -n openshift-image-registry --template='{{ .spec.host }}')
Enter fullscreen mode Exit fullscreen mode

Step 3: Download and Save the VDDK Archive

Download the required VDDK archive from VMware and save it in a temporary directory. After downloading, extract the archive:

Create and Configure the VDDK Image

Migration Toolkit for Virtualization requires a VMware Virtual Disk Development Kit (VDDK) image for efficient data transfer.

Prepare the VDDK Libraries:

Extract the tar file 

tar -xzf VMware-vix-disklib-\<version>.x86\_64.tar.gz
Enter fullscreen mode Exit fullscreen mode

Build the Container Image:

# Create Dockerfile
cat > Dockerfile <<EOF
FROM registry.access.redhat.com/ubi8/ubi-minimal
COPY vmware-vix-disklib-distrib /vmware-vix-disklib-distrib
RUN mkdir -p /opt
ENTRYPOINT ["cp", "-r", "/vmware-vix-disklib-distrib", "/opt"]
EOF
Enter fullscreen mode Exit fullscreen mode
# Build the VDDK container image
podman build -t vddk-image:latest .
Enter fullscreen mode Exit fullscreen mode

Tag the VDDK Image for OpenShift's Internal Registry:
This will go in the openshift-mtv namespace

   podman tag vddk-image:latest $(oc get route default-route -n openshift-image-registry --template='{{ .spec.host }}')/openshift-mtv/vddk-image:latest
Enter fullscreen mode Exit fullscreen mode

Push the VDDK Image to OpenShift's Internal Registry:

   podman push $(oc get route default-route -n openshift-image-registry --template='{{ .spec.host }}')/openshift-mtv/vddk-image:latest
Enter fullscreen mode Exit fullscreen mode

Give image pull permissions to openshift-mtv namespace

oc adm policy add-role-to-group system:image-puller system:serviceaccounts:openshift-mtv -n openshift-image-registry
Enter fullscreen mode Exit fullscreen mode

Configure MTV to Use the VDDK Image:

  • Navigate to Operators > Installed Operators in OpenShift Web Console.
  • Locate the ForkliftController resource and edit its configuration.
  • Specify the VDDK image location:
   spec:
     vddkInitImage: 'image-registry.openshift-image-registry.svc:5000/openshift-mtv/vddk-image:latest'
Enter fullscreen mode Exit fullscreen mode
  • Save and apply the changes.

Step 4: Configure Migration Plan

  1. Access the MTV Web UI:
    • Navigate to Operators > Installed Operators in OpenShift.
    • Click Migration Toolkit for Virtualization and select Open Console.
  2. Define a Migration Plan:
    • Add VMware as a source provider.
    • Select OpenShift Virtualization as the destination.
    • Map VM workloads accordingly.
  3. Start Migration:

    • Validate VM connectivity.
    • Initiate migration and monitor the process via OpenShift logs:
     oc logs -f <mtv-pod-name> -n openshift-mtv
    

Conclusion

By following these steps, you have successfully migrated virtual machines from VMware to OpenShift Virtualization using Migration Toolkit for Virtualization 2.7 while leveraging the OpenShift internal registry. Ensure to monitor workloads post-migration and optimize resources accordingly.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay