DEV Community

Cover image for Introducing ArgoCD: A GitOps Approach to Continuous Deployment
Panchanan Panigrahi
Panchanan Panigrahi

Posted on • Updated on

Introducing ArgoCD: A GitOps Approach to Continuous Deployment

What is a CI/CD pipeline? 🔄

A CI/CD (Continuous Integration/Continuous Deployment) pipeline automates software delivery processes, ensuring frequent code integrations, tests, and deployment. It starts with Continuous Integration, merging code changes regularly, followed by Continuous Deployment, automating the release to production, enabling faster, more reliable software delivery.

CI/CD pipeline

Why do we need to decouple CD pipeline from CI pipeline? 🤔

Decoupling CD from CI enhances flexibility in software release cycles. It allows independent scaling, optimizations, and customization of deployment processes. This separation prevents bottlenecks, enabling tailored strategies for testing, deployment, and release, fostering a more efficient and adaptable development workflow.

What is GitOps?

GitOps is a DevOps methodology where the entire system state is declared and managed in a Git repository. Automation tools use Git as the single source of truth to continuously deploy and update infrastructure and applications.

GitOps

What is ArgoCD ❓

ArgoCD is an open-source Continuous Delivery tool used for deploying and managing applications in Kubernetes clusters. It utilizes a GitOps approach, syncing the desired application state defined in Git repositories with the actual state in the cluster, ensuring consistency and enabling automated deployments and updates.

ArgoCD

Advantages of using GitOps with ArgoCD 🌟

  1. Enhanced Collaboration: Facilitates team collaboration by using Git as a single source of truth, enabling code reviews, versioning, and collaboration among team members. 👥
  2. Auditability and Rollbacks: Offers a transparent audit trail of changes, allowing easy rollbacks to previously known working states by reverting changes in the Git repository. 🔍
  3. Scalability and Efficiency: Scales well for complex applications, enabling efficient management of multiple environments and configurations with minimal human intervention. 🚀

How does ArgoCD Work? 🤔

Let's understand it through a diagram.

ArgoCD works

Now, a step-by-step breakdown of how ArgoCD works from code commit to deployment on k8s:

  • Developers send source code to the Source Code Repo; then, the CI pipeline tool updates the deployment configuration in the GitOps Repo.
  • The DevOps team can also commit Deployment Manifests to the GitOps Repo.
  • ArgoCD is configured to watch a specific Git repository and branch where the code changes are stored.
  • ArgoCD continuously monitors the designated Git repository for changes Through a Pull-Based Model.
  • When developers push changes, ArgoCD detects the modifications in the Git repository.
  • ArgoCD compares the code changes in the Git repository (desired state) with the current state of applications in the Kubernetes cluster.
  • If there are disparities between the desired and current states, ArgoCD initiates a synchronization process.
  • ArgoCD automates the deployment process based on code changes, updating the Kubernetes cluster to match the desired state.
  • After deployment, ArgoCD verifies that the changes meet specified criteria. In the event of issues, ArgoCD seamlessly performs automated rollbacks, reverting to the previous known stable state for a reliable and consistent application environment.
  • ArgoCD continues to monitor the Git repository for new changes, repeating the process to maintain a continuous deployment cycle.

Installation of ArgoCD in K8S Cluster 🛠️

Prerequisites:

  • Any k8s cluster
  • Docker Engine
  • Kubectl
  • Helm
  • Github Account
  • Dockerhub Account

Install ArgoCD:

kubectl create namespace argocd
helm repo add argo https://argoproj.github.io/argo-helm
helm repo update
helm install argocd argo/argo-cd --namespace argocd
Enter fullscreen mode Exit fullscreen mode

Access ArgoCD UI on Port 8080:

kubectl port-forward svc/argocd-server -n argocd 8080:443
Enter fullscreen mode Exit fullscreen mode

The Login UI will look like the image below: We have to provide the Username and Password.

Login UI

The initial Username is admin

To get the password, run this command:

kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 --decode
Enter fullscreen mode Exit fullscreen mode

In our upcoming blog, we'll dive into deploying an application using ArgoCD. Until then, take care and have a fantastic day ahead! 🎉🌈

Top comments (0)