Skip to content

Discovering ArgoCD in DevOps

Overview

ArgoCD is an open-source continuous delivery tool tailored for Kubernetes environments. It streamlines the deployment and lifecycle management of applications within Kubernetes clusters, offering a clear and declarative approach to navigating the GitOps workflow. This guide is crafted to walk you through the advantages of ArgoCD, its foundational setup, and typical use cases in the realm of DevOps.


Benefits of ArgoCD

GitOps Workflow

ArgoCD adheres to the GitOps paradigm, where the desired state of applications is defined and version-controlled in a Git repository. This method ensures that the entire system's configuration is stored centrally, facilitating easy tracking of changes and rollbacks.

Declarative Configurations

ArgoCD leverages declarative YAML files to articulate the desired state of applications. This simplifies the configuration process and improves version control, making it more manageable to oversee and replicate deployments.

Automated Synchronization

Continuous monitoring of the Git repository by ArgoCD ensures automatic synchronization with the Kubernetes cluster based on the desired state. This automation minimizes manual intervention, ensuring the cluster consistently aligns with predefined configurations.

Multi-Environment Support

Designed to support multiple environments, ArgoCD enables efficient management and deployment of applications across diverse development, testing, and production environments.

Auditability and Rollback

ArgoCD meticulously logs every deployment and synchronization event, creating a detailed audit trail. This feature enhances accountability and simplifies the process of rolling back to prior states in case of issues.


Common Use Cases

Continuous Delivery

ArgoCD supports automated and continuous delivery pipelines, ensuring seamless deployment and updates of applications.

Rollbacks and Rollforwards

Effortlessly roll back to a previous application state in case of issues, or roll forward to apply the latest changes.

Multi-Tenancy

Efficiently manage and deploy applications for different teams or projects within a shared Kubernetes cluster, providing isolation and resource optimization.

Observability

Integrate ArgoCD with monitoring and logging tools to gain insights into the performance and health of deployed applications.

Infrastructure as Code (IaC)

Extend the GitOps workflow to encompass infrastructure configurations, enabling a comprehensive IaC approach.


Installation and Configuration

  1. Install ArgoCD
kubectl create namespace argocd

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
  1. Install ArgoCD CLI
brew install argocd
  1. Change the ArgoCD service type to LoadBalancer
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
  1. Port forward the service to access it locally
kubectl port-forward svc/argocd-server -n argocd 8080:443
  1. Get the initial admin password
argocd admin initial-password -n argocd
  1. Access the ArgoCD instance at https://localhost:8080


For more information on installation and configuration click here

Syncing and Rollback

Syncing Applications

Automatic Sync:

ArgoCD automatically syncs applications based on changes detected in the Git repository. This ensures that the live state of applications matches the desired state defined in the repository.

Manual Sync:

Developers can manually trigger a sync to apply changes immediately. This can be useful for testing or when immediate deployment is required.

argocd app sync my-app

Rollback

Version History: ArgoCD maintains a version history of application configurations. Developers can view the history and identify a specific version to rollback to.

argocd app rollback my-app

Rollback Strategy: Define a rollback strategy in the application manifest, specifying the desired revision or a rollback window.

spec:
  source:
    targetRevision: HEAD^1 # Rollback one revision

Secrets Management

Sensitive Information:

ArgoCD provides a secure way to manage sensitive information, such as API keys or passwords, required during deployment.

Secrets Management:

Store secrets as Kubernetes secrets or use tools like Sealed Secrets for additional encryption. Reference secrets in the application manifest without exposing sensitive details.

spec:
  source:
    kustomize:
      overlays:
        - name: secrets

ArgoCD Secret Management: Configure ArgoCD to manage secrets ensuring secure handling and distribution during deployments.

spec:
  source:
    repoURL: 'https://github.com/yourusername/your-repo.git'
    path: ./path/to/application
    targetRevision: HEAD
    helm:
      valueFiles:
        - ./path/to/values.yaml
      secrets:
        - name: my-secret
          values:
            - password