In the first blog posts of this series, we introduced the basic concepts for Application Lifecycle on Red Hat Advanced Cluster Management and deployed an application to multiple clusters.
In the second blog post, we showed how a Blue/Green deployment can be made using Red Hat Advanced Cluster Management.
If you haven't read the previous blog posts yet, go ahead and read them. This post is a continuation and you will need the context from the previous ones.
We are using the same infrastructure we used in the previous posts. See the following diagram:
NOTE: Pay special attention to the different labels, as they will be used during the blog posts examples.
| Component | Version |
|---|---|
| Red Hat OpenShift Container Platform | 4.5.7 |
| Red Hat Advanced Cluster Management | 2.0 Fix Pack 2.0.2 |
Application Migration on Advanced Cluster Management
In the previous post we upgraded the version of our application in Development and Production clusters using Blue/Green deployment technique.
Now, we are going to explore how Red Hat Advanced Cluster Management enables us to seamlessly move our applications between our different clusters.
Creating new PlacementRules and Subscription
We will create two new PlacementRules targeting clusters in the EU region and US region respectively. Additionally, a new Subscription will be used to deploy our reverse-words application in the region we want the application to run on.
-
Create a new
Namespaceto store the required manifests.oc --context hub create -f https://raw.githubusercontent.com/RHsyseng/acm-app-lifecycle-blog/master/acm-manifests/reversewords-region/00_namespace.yaml -
Create the required
PlacementRulestargeting clusters located inEUandUSregions.# PlacementRule targeting EU region clusters
oc --context hub create -f https://raw.githubusercontent.com/RHsyseng/acm-app-lifecycle-blog/master/acm-manifests/reversewords-region/01_placement_rule_EU.yaml
# PlacementRule targeting US region clusters
oc --context hub create -f https://raw.githubusercontent.com/RHsyseng/acm-app-lifecycle-blog/master/acm-manifests/reversewords-region/02_placement_rule_US.yaml -
Create the
SubscriptionandApplication.NOTE: The Subscription is currently configured to deploy the application using the
PlacementRulematching clusters in EU region.oc --context hub create -f https://raw.githubusercontent.com/RHsyseng/acm-app-lifecycle-blog/master/acm-manifests/reversewords-region/03_subscription-region.yaml
oc --context hub create -f https://raw.githubusercontent.com/RHsyseng/acm-app-lifecycle-blog/master/acm-manifests/reversewords-region/04_application-region.yaml -
Now, we should see our application running in the cluster located in EU (which is our
Developmentcluster).oc --context dev -n reverse-words-region get deployments,services,podsNAME READY UP-TO-DATE AVAILABLE AGE
deployment.extensions/reverse-words 1/1 1 1 4m39s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/reverse-words LoadBalancer 172.30.79.111 a3115b78bce924ddc885d2b7dab766a6-1199935412.eu-central-1.elb.amazonaws.com 8080:30254/TCP 4m39s
NAME READY STATUS RESTARTS AGE
pod/reverse-words-68795d69ff-xmwc6 1/1 Running 0 4m39s -
Run the same query against the cluster located in US (
Productioncluster). See that we don't have any pods running.oc --context pro -n reverse-words-region get deployments,services,podsNo resources found in reverse-words-region namespace.
Migrating our Application
Let's say that due to some law enforcement, our application cannot run on EU servers anymore and we need to move it to US-based servers. We can do that with a single command.
If you remember, we created two PlacementRules, one matching EU servers and another matching US servers. We will patch our Subscription so it stops using EU based servers PlacementRule and starts using US based servers PlacementRule.
Changing the PlacementRule used by our Subscription will move our application from one region to the other automatically.
-
Patch the
Subscription.The following patch updates the
PlacementRuleused by theSubscriptiontous-region-clusters.oc --context hub -n reverse-words-region patch subscription.apps.open-cluster-management.io/reversewords-region-app-subscription -p '{"spec":{"placement":{"placementRef":{"name":"us-region-clusters"}}}}' --type=merge -
Our application will be moved from
EUcluster toUScluster automatically. See the commands and outputs:The application will not run on
EU(developmentcluster) anymore.oc --context dev -n reverse-words-region get deployments,services,podsNo resources found in reverse-words-region namespace.The application will be running on
US(productioncluster) now.oc --context pro -n reverse-words-region get deployments,services,podsNAME READY UP-TO-DATE AVAILABLE AGE
deployment.extensions/reverse-words 1/1 1 1 92s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/reverse-words LoadBalancer 172.30.177.196 a90273a7fa3ea4015989fac522b6b36e-709976322.us-west-2.elb.amazonaws.com 8080:30375/TCP 2m33s
NAME READY STATUS RESTARTS AGE
pod/reverse-words-68795d69ff-jlktw 1/1 Running 0 92s
As you just saw, by using PlacementRules you can migrate your applications between clusters easily. We just used a region-based PlacementRule, but the PlacementRule can be based on any labels configured on your clusters.
What's next
In the next blog post of this series we will be demonstrating how Red Hat Advanced Cluster Management can help us in a Disaster Recovery scenario.
Sobre el autor
Más como éste
Key considerations for 2026 planning: Insights from IDC
Red Hat and Sylva unify the future for telco cloud
Crack the Cloud_Open | Command Line Heroes
Edge computing covered and diced | Technically Speaking
Navegar por canal
Automatización
Las últimas novedades en la automatización de la TI para los equipos, la tecnología y los entornos
Inteligencia artificial
Descubra las actualizaciones en las plataformas que permiten a los clientes ejecutar cargas de trabajo de inteligecia artificial en cualquier lugar
Nube híbrida abierta
Vea como construimos un futuro flexible con la nube híbrida
Seguridad
Vea las últimas novedades sobre cómo reducimos los riesgos en entornos y tecnologías
Edge computing
Conozca las actualizaciones en las plataformas que simplifican las operaciones en el edge
Infraestructura
Vea las últimas novedades sobre la plataforma Linux empresarial líder en el mundo
Aplicaciones
Conozca nuestras soluciones para abordar los desafíos más complejos de las aplicaciones
Virtualización
El futuro de la virtualización empresarial para tus cargas de trabajo locales o en la nube