Breadcrumb

  1. Red Hat Interactive Learning Portal
  2. OpenShift learning
  3. Migrating applications from Red Hat OpenShift classic clusters to hosted control plane clusters
  4. Install OADP on your management cluster

Migrating applications from Red Hat OpenShift classic clusters to hosted control plane clusters

Learn how you can migrate your applications from Red Hat OpenShift classic to a more modernized cluster.

In order to facilitate our migration, we need to install OpenShift APIs for Data Protection (OADP). OADP is an operator that Red Hat has created that can back up and restore APIs in the OpenShift cluster. We will use this to back up our cluster and restore it on our new cluster, essentially migrating it. 

Prerequisites:

  • Administrator access to your cluster and the destination cluster.
  • Access to the same S3 buckets that hold any backups you make from your source cluster.
  • Access to OADP.
  • Exported role-based access control resources.

In this lesson, you will:

  • Configure your S3 storage.
  • Install OADP.
  • Install DataProtectionApplication (DPA).

Install OADP on the management cluster

First, we’ll tackle installing the OADP operator on our management (source) cluster. This can be done either using the command-line interface (CLI) or OpenShift console. 

If you’re using the CLI, you’ll use the following commands to install the necessary components:

  1. Export the cluster:

    export KUBECONFIG=~/kubeconfig-pm-cluster
  2. Create the OADP namespace:

    cat <<EOF | oc apply -f -
    apiVersion: v1
    kind: Namespace
    metadata:
      name: openshift-adp
    EOF
  3. Create the OperatorGroup:

    cat <<EOF | oc apply -f -
    apiVersion: operators.coreos.com/v1
    kind: OperatorGroup
    metadata:
      name: oadp-operator-group
      namespace: openshift-adp
    spec:
      targetNamespaces:
      - openshift-adp
    EOF
  4. Create the subscription:

    cat <<EOF | oc apply -f -
    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: oadp-operator
      namespace: openshift-adp
    spec:
      channel: stable
      name: oadp-operator
      source: redhat-operators
      sourceNamespace: openshift-marketplace
      installPlanApproval: Automatic
    EOF

