In the first blog posts of this series, we introduced the basic concepts for Application Lifecycle on 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 by using Advanced Cluster Management.
In the third blog post, we migrated our application across different regions by using 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 |
Disaster Recovery on Red Hat Advanced Cluster Management
In the previous post we migrated our application across different regions using PlacementRules.
In this blog post we are going to see how PlacementRules can help us with a basic Disaster Recovery scenario.
Configuring required Advanced Cluster Managemen manifests
We will re-use the Red Hat Advanced Cluster Management manifests used in the previous blog post, which means that we will be using the Namespace reverse-words-region and the Subscription reversewords-region-app-subscription.
We will need to create a new PlacementRule. This time we will include new properties to our PlacementRule; let's review them:
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
name: us-eu-region-clusters
namespace: reverse-words-region
spec:
clusterConditions:
- type: "ManagedClusterConditionAvailable"
status: "True"
clusterSelector:
matchExpressions:
- key: region
operator: In
values:
- EU
- US
matchLabels: {}
clusterReplicas: 1
- We are using the
matchExpressionsproperty in order to match any cluster that has a labelregionwith a value of eitherEUorUS. - We are using the
clusterReplicasproperty in order to get only one of the clusters that match the previous expression. - Additionally, we are matching only
healthyclusters.
This new PlacementRule will make sure that in case one of the clusters moves to a non-healthy state, the cluster returned by the PlacementRule changes to one on the list that has a healthy state.
Configuring Subscription to use the new PlacementRule
-
Let's create the
PlacementRulediscussed in the previous section.oc --context hub create -f https://raw.githubusercontent.com/RHsyseng/acm-app-lifecycle-blog/master/acm-manifests/reversewords-region/05_placement_rule_DR.yamlIf we look at the clusters reported by the PlacementRule, we will only see one cluster (
Productionin this case).oc --context hub -n reverse-words-region get placementrule us-eu-region-clusters -o yaml<OMITTED_OUTPUT>
status:
decisions:
- clusterName: managed-cluster1-dev
clusterNamespace: managed-cluster1-dev -
Now we can go ahead and update the Subscription we used in the previous blog post. We are going to patch it to use the new
PlacementRulewe just created.oc --context hub -n reverse-words-region patch subscription.apps.open-cluster-management.io/reversewords-region-app-subscription -p '{"spec":{"placement":{"placementRef":{"name":"us-eu-region-clusters"}}}}' --type=merge -
The application will run in
EUcluster (Development). See the following commands and output: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 42s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/reverse-words LoadBalancer 172.30.185.94 a520ed21ff982452abeacf63b0b58cc5-31012041.eu-central-1.elb.amazonaws.com 8080:32283/TCP 42s
NAME READY STATUS RESTARTS AGE
pod/reverse-words-68795d69ff-crzqp 1/1 Running 0 42s -
Now, I'm going to destroy my
EUcluster in order to simulate a disaster; let's see what happens.NOTE: We actually destroyed the cluster, if you want to try this without destroying your cluster, you can remove the
region: EUlabel from the cluster-
As soon as Red Hat Advanced Cluster Management detects my
EUcluster is gone, thePlacementRulegets updated and now it points to theUScluster.oc --context hub -n reverse-words-region get placementrule us-eu-region-clusters -o yamlThe
PlacementRulenow points toUScluster.<OMITTED_OUTPUT>
status:
decisions:
- clusterName: managed-cluster2-prod
clusterNamespace: managed-cluster2-prod -
The application has been moved automatically to the
UScluster.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 76s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/reverse-words LoadBalancer 172.30.187.142 a1c7d218d901c40ac98375f4a9474084-1310645059.us-west-2.elb.amazonaws.com 8080:31095/TCP 78s
NAME READY STATUS RESTARTS AGE
pod/reverse-words-68795d69ff-ttzz5 1/1 Running 0 77s
-
-
When the
EUcluster is online again, it will get added to thePlacementRuleagain automatically
Closing Thoughts
During this blog posts series we have discovered the basics around Application Lifecycle management using Red Hat Advanced Cluster Management.
Feel free to share your comments and keep exploring other Red Hat Advanced Cluster Management related blog posts.
Sobre el autor
Más como éste
Looking ahead to 2026: Red Hat’s view across the hybrid cloud
Red Hat to acquire Chatterbox Labs: Frequently Asked Questions
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