Page
Install OADP on your management 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:
Export the cluster:
export KUBECONFIG=~/kubeconfig-pm-clusterCreate the OADP namespace:
cat <<EOF | oc apply -f - apiVersion: v1 kind: Namespace metadata: name: openshift-adp EOFCreate 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 EOFCreate 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:
- In the OpenShift Container Platform web console, click Operators → OperatorHub.
- Search for OADP Operator in the search field.
- Select the OADP Operator and click Install.
- 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
- Click Install.
Once you’ve finished either method for installing OADP, you’ll have to verify the operator is installed.
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=300sThen you’ll verify the OADP operator version:
oc get csv -n openshift-adp | grep oadp-operatorAnd 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.
First, use the following command in the console to configure your AWS credentials:
aws configureYou 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: jsonIf you already have credentials, you can verify access using
aws sts get-caller-identity.Next, you’ll set environment variables using the following:
export BUCKET=cert-discovery-management-app export REGION=eu-north-1Create 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.
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.
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.
Verify the secret was created:
oc get secret cloud-credentials -n openshift-adpClean 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.
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 EOFEach field corresponds to specific needs for various backup functions:
Field | Value | Description |
|---|---|---|
|
| Required plugins for OpenShift and AWS S3. |
|
| Enables DaemonSet for PV backup. |
|
| Uses Kopia for file-level PV backup (default in OADP 1.3+). |
|
| S3 bucket name. |
|
| S3 path prefix for backups. |
|
| 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:
Wait for DPA to reconcile using this command:
oc get dpa -n openshift-adpExpected output:
NAME RECONCILED AGE velero-management True 45sCheck all OADP pods are running:
oc get pods -n openshift-adpExpected 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.
Check
BackupStorageLocationstatus:oc get backupstoragelocation -n openshift-adpExpected 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.