If you’re using the console, then you’ll use the following steps to install the necessary components:

  1. In the OpenShift Container Platform web console, click Operators → OperatorHub.
  2. Search for OADP Operator in the search field.
  3. Select the OADP Operator and click Install.
  4. On the Install Operator page, modify the following settings:
    • Update Channel: stable
    • Installation Mode: A specific namespace on the cluster
    • Installed Namespace: openshift-adp (create if it doesn't exist)
    • Approval Strategy: Automatic
  5. Click Install.

Once you’ve finished either method for installing OADP, you’ll have to verify the operator is installed. 

  1. First, you’ll input the following to wait for the operator to be ready:

    oc wait --for=condition=ready pod -l control-plane=controller-manager \
      -n openshift-adp --timeout=300s
  2. Then you’ll verify the OADP operator version:

    oc get csv -n openshift-adp | grep oadp-operator

    And the expected output should look like this:

    oadp-operator.v1.5.5    OADP Operator    1.5.5    oadp-operator.v1.5.4    Succeeded

With the success message, we’re good to proceed with configuring our AWS S3 storage. 

Configuring AWS S3 storage

Next, we’ll configure our S3 storage to make sure it’s ready for our application migration later. 

  1. First, use the following command in the console to configure your AWS credentials:

    aws configure

    You will be prompted with several pieces of information:

    AWS Access Key ID: <your-access-key>
    AWS Secret Access Key: <your-secret-key>
    Default region name: eu-north-1
    Default output format: json
  2. If you already have credentials, you can verify access using aws sts get-caller-identity.

  3. Next, you’ll set environment variables using the following:

    export BUCKET=cert-discovery-management-app
    export REGION=eu-north-1
  4. Create the S3 bucket with this command:

    aws s3api create-bucket \
      --bucket $BUCKET \
      --region $REGION \
      --create-bucket-configuration LocationConstraint=$REGION

Note

For eu-north-1 region, you must use --create-bucket-configuration with LocationConstraint=$REGION.

  1. Now we’ll create a credentials file for Velero. OADP packages upstream Velero, which is the underlying open source engine that performs the backup and restore of Kubernetes resources and persistent volumes. 

    cat > /tmp/credentials-velero <<EOF
    [default]
    aws_access_key_id=<AWS_ACCESS_KEY_ID>
    aws_secret_access_key=<AWS_SECRET_ACCESS_KEY>
    EOF

Note

Replace <AWS_ACCESS_KEY_ID> and <AWS_SECRET_ACCESS_KEY> with your actual AWS credentials.

  1. Finally, we’ll create a secret in OpenShift:

    oc create secret generic cloud-credentials \
      -n openshift-adp \
      --from-file cloud=/tmp/credentials-velero

Important

For this walkthrough, the Secret must be named cloud-credentials and the key must be cloud.

  1. Verify the secret was created:

    oc get secret cloud-credentials -n openshift-adp
  2. Clean up the credentials file as the last configuration step:

    rm /tmp/credentials-velero

Now that the configurations are complete, we’re ready to tackle the installation of the DataProtectionApplication (DPA).

Installing DataProtectionApplication 

The DPA configures the connection between OADP and your backup storage.

  1. In the console, input the following:

    cat <<EOF | oc apply -f -
    apiVersion: oadp.openshift.io/v1alpha1
    kind: DataProtectionApplication
    metadata:
      name: velero-management
      namespace: openshift-adp
    spec:
      configuration:
        velero:
          defaultPlugins:
            - openshift
            - aws
          resourceTimeout: 10m
        nodeAgent:
          enable: true
          uploaderType: kopia
      backupLocations:
        - name: default
          velero:
            provider: aws
            default: true
            objectStorage:
              bucket: cert-discovery-management-app
              prefix: management-export
            config:
              region: eu-north-1
              profile: "default"
            credential:
              name: cloud-credentials
              key: cloud
    EOF
  2. Each field corresponds to specific needs for various backup functions:

Field

Value

Description

defaultPlugins

openshift, aws

Required plugins for OpenShift and AWS S3.

nodeAgent.enable

true

Enables DaemonSet for PV backup.

uploaderType

kopia

Uses Kopia for file-level PV backup (default in OADP 1.3+).

bucket

cert-discovery-management-app

S3 bucket name.

prefix

management-export

S3 path prefix for backups.

region

eu-north-1

AWS region.


Now we’ll want to verify the status of the install, as well as verify our backup location. This can be done by proceeding with the following steps:

  1. Wait for DPA to reconcile using this command:

    oc get dpa -n openshift-adp
  2. Expected output:

    NAME                RECONCILED   AGE
    velero-management   True         45s
  3. Check all OADP pods are running:

    oc get pods -n openshift-adp
  4. Expected output:

    NAME                                                READY   STATUS    RESTARTS   AGE
    node-agent-xxxxx                                    1/1     Running   0          60s
    node-agent-yyyyy                                    1/1     Running   0          60s
    node-agent-zzzzz                                    1/1     Running   0          60s
    openshift-adp-controller-manager-xxxxx              1/1     Running   0          3m
    velero-xxxxx                                        1/1     Running   0          60s

Note

You should see one node-agent pod per worker node in the cluster.

  1.  Check BackupStorageLocation status:

    oc get backupstoragelocation -n openshift-adp

    Expected output:

    NAME      PHASE       LAST VALIDATED   AGE   DEFAULT
    default   Available   35s              87m   true

The PHASE must appear as Available before you can create backups.

Next, we can move on to creating the backup of our bare metal cluster. 

Previous resource
Prepare your bare metal cluster for migration
Next resource
Create a backup from the initial cluster