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 o autor
Mais como este
Red Hat and Sylva unify the future for telco cloud
NetApp’s certified OpenShift operator for Trident
Edge computing covered and diced | Technically Speaking
Navegue por canal
Automação
Últimas novidades em automação de TI para empresas de tecnologia, equipes e ambientes
Inteligência artificial
Descubra as atualizações nas plataformas que proporcionam aos clientes executar suas cargas de trabalho de IA em qualquer ambiente
Nuvem híbrida aberta
Veja como construímos um futuro mais flexível com a nuvem híbrida
Segurança
Veja as últimas novidades sobre como reduzimos riscos em ambientes e tecnologias
Edge computing
Saiba quais são as atualizações nas plataformas que simplificam as operações na borda
Infraestrutura
Saiba o que há de mais recente na plataforma Linux empresarial líder mundial
Aplicações
Conheça nossas soluções desenvolvidas para ajudar você a superar os desafios mais complexos de aplicações
Virtualização
O futuro da virtualização empresarial para suas cargas de trabalho on-premise ou na nuvem