This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.2.3. Configuring object storage for a replication repository
You must configure an object storage to use as a replication repository. The Migration Toolkit for Containers (MTC) copies data from the source cluster to the replication repository, and then from the replication repository to the target cluster.
MTC supports the file system and snapshot data copy methods for migrating data from the source cluster to the target cluster. You can select a method that is suited for your environment and is supported by your storage provider.
The following storage providers are supported:
- Multi-Cloud Object Gateway (MCG)
- Amazon Web Services (AWS) S3
- Google Cloud Provider (GCP)
- Microsoft Azure
- Generic S3 object storage, for example, Minio or Ceph S3
In a restricted environment, you can create an internally hosted replication repository.
Prerequisites
- All clusters must have uninterrupted network access to the replication repository.
- If you use a proxy server with an internally hosted replication repository, you must ensure that the proxy allows access to the replication repository.
You can install the OpenShift Container Storage Operator and configure a Multi-Cloud Object Gateway (MCG) storage bucket as a replication repository for the Migration Toolkit for Containers (MTC).
You can install the OpenShift Container Storage Operator from OperatorHub.
Procedure
-
In the OpenShift Container Platform web console, click Operators
OperatorHub. - Use Filter by keyword (in this case, OCS) to find the OpenShift Container Storage Operator.
- Select the OpenShift Container Storage Operator and click Install.
- Select an Update Channel, Installation Mode, and Approval Strategy.
Click Install.
On the Installed Operators page, the OpenShift Container Storage Operator appears in the openshift-storage project with the status Succeeded.
You can create the Multi-Cloud Object Gateway (MCG) storage bucket’s custom resources (CRs).
Procedure
Log in to the OpenShift Container Platform cluster:
oc login
$ oc login
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
NooBaa
CR configuration file,noobaa.yml
, with the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
NooBaa
object:oc create -f noobaa.yml
$ oc create -f noobaa.yml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
BackingStore
CR configuration file,bs.yml
, with the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
BackingStore
object:oc create -f bs.yml
$ oc create -f bs.yml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
BucketClass
CR configuration file,bc.yml
, with the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
BucketClass
object:oc create -f bc.yml
$ oc create -f bc.yml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
ObjectBucketClaim
CR configuration file,obc.yml
, with the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Record the bucket name for adding the replication repository to the MTC web console.
Create the
ObjectBucketClaim
object:oc create -f obc.yml
$ oc create -f obc.yml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Watch the resource creation process to verify that the
ObjectBucketClaim
status isBound
:watch -n 30 'oc get -n openshift-storage objectbucketclaim migstorage -o yaml'
$ watch -n 30 'oc get -n openshift-storage objectbucketclaim migstorage -o yaml'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This process can take five to ten minutes.
Obtain and record the following values, which are required when you add the replication repository to the MTC web console:
S3 endpoint:
oc get route -n openshift-storage s3
$ oc get route -n openshift-storage s3
Copy to Clipboard Copied! Toggle word wrap Toggle overflow S3 provider access key:
oc get secret -n openshift-storage migstorage -o go-template='{{ .data.AWS_ACCESS_KEY_ID }}' | base64 --decode
$ oc get secret -n openshift-storage migstorage -o go-template='{{ .data.AWS_ACCESS_KEY_ID }}' | base64 --decode
Copy to Clipboard Copied! Toggle word wrap Toggle overflow S3 provider secret access key:
oc get secret -n openshift-storage migstorage -o go-template='{{ .data.AWS_SECRET_ACCESS_KEY }}' | base64 --decode
$ oc get secret -n openshift-storage migstorage -o go-template='{{ .data.AWS_SECRET_ACCESS_KEY }}' | base64 --decode
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can configure an AWS S3 storage bucket as a replication repository for the Migration Toolkit for Containers (MTC).
Prerequisites
- The AWS S3 storage bucket must be accessible to the source and target clusters.
- You must have the AWS CLI installed.
If you are using the snapshot copy method:
- You must have access to EC2 Elastic Block Storage (EBS).
- The source and target clusters must be in the same region.
- The source and target clusters must have the same storage class.
- The storage class must be compatible with snapshots.
Procedure
Create an AWS S3 bucket:
aws s3api create-bucket \ --bucket <bucket_name> \ --region <bucket_region>
$ aws s3api create-bucket \ --bucket <bucket_name> \
1 --region <bucket_region>
2 Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the IAM user
velero
:aws iam create-user --user-name velero
$ aws iam create-user --user-name velero
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an EC2 EBS snapshot policy:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an AWS S3 access policy for one or for all S3 buckets:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
"Resource": [ "arn:aws:s3:::*"
"Resource": [ "arn:aws:s3:::*"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Attach the EC2 EBS policy to
velero
:aws iam put-user-policy \ --user-name velero \ --policy-name velero-ebs \ --policy-document file://velero-ec2-snapshot-policy.json
$ aws iam put-user-policy \ --user-name velero \ --policy-name velero-ebs \ --policy-document file://velero-ec2-snapshot-policy.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Attach the AWS S3 policy to
velero
:aws iam put-user-policy \ --user-name velero \ --policy-name velero-s3 \ --policy-document file://velero-s3-policy.json
$ aws iam put-user-policy \ --user-name velero \ --policy-name velero-s3 \ --policy-document file://velero-s3-policy.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an access key for
velero
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can configure a Google Cloud Provider (GCP) storage bucket as a replication repository for the Migration Toolkit for Containers (MTC).
Prerequisites
- The GCP storage bucket must be accessible to the source and target clusters.
-
You must have
gsutil
installed. If you are using the snapshot copy method:
- The source and target clusters must be in the same region.
- The source and target clusters must have the same storage class.
- The storage class must be compatible with snapshots.
Procedure
Log in to
gsutil
:gsutil init
$ gsutil init
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Welcome! This command will take you through the configuration of gcloud. Your current configuration has been set to: [default] To continue, you must login. Would you like to login (Y/n)?
Welcome! This command will take you through the configuration of gcloud. Your current configuration has been set to: [default] To continue, you must login. Would you like to login (Y/n)?
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
BUCKET
variable:BUCKET=<bucket_name>
$ BUCKET=<bucket_name>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify your bucket name.
Create a storage bucket:
gsutil mb gs://$BUCKET/
$ gsutil mb gs://$BUCKET/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
PROJECT_ID
variable to your active project:PROJECT_ID=`gcloud config get-value project`
$ PROJECT_ID=`gcloud config get-value project`
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
velero
IAM service account:gcloud iam service-accounts create velero \ --display-name "Velero Storage"
$ gcloud iam service-accounts create velero \ --display-name "Velero Storage"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
SERVICE_ACCOUNT_EMAIL
variable:SERVICE_ACCOUNT_EMAIL=`gcloud iam service-accounts list \ --filter="displayName:Velero Storage" \ --format 'value(email)'`
$ SERVICE_ACCOUNT_EMAIL=`gcloud iam service-accounts list \ --filter="displayName:Velero Storage" \ --format 'value(email)'`
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
ROLE_PERMISSIONS
variable:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
velero.server
custom role:gcloud iam roles create velero.server \ --project $PROJECT_ID \ --title "Velero Server" \ --permissions "$(IFS=","; echo "${ROLE_PERMISSIONS[*]}")"
$ gcloud iam roles create velero.server \ --project $PROJECT_ID \ --title "Velero Server" \ --permissions "$(IFS=","; echo "${ROLE_PERMISSIONS[*]}")"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add IAM policy binding to the project:
gcloud projects add-iam-policy-binding $PROJECT_ID \ --member serviceAccount:$SERVICE_ACCOUNT_EMAIL \ --role projects/$PROJECT_ID/roles/velero.server
$ gcloud projects add-iam-policy-binding $PROJECT_ID \ --member serviceAccount:$SERVICE_ACCOUNT_EMAIL \ --role projects/$PROJECT_ID/roles/velero.server
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the IAM service account:
gsutil iam ch serviceAccount:$SERVICE_ACCOUNT_EMAIL:objectAdmin gs://${BUCKET}
$ gsutil iam ch serviceAccount:$SERVICE_ACCOUNT_EMAIL:objectAdmin gs://${BUCKET}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Save the IAM service account keys to the
credentials-velero
file in the current directory:gcloud iam service-accounts keys create credentials-velero \ --iam-account $SERVICE_ACCOUNT_EMAIL
$ gcloud iam service-accounts keys create credentials-velero \ --iam-account $SERVICE_ACCOUNT_EMAIL
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can configure a Microsoft Azure Blob storage container as a replication repository for the Migration Toolkit for Containers (MTC).
Prerequisites
- You must have an Azure storage account.
- You must have the Azure CLI installed.
- The Azure Blob storage container must be accessible to the source and target clusters.
If you are using the snapshot copy method:
- The source and target clusters must be in the same region.
- The source and target clusters must have the same storage class.
- The storage class must be compatible with snapshots.
Procedure
Set the
AZURE_RESOURCE_GROUP
variable:AZURE_RESOURCE_GROUP=Velero_Backups
$ AZURE_RESOURCE_GROUP=Velero_Backups
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an Azure resource group:
az group create -n $AZURE_RESOURCE_GROUP --location <CentralUS>
$ az group create -n $AZURE_RESOURCE_GROUP --location <CentralUS>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify your location.
Set the
AZURE_STORAGE_ACCOUNT_ID
variable:AZURE_STORAGE_ACCOUNT_ID=velerobackups
$ AZURE_STORAGE_ACCOUNT_ID=velerobackups
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an Azure storage account:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
BLOB_CONTAINER
variable:BLOB_CONTAINER=velero
$ BLOB_CONTAINER=velero
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an Azure Blob storage container:
az storage container create \ -n $BLOB_CONTAINER \ --public-access off \ --account-name $AZURE_STORAGE_ACCOUNT_ID
$ az storage container create \ -n $BLOB_CONTAINER \ --public-access off \ --account-name $AZURE_STORAGE_ACCOUNT_ID
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a service principal and credentials for
velero
:AZURE_SUBSCRIPTION_ID=`az account list --query '[?isDefault].id' -o tsv` \ AZURE_TENANT_ID=`az account list --query '[?isDefault].tenantId' -o tsv` \ AZURE_CLIENT_SECRET=`az ad sp create-for-rbac --name "velero" --role "Contributor" --query 'password' -o tsv` \ AZURE_CLIENT_ID=`az ad sp list --display-name "velero" --query '[0].appId' -o tsv`
$ AZURE_SUBSCRIPTION_ID=`az account list --query '[?isDefault].id' -o tsv` \ AZURE_TENANT_ID=`az account list --query '[?isDefault].tenantId' -o tsv` \ AZURE_CLIENT_SECRET=`az ad sp create-for-rbac --name "velero" --role "Contributor" --query 'password' -o tsv` \ AZURE_CLIENT_ID=`az ad sp list --display-name "velero" --query '[0].appId' -o tsv`
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Save the service principal credentials in the
credentials-velero
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow