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.
저자 소개
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
오리지널 쇼
엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리
제품
- Red Hat Enterprise Linux
- Red Hat OpenShift Enterprise
- Red Hat Ansible Automation Platform
- 클라우드 서비스
- 모든 제품 보기
툴
체험, 구매 & 영업
커뮤니케이션
Red Hat 소개
Red Hat은 Linux, 클라우드, 컨테이너, 쿠버네티스 등을 포함한 글로벌 엔터프라이즈 오픈소스 솔루션 공급업체입니다. Red Hat은 코어 데이터센터에서 네트워크 엣지에 이르기까지 다양한 플랫폼과 환경에서 기업의 업무 편의성을 높여 주는 강화된 기능의 솔루션을 제공합니다.