The GitOps Way Tools for Success

  • June 23, 2021
Blue digital boxes illustrating a workflow
Weaveworks minted the term GitOps in 2017 and since then, interest has slowly grown. Often intertwined with DevOps and Agile, GitOps is the practice and process of adapting DevOps processes like continuous integration (CI) and continuous delivery (CD) for infrastructure as code (IaC). (If you missed the first blog in this two-part series on what is GitOps, GitOps processes and GitOps concepts, you can find it here.) As the use of IaC, containers and Kubernetes grows, so too does GitOps popularity. To facilitate these goals are a new breed of tool.

GitOps Tools

While many tools help achieve GitOps CI objectives, CD into Kubernetes requires a specialized GitOps operator which achieves GitOps CD objectives. This GitOps operator is a Kubernetes controller which extends the Kubernetes API to provide the GitOps operator functionality. A simple GitOps operator when triggered will clone the Git repo and discover the resources and their manifest files, detect changes to the manifest files and apply them to the target cluster. A few GitOps CD tools available include FluxCD, Argo CD and JenkinsX.

In this blog, we explain the functionality of GitOps CD using a tool called Argo CD to illustrate.

Argo CD is a GitOps CD tool for Kubernetes. The core component of Argo CD is the Application Controller, which continuously monitors running applications and compares the live application state against the desired target state defined in the Git repository.

Argo CD ogranizes resources into applications and projects. Applications contain the following attributes that abstract a real application.

  • Source: Git source repo and path.
  • Destination: Cluster and namespace.
  • Sync status: Tells whether the application resources state deviates from the state stored in the Git Repo. 
  • Health status: Tells whether the application resources are healthy or unhealthy.

A project abstracts multiple applications and provides a way to organize and control access for users. Argo CD automates these three phases in deployment by:

  • Retrieving resource manifests.
  • Detecting and fixing the deviations.
  • Serving the results to end-users.

Argo CD has three components that implement these three CD functions.  

  • argocd-repo-server – Downloads the source Git Repo and generates the resource manifests file using config management tools like Helm or Kustomize. 
  • argocd-application-controller – Loads the cluster state of all the live application resources and compares them with the state returned by the repo-server and patches the resources in the cluster.
  • argocd-api-server – Presents the reconciliation results to users by the api-server. It is a highly available stateless web application. 

Argo CD provides a web-based user interface, CLI, and REST APIs to create and deploy applications.

Deployment in real projects is not as simple as applying manifest files, and it involves a lot of additional tasks. The resource hooks provide for these additional tasks and can be used as lifecycle hooks to run scripts or implement any custom logic using Kubernetes resources like jobs or pods to accomplish pre- and post-deployments tasks. 

GitOps for cloud infrastructure

The GitOps concepts (explained in our first article) for Kubernetes can also be applied to any public cloud using an IaC service like Terraform. Public cloud resources can be created using IaC declaratively through Terraform, which has providers for different public clouds like AWS, Azure, and GCP. The state of an application or environment in the public cloud can be stored in Git and managed only through updates to the Git Repo. Terraform creates a state file when a project is first initialized. It synchronizes up the latest state of the live target system and compares the current state of the system with the state reflected by the project. Terraform then creates a plan to bring the target system to the desired state and applies those changes.   
GitOps helps grow developer productivity by bringing workflows closer to them and has the added benefit of tracking changes to ensure systems remain in a desired state.

Interested in learning more about DevOps, Agile, and the ability to use automation to ensure system state? Subscribe to the Tech Blog below.  

Subscribe to our blog

Maran Gothandaraman

Maran Gothandaraman is a Solution Architect with NTT DATA . He designs/implements cloud solutions that enable digital transformation for enterprises.

Related Blog Posts