DEV Community

Cover image for "Argo CD: A GitOps Tool for Kubernetes Continuous Deployment"
Soram Varma
Soram Varma

Posted on

"Argo CD: A GitOps Tool for Kubernetes Continuous Deployment"

Introduction

In modern DevOps practices, ensuring seamless and automated deployments for Kubernetes applications is crucial. Traditional CI/CD tools like Jenkins often require extensive scripting and lack real-time synchronization with Kubernetes clusters. This is where Argo CD comes in—a GitOps-based continuous deployment tool designed specifically for Kubernetes. In this blog, we will explore what Argo CD is, its architecture, installation process, and why it stands out as a better choice for Kubernetes deployments.

What is GitOps?

It is necessary to understand what GitOps is first:
GitOps is an operational framework that uses Git repositories as the single source of truth for managing infrastructure and application deployment. This approach enables version control, easy rollbacks, and automated synchronization of the actual state with the desired state.

Note: Here, a single source of truth means that any change required for application deployment or infrastructure management must originate from Git. Direct modifications in Kubernetes, Terraform, or other platforms are not allowed, and this ultimately makes it secure and consistent.

What is Argo CD?

Argo CD is a continuous deployment tool for Kubernetes that follows the GitOps approach. It works on a pull-based mechanism, ensuring that the actual state of applications matches the desired state defined in a Git repository. If any discrepancies occur—whether due to manual changes in Kubernetes or updates in Git—Argo CD detects them. However, manual modifications in Kubernetes are not permitted, as they result in an OutOfSync state. Argo CD continuously monitors the Git repository and only applies changes when new updates are detected, ensuring automated synchronization.

Key Features of Argo CD:

  • Declarative, GitOps-based deployment
  • Versioned and Immutable
  • Automated synchronization of desired and actual state
  • UI and CLI for better accessibility
  • Role-Based Access Control (RBAC)
  • Self-healing capabilities
  • Continuous Observation/Monitoring

Argo CD Architecture

API server: It is gRPC server(a high performance Remote Procedure Call framework which uses HTTP/2 for efficient communication) and is the interface which allows users to interact with Argo cd by UI/CLI.

Its responsibilities are:

  • Application management and status report
  • Operations like rollback, sync, etc
  • Credential management of repositories and clusters
  • Allows RBAC

Repo server: This service keeps the local cache of the git repositories that have manifest files and this gets generated and sent to K8s when provided inputs in Argo cd like repo URL, its path(filename), and values if using helm.

Application controller: This service controls Kubernetes which continuously monitors the running application and compares the current state against the desired state. If it's different in state or changes made from the K8s side manually it results in OutOfSync and it reverts back to the desired state on its own which was originally defined in the git repo. This step concludes that ArgoCD has the self-healing ability.

Responsibilities:

  • Detects any configuration drift between the actual and desired state
  • Automatically synchronizes changes when discrepancies occur
  • Ensures self-healing by reverting unauthorized manual changes in Kubernetes

Installing Argo CD

Argo CD is installed directly in a Kubernetes cluster and can be accessed via both UI and CLI.

1. Install Argo CD on Kubernetes

kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Enter fullscreen mode Exit fullscreen mode

This creates an argocd namespace and installs Argo CD components from the official GitHub repository.

2. Expose the Argo CD Service
By default, Argo CD runs with a ClusterIP service. To access it externally, change it to NodePort:

kubectl edit service/argocd-server -n argocd
Enter fullscreen mode Exit fullscreen mode

Modify the type field from ClusterIP to NodePort and save the changes.

3. Retrieve Argo CD Admin Password
Argo CD’s default username is admin, and the password is stored in a Kubernetes secret:

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

Use this password to log in via the web UI.

4. To Install and Access Argo CD via CLI

curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd
rm argocd-linux-amd64
Enter fullscreen mode Exit fullscreen mode

To log in via CLI:

argocd login <server-host>
Enter fullscreen mode Exit fullscreen mode

Retrieve the initial admin password using:

argocd admin initial-password -n argocd
Enter fullscreen mode Exit fullscreen mode

Why Use Argo CD Over Jenkins?

Jenkins is widely used for CI/CD, but when it comes to Kubernetes deployments, it has limitations:

  • Jenkins requires scripts for automation, whereas Argo CD follows a declarative approach.
  • Jenkins does not monitor Kubernetes clusters for state changes, whereas Argo CD continuously syncs the actual and desired states.
  • Argo CD provides a UI and CLI specifically designed for Kubernetes deployment workflows.
  • Argo CD supports Helm, and native YAML, making it flexible for various deployment strategies.

Alternatives to Argo CD

Another popular GitOps tool is Flux CD, which also follows a pull-based deployment model. The choice between Argo CD and Flux CD depends on specific use cases:
Argo CD is better for teams requiring a UI, RBAC, and advanced deployment strategies.
Flux CD is lightweight and integrates well with Kubernetes-native tooling like Helm Operator.

Conclusion

Argo CD simplifies Kubernetes application deployment by automating synchronization with Git repositories. Its pull-based mechanism ensures self-healing capabilities, reducing the chances of manual errors. Compared to traditional CI/CD tools like Jenkins, Argo CD provides a more Kubernetes-native approach to continuous deployment.

If you are managing Kubernetes applications and want a robust, automated GitOps workflow, Argo CD is a powerful tool worth integrating into your DevOps pipeline.
Happy CD! 🚀

Hot sauce if you're wrong - web dev trivia for staff engineers

Hot sauce if you're wrong · web dev trivia for staff engineers (Chris vs Jeremy, Leet Heat S1.E4)

  • Shipping Fast: Test your knowledge of deployment strategies and techniques
  • Authentication: Prove you know your OAuth from your JWT
  • CSS: Demonstrate your styling expertise under pressure
  • Acronyms: Decode the alphabet soup of web development
  • Accessibility: Show your commitment to building for everyone

Contestants must answer rapid-fire questions across the full stack of modern web development. Get it right, earn points. Get it wrong? The spice level goes up!

Watch Video 🌶️🔥

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

If this article connected with you, consider tapping ❤️ or leaving a brief comment to share your thoughts!

Okay