Using ArgoCD CLI to Create, Sync, Delete, and Troubleshoot


Using ArgoCD CLI to Create, Sync, Delete, and Troubleshoot

ArgoCD is a powerful tool for declarative continuous deployment of Kubernetes applications. While the web-based interface is user-friendly, mastering the ArgoCD Command Line Interface (CLI) can significantly enhance your control over deployment workflows. In this guide, we will delve into the various aspects of using ArgoCD CLI to create, sync, delete, and troubleshoot applications.

Installing ArgoCD CLI:

Before we dive into the commands, let's ensure you have the ArgoCD CLI installed. You can download the CLI from the official ArgoCD GitHub repository.

# Download ArgoCD CLI binary
wget https://github.com/argoproj/argo-cd/releases/latest/download/argocd
# Make the binary executable
chmod +x argocd
# Move the binary to a directory in your PATH
sudo mv argocd /usr/local/bin/

Authenticating with ArgoCD Server:

Before interacting with the ArgoCD server, you need to authenticate. Use the following command, replacing <ARGOCD_SERVER> with your ArgoCD server address.

argocd login <ARGOCD_SERVER>

Enter your credentials when prompted.

Creating an Application:

To create a new application using the ArgoCD CLI, you can use the argocd app create command. Replace <APP_NAME> and <REPO_URL> with your desired application name and Git repository URL.

argocd app create <APP_NAME> --repo <REPO_URL>

Syncing an Application:

Once the application is created, you can sync it with the cluster using the argocd app sync command.

argocd app sync <APP_NAME>

This command ensures that the desired state of your application matches the state in your Git repository.

Deleting an Application:

To remove an application, use the argocd app delete command.

argocd app delete <APP_NAME>

This will delete the application and its associated resources from the cluster.

Troubleshooting with ArgoCD CLI:

ArgoCD CLI provides helpful commands for troubleshooting. Use the following command to get the sync status and details for an application:

argocd app get <APP_NAME>

If you encounter any issues during sync, the argocd app logs command can provide detailed logs for troubleshooting:

argocd app logs <APP_NAME>

Additional Examples:

Let's explore more examples to showcase the versatility of ArgoCD CLI:

  • Rolling Back an Application:
argocd app rollback <APP_NAME> [<REVISION>]
  • Pause and Resume Sync:
argocd app pause <APP_NAME>
argocd app resume <APP_NAME>

Mastering the ArgoCD CLI empowers Kubernetes administrators to streamline deployment workflows and efficiently manage applications. Whether you are creating, syncing, deleting, or troubleshooting, the ArgoCD CLI provides a robust set of commands for fine-grained control.

Related Searches and Questions asked:

  • How to Install Podman on CentOS 8
  • How to Install Podman on RHEL 8
  • How to Install Portainer on RHEL 8
  • How to Install Podman on Linux Mint
  • That's it for this topic, Hope this article is useful. Thanks for Visiting us.