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
Namespace
to 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
PlacementRules
targeting clusters located inEU
andUS
regions.# 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
Subscription
andApplication
.NOTE: The Subscription is currently configured to deploy the application using the
PlacementRule
matching 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
Development
cluster).oc --context dev -n reverse-words-region get deployments,services,pods
NAME 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 (
Production
cluster). See that we don't have any pods running.oc --context pro -n reverse-words-region get deployments,services,pods
No 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
PlacementRule
used by theSubscription
tous-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
EU
cluster toUS
cluster automatically. See the commands and outputs:The application will not run on
EU
(development
cluster) anymore.oc --context dev -n reverse-words-region get deployments,services,pods
No resources found in reverse-words-region namespace.
The application will be running on
US
(production
cluster) now.oc --context pro -n reverse-words-region get deployments,services,pods
NAME 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.
Sull'autore
Ricerca per canale
Automazione
Novità sull'automazione IT di tecnologie, team e ambienti
Intelligenza artificiale
Aggiornamenti sulle piattaforme che consentono alle aziende di eseguire carichi di lavoro IA ovunque
Hybrid cloud open source
Scopri come affrontare il futuro in modo più agile grazie al cloud ibrido
Sicurezza
Le ultime novità sulle nostre soluzioni per ridurre i rischi nelle tecnologie e negli ambienti
Edge computing
Aggiornamenti sulle piattaforme che semplificano l'operatività edge
Infrastruttura
Le ultime novità sulla piattaforma Linux aziendale leader a livello mondiale
Applicazioni
Approfondimenti sulle nostre soluzioni alle sfide applicative più difficili
Serie originali
Raccontiamo le interessanti storie di leader e creatori di tecnologie pensate per le aziende
Prodotti
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Servizi cloud
- Scopri tutti i prodotti
Strumenti
- Formazione e certificazioni
- Il mio account
- Supporto clienti
- Risorse per sviluppatori
- Trova un partner
- Red Hat Ecosystem Catalog
- Calcola il valore delle soluzioni Red Hat
- Documentazione
Prova, acquista, vendi
Comunica
- Contatta l'ufficio vendite
- Contatta l'assistenza clienti
- Contatta un esperto della formazione
- Social media
Informazioni su Red Hat
Red Hat è leader mondiale nella fornitura di soluzioni open source per le aziende, tra cui Linux, Kubernetes, container e soluzioni cloud. Le nostre soluzioni open source, rese sicure per un uso aziendale, consentono di operare su più piattaforme e ambienti, dal datacenter centrale all'edge della rete.
Seleziona la tua lingua
Red Hat legal and privacy links
- Informazioni su Red Hat
- Opportunità di lavoro
- Eventi
- Sedi
- Contattaci
- Blog di Red Hat
- Diversità, equità e inclusione
- Cool Stuff Store
- Red Hat Summit