Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Introduction to Tekton and Argo CD for multicluster development

September 3, 2020
Ryan Cook
Related topics:
CI/CDDevOpsKubernetesOperators
Related products:
Red Hat OpenShift Container Platform

Share:

    Over the last two years, my coworkers and I have worked on developing a multicluster project for Kubernetes and Red Hat OpenShift. We needed a way to efficiently deploy applications, oversee access and authorization, and manage application placement across clusters. This need led us to develop with Argo CD and GitOps.

    Recently, I switched to another team that also focuses on multicluster development. During my interviews, I promised to help create a catalog of our projects and develop a process to deploy them rapidly. Together, the catalog and process would allow the team to just work on things, rather than trying to figure out how to get them operational. However, I quickly hit a wall. With Argo CD, I couldn't control when and in what order cluster objects were deployed onto new or existing clusters. Eventually, I discovered Tekton, a powerful addition to my development toolset.

    In this article, I briefly describe my process for developing the catalog and process tool. I'll introduce the components involved, explain a little about how Tekton Pipelines works, and leave you with a tool that you can share with your organization and teams.

    Argo CD and Tekton

    Argo CD watches cluster objects stored in a Git repository and manages the create, update, and delete (CRUD) processes for objects within the repository. Tekton is a CI/CD tool that handles all parts of the development lifecycle, from building images to deploying cluster objects.

    Tekton runs one or more tasks, which launch the appropriate container(s) and execute a specific set of commands. A user can combine a series of tasks to form a Tekton pipeline. In a pipeline to build a container image, for example, the developer pushes the code to a repository. Tekton sees the change and launches a pipeline, which builds the code, creates a container image, and pushes it to the image registry.

    Developing the catalog project

    For the catalog project, I needed to deploy two clusters and connect them using Amazon Web Services (AWS) Virtual Private Cloud (VPC) peering. Then, I needed to deploy objects to both clusters. To start, I installed the OpenShift Operators for Hive and Argo CD. I stored my Hive cluster deployments within a Git repository, then had Argo CD watch the repository to deploy the clusters.

    The issue was that I couldn't get the cluster to import into Argo CD and programmatically create the Argo CD YAML files, which I needed to deploy the Kubernetes objects from the Git repository. To overcome the issue, I used Tekton. The diagram in Figure 1 shows how I used Tekton pipelines to define precisely when each item should be applied to the newly created clusters.

    Diagram showing the flow through the pipeline
    Figure 1: The Tekton pipeline for importing into Argo CD and programmatically creating the Argo CD YAML files.

    Getting started

    I set up the tekton-argocd project repository to help guide you through this workflow. Before getting started, fork the repository. You will add clusters to the /clusters directory. Modify the repository and create the application within Argo CD:

    $ cd ~/git/tekton-argocd
    
    $ sed -i ‘s/cooktheryan/YOURUSERNAME/g’ argo-app/*.yaml
    
    $ oc create -f argo-app
    

    These commands create a multitude of tasks and a pipeline within the Hive namespace, all of which are managed by Argo CD.

    Running a pipeline

    Log into the OpenShift console and select the project hive and the Pipelines menu from the list of available components. You will find your newly created pipelines there. After adding the clusters to your Git repository, specify the required variables as shown:

    Field Value
    pathToYamlFile1 clusters/east1
    pathToYamlFile2 clusters/east2
    cluster1 east1
    cluster2 clusters/east2
    pathToYamlFile3 acm
    git-source Create Pipeline Resource

    Once the dialog box is filled out (see Figure 2), run the pipeline.

    The OpenShift "Start Pipeline" dialog box filled out for the example.
    Figure 2: Specify the required variables, and run the pipeline in the OpenShift console.

    You now have a repeatable process to deploy two clusters, peer them together, and deploy an application to each of the clusters. This operation is possible because Hive saves the kubeconfigs for the newly created clusters as a secret. It then creates a task called remote-cluster-apply, which uses the secret and issues kubectl create -f commands against the Hive-created clusters.

    Within the repository, you will notice additional Tekton pipelines. You can use these pipelines to create a single cluster and remotely apply one or more objects to the cluster. I have included pipelines within the repository cleanup to help with managing the cluster lifecycle.

    Using Tekton for CI and Argo for CD

    Think of pipelines as an extra pair of hands for ensuring that no request or workflow process is ever forgotten. Combining Argo CD and Tekton creates safer and repeatable processes, which allows everyone on the team to be successful. Watch this video to learn more about combining Argo CD and Tekton: GitOps Continued: Using Tekton for CI and Argo for CD.

    Conclusion

    There is no perfect tool to accomplish everything. With this project, I found a way to pair specific tools to create a consistent and repeatable experience. Sharing Tekton tasks among your organization, distributed by Argo CD, allows teams to collaborate and increases team efficiency across the development and operational lifecycles.

    Last updated: October 31, 2023

    Recent Posts

    • More Essential AI tutorials for Node.js Developers

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue