Recently, Red Hat launched the Advanced Cluster Management tool, which aims to help organizations overcome the challenges of having applications deployed in multiple clusters and clouds. Red Hat is also actively collaborating with the Tekton project as the solution that will enable teams to build Kubernetes-style delivery pipelines that can fully control and own the complete life cycle of their microservices without having to rely on central teams to maintain and manage a CI server, plugins, and its configurations.
In the last article (see here) we saw how to use Tekton and Red Hat Advanced Cluster Management to deploy an application on multiple namespaces, one for each lifecycle environment (Dev, QA and Prod), using a single OpenShift managed cluster. In this article we are going to expand our use case to deploy that same application using three different clusters, one for Non-Production workloads, another for Production and a last one representing a DR (Disaster Recovery) cluster.
Therefore, our Non-Production cluster will have the Dev and QA projects:
On other hand, in our Production and DR clusters we are going to have exactly the same workload, which is the application production version - in this step we will see how to use the PlacementRule to deploy an application on multiple clusters at once!
In the last article we explored the different RH ACM object types: Application, Channel, PlacementRule and Subscription. We also deployed all three stages on a single cluster, therefore the PlacementRule is equal for all of them. At this time we will change them to be able to deploy the application on different clusters. Let’s check them:
PlacementRule for Dev and QA:
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
name: nonprod-cluster
namespace: etherpad-acm-dev
spec:
clusterConditions:
- type: ManagedClusterConditionAvailable
status: "True"
clusterSelector:
matchLabels:
environment: nonprod
PlacementRule for Prod and DR:
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
name: prd-and-dr-cluster
namespace: etherpad-acm-prd
spec:
clusterConditions:
- type: ManagedClusterConditionAvailable
status: "True"
clusterSelector:
matchExpressions:
- key: environment
operator: In
values:
- prod
- dr
NOTE: My clusters have been tagged with the following labels during their import to RH ACM:
- Non Production Cluster: environment=nonprod
- Production Cluster: environment=prod
- DR Cluster: environment=dr
Let’s run it? The yaml files are in this github repo: https://github.com/giofontana/rhacm-pipelines/tree/master/multipleclusters-multiple-envs
Note that when you create the subscription for prod environment, RH ACM starts the deployment of the etherpad application on two clusters at the same time (Prod and DR).
Therefore, we already addressed how to deploy an application on multiple namespaces in multiple clusters using RH ACM. Now we need to inject what we already have on a Tekton pipeline.
Our pipeline now will cover the following process:
- [TEKTON - TASK creating-namespaces] Create the namespaces on the OpenShift Hub Cluster (where RH ACM is deployed);
- [TEKTON - TASK etherpad-dev-deployment] Create Application, Channel, PlacementRule for NON-PRODUCTION and Subscription;
- [RH ACM - DEV DEPLOYMENT] Deploy etherpad application on etherpad-dev namespace in NON-PRODUCTION cluster
- [TEKTON - TASK etherpad-qa-deployment] Create Application, Channel, PlacementRule for NON-PRODUCTION and Subscription;
- [RH ACM - QA DEPLOYMENT] Deploy etherpad application on etherpad-qa namespace in NON-PRODUCTION cluster
- [TEKTON - TASK etherpad-prd-deployment] Create Application, Channel, PlacementRule for PRODUCTION + DR and Subscription;
- [RH ACM - PROD + DR DEPLOYMENT] Deploy etherpad application on etherpad-prod namespace in PRODUCTION and DR cluster.
Here we can notice something that in my perspective is really valuable about using RH ACM as your deployment tool: You don’t need to change anything in your pipeline because now you need to deploy your application in more clusters - you just need to change the PlacementRule object of the environment you need to change. In the last article we deployed the Dev, QA and Prod application in a single cluster, we are now deploying this same application using three different clusters and what have we changed? Only the PlacementRule object! Very nice right?
To finish our article, let’s see our pipeline in action!
Conclusion
In this article, we improved the application deployment to simulate a more real world scenario using RH ACM and Tekton: Deploy of Dev and QA version of an application in a NON-PRODUCTION cluster and deploy of the Production version in two different clusters (PROD and DR) at the same time. We also saw that, by using RH ACM, we “decouple” the deployment logic from the pipeline and we were able to change the deployment targets by only changing the PlacementRule objects and no changes were needed on the Tekton side.
What did you think? Interesting, right? If you are interested in knowing more about OpenShift Pipelines and Red Hat Advanced Cluster Management for Kubernetes talk to a Red Hatter by filling this form or talking to your Red Hat representative. You can also see more about it on the Red Hat Videos YouTube channel.
{{cta('1ba92822-e866-48f0-8a92-ade9f0c3b6ca')}}
Sobre o autor
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
Programas originais
Veja as histórias divertidas de criadores e líderes em tecnologia empresarial
Produtos
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Red Hat Cloud Services
- Veja todos os produtos
Ferramentas
- Treinamento e certificação
- Minha conta
- Suporte ao cliente
- Recursos para desenvolvedores
- Encontre um parceiro
- Red Hat Ecosystem Catalog
- Calculadora de valor Red Hat
- Documentação
Experimente, compre, venda
Comunicação
- Contate o setor de vendas
- Fale com o Atendimento ao Cliente
- Contate o setor de treinamento
- Redes sociais
Sobre a Red Hat
A Red Hat é a líder mundial em soluções empresariais open source como Linux, nuvem, containers e Kubernetes. Fornecemos soluções robustas que facilitam o trabalho em diversas plataformas e ambientes, do datacenter principal até a borda da rede.
Selecione um idioma
Red Hat legal and privacy links
- Sobre a Red Hat
- Oportunidades de emprego
- Eventos
- Escritórios
- Fale com a Red Hat
- Blog da Red Hat
- Diversidade, equidade e inclusão
- Cool Stuff Store
- Red Hat Summit