Skip to content

Argo CD

Hüseyin Deniz KIVRAK edited this page Nov 17, 2024 · 3 revisions

What is Argo CD?

Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes that allows you to manage your Kubernetes applications through Git repositories. It provides a web UI for visualizing and managing application deployments and synchronization.


Key Concepts

GitOps

  • Definition: GitOps is a practice where Git repositories serve as the single source of truth for both application code and Kubernetes configurations. Argo CD automatically deploys changes from these repositories to your Kubernetes clusters.
  • Benefits:
    • Enhances consistency across environments.
    • Provides version control for infrastructure and application changes.
    • Simplifies rollbacks by reverting to a previous Git commit.

Applications

  • Definition: An application in Argo CD represents a set of Kubernetes resources defined in a Git repository. Argo CD manages the deployment and synchronization of these resources to the Kubernetes cluster.
  • Components:
    • Applications can be defined using:
      • Helm charts
      • Kustomize configurations
      • Plain YAML manifests

Repositories

  • Definition: Git repositories where your application configurations are stored. Argo CD connects to these repositories to fetch and deploy configurations.
  • Types:
    • GitHub
    • GitLab
    • Bitbucket
    • Helm chart repositories

Sync and Health Status

  • Sync Status: Indicates whether the application in the cluster matches the desired state defined in the Git repository.
  • Health Status: Shows the health of the application's resources, such as whether they are running and healthy.

Commands

Note: The Argo CD CLI (argocd) is primarily used for scripting, automation, and specific use cases. Many tasks, such as application creation and synchronization, can also be done through the Argo CD web UI.


CLI Installation

To install the argocd CLI, follow the instructions in the official documentation.


Authentication and Setup

Log in to the Argo CD Server

argocd login <ARGOCD_SERVER>  

Change the Current Context

argocd context <CONTEXT_NAME>  

Show the Current Context

argocd context  

Application Management

List All Applications

argocd app list  

Get Details of a Specific Application

argocd app get <APP_NAME>  

Sync an Application to its Desired State

argocd app sync <APP_NAME>  

Roll Back an Application to a Previous Version

argocd app rollback <APP_NAME> <REVISION>  

Delete an Application

argocd app delete <APP_NAME>  

Edit an Application

argocd app edit <APP_NAME>  

Repository Management

Add a New Repository

argocd repo add <REPO_URL> --username <USERNAME> --password <PASSWORD>  

List All Repositories

argocd repo list  

Remove a Repository

argocd repo rm <REPO_URL>  

Advanced Features

Monitor Application Sync Status

argocd app wait <APP_NAME> --sync  

Monitor Application Health Status

argocd app wait <APP_NAME> --health  

Export Application YAML

argocd app get <APP_NAME> -o yaml  

Update the Argo CD CLI

argocd version --upgrade  

Cluster Management

Add a Cluster to Argo CD

argocd cluster add <CONTEXT_NAME>  
  • Replace <CONTEXT_NAME> with the Kubernetes context name of the cluster you want to add.
  • You can list available contexts using:
    kubectl config get-contexts  

List All Managed Clusters

argocd cluster list  

Remove a Cluster from Argo CD

argocd cluster rm <SERVER_URL>  
  • Replace <SERVER_URL> with the URL of the cluster to be removed.

Get Cluster Details

argocd cluster get <SERVER_URL>  
  • Provides detailed information about a specific managed cluster.

Debugging

View Application Logs

argocd app logs <APP_NAME>  

View CLI Version

argocd version  

Additional Resources