You can migrate application workloads from OpenShift Container Platform 4.2 to 4.4 with the Cluster Application Migration (CAM) tool. The CAM tool enables you to control the migration and to minimize application downtime.
The CAM tool’s web console and API, based on Kubernetes Custom Resources, enable you to migrate stateful and stateless application workloads at the granularity of a namespace.
You must have
cluster-admin privileges on all clusters.
The source and target clusters must have unrestricted network access to the replication repository.
The cluster on which the Migration controller is installed must have unrestricted access to the other clusters.
If your application uses images from the
openshift namespace, the required versions of the images must be present on the target cluster.
If the required images are not present, you must update the
imagestreamtags references to use an available version that is compatible with your application. If the
imagestreamtags cannot be updated, you can manually upload equivalent images to the application namespaces and update the applications to reference them.
imagestreamtags have been removed from OpenShift Container Platform 4.4:
nodejs: 8, 8-RHOAR, 10-SCL
php: 7.0, 7.1
The Cluster Application Migration (CAM) tool enables you to migrate Kubernetes resources, persistent volume data, and internal container images from an OpenShift Container Platform source cluster to an OpenShift Container Platform 4.4 target cluster, using the CAM web console or the Kubernetes API.
Migrating an application with the CAM web console involves the following steps:
Install the Cluster Application Migration Operator on all clusters.
The Cluster Application Migration Operator installs the CAM tool (CAM web console and Migration controller) on the target cluster by default. You can configure the Migration controller to install the CAM tool on another cluster. The cluster on which the CAM tool is installed is referred to as the CAM tool cluster.
Configure the replication repository, an intermediate object storage that the CAM tool uses to migrate data.
Add the source cluster to the CAM web console.
Add the replication repository to the CAM web console.
Create a migration plan, with one of the following data migration options:
Copy: The CAM tool copies the data from the source cluster to the replication repository, and from the replication repository to the target cluster.
Move: The CAM tool unmounts a remote volume (for example, NFS) from the source cluster, creates a PV resource on the target cluster pointing to the remote volume, and then mounts the remote volume on the target cluster. Applications running on the target cluster use the same remote volume that the source cluster was using. The remote volume must be accessible to the source and target clusters.
Although the replication repository does not appear in this diagram, it is required for the actual migration.
Run the migration plan, with one of the following options:
Stage (optional) copies data to the target cluster without stopping the application.
Staging can be run multiple times so that most of the data is copied to the target before migration. This minimizes the actual migration time and application downtime.
Migrate stops the application on the source cluster and recreates its resources on the target cluster. Optionally, you can migrate the workload without stopping the application.
You can use migration hooks to run Ansible playbooks at certain points during the migration. The hooks are added when you create a migration plan.
If you do not want to use Ansible playbooks, you can create a custom container image and add it to a migration plan.
Migration hooks perform tasks such as customizing application quiescence, manually migrating unsupported data types, and updating applications after migration.
A single migration hook runs on a source or target cluster at one of the following migration steps:
PreBackup: Before backup tasks are started on the source cluster
PostBackup: After backup tasks are complete on the source cluster
PreRestore: Before restore tasks are started on the target cluster
PostRestore: After restore tasks are complete on the target cluster
You can assign one hook to each migration step, up to a maximum of four hooks for a single migration plan.
hook-runner image is
registry.redhat.io/rhcam-1-2/openshift-migration-hook-runner-rhel7. This image is based on Ansible Runner and includes
python-openshift for Ansible Kubernetes resources and an updated
oc binary. You can also create your own hook image with additional Ansible modules or tools.
The Ansible playbook is mounted on a hook container as a ConfigMap. The hook container runs as a Job on a cluster with a specified service account and namespace. The Job runs, even if the initial Pod is evicted or killed, until it reaches the default
6) or successful completion.