LinuxCommandLibrary

argocd-app

Manage Argo CD applications

TLDR

List applications

$ argocd app list --output [json|yaml|wide]
copy

Get application details
$ argocd app get [app_name] --output [json|yaml|wide]
copy

Deploy application internally (to the same cluster that Argo CD is running in)
$ argocd app create [app_name] --repo [git_repo_url] --path [path/to/repo] --dest-server https://kubernetes.default.svc --dest-namespace [ns]
copy

Delete an application
$ argocd app delete [app_name]
copy

Enable application auto-sync
$ argocd app set [app_name] --sync-policy auto --auto-prune --self-heal
copy

Preview app synchronization without affecting cluster
$ argocd app sync [app_name] --dry-run --prune
copy

Show application deployment history
$ argocd app history [app_name] --output [wide|id]
copy

Rollback application to a previous deployed version by history ID (deleting unexpected resources)
$ argocd app rollback [app_name] [history_id] --prune
copy

SYNOPSIS

argocd app <command> [<options>]

PARAMETERS

create
    Creates a new Argo CD application based on a manifest file or command-line arguments. Supports defining source repository, path, destination cluster, and sync policy. Common options: --file, --repo, --path, --dest-server.

get
    Retrieves detailed information about a specific application, including its status, health, deployed resources, and synchronization state. Common option: -o, --output for various output formats.

list
    Lists all applications managed by Argo CD, with options to filter by project, repository, or other criteria. Common option: -o, --output.

sync
    Manually triggers a synchronization of an application to its desired state defined in Git. Useful for forcing updates or resolving out-of-sync issues. Common options: --revision (to sync to a specific Git revision), --wait.

delete
    Deletes an application from Argo CD and optionally prunes (deletes) associated Kubernetes resources from the target cluster. Common options: --cascade (to delete resources), --prune.

diff
    Compares the live state of an application in the cluster with its desired state in Git, or with local application manifests. Helps in identifying discrepancies before synchronization. Common option: --local.

edit
    Opens the application manifest in a text editor for direct modification of its configuration. Changes are applied after saving.

history
    Displays the synchronization history of an application, showing past sync operations, their statuses, and associated Git revisions.

logs
    Streams logs from pods associated with a specific application. Requires the application's resources to be running in the cluster.

manifests
    Retrieves and displays the Kubernetes manifests generated for an application, as seen by Argo CD, before or after deployment.

patch
    Applies a strategic merge patch or JSON patch to an application's configuration.

rollbacks
    Rolls back an application to a previously synchronized, successful state from its history.

set
    Sets specific parameters or attributes for an application, such as Git parameters, environment variables, or resource overrides.

unset
    Removes specific parameters or attributes that were previously set for an application.

wait
    Waits for an application to reach a healthy and synchronized state. Useful in scripting automated deployments.

DESCRIPTION

The argocd app command group provides comprehensive functionalities for managing applications within Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes. Applications in Argo CD represent a deployed unit in Kubernetes, managed by Git repositories. This command allows users to create, view, modify, synchronize, and delete applications, as well as inspect their status, history, and resources.

It serves as the primary interface for interacting with application resources defined in Argo CD, facilitating GitOps workflows by enabling operations like manual synchronization, application health checks, and resource manifest inspection directly from the command line. It encapsulates the core operations required for a GitOps-driven application deployment and management strategy.

CAVEATS

Requires the argocd CLI to be installed and authenticated against an Argo CD API server.
User must have appropriate Argo CD RBAC (Role-Based Access Control) permissions to perform operations on applications.
Network connectivity is required to the Argo CD API server and the target Kubernetes cluster(s).
Familiarity with GitOps principles, Kubernetes resources, and application manifests is essential for effective use.

GITOPS PRINCIPLE

argocd app commands strongly adhere to the GitOps principle, where the desired state of applications is declared in Git and Argo CD ensures the cluster state converges to it. While manual operations via argocd app sync can be performed for one-off actions, the authoritative source of truth for application configuration remains the Git repository.

APPLICATION HEALTH AND SYNCHRONIZATION

The commands provide extensive information about application health and synchronization status, which is crucial for monitoring and troubleshooting deployments. Commands like argocd app get and argocd app list are frequently used to ascertain the current state of deployed applications.

HISTORY

Argo CD was originally created by Applatix and open-sourced in 2018. It became a CNCF (Cloud Native Computing Foundation) graduated project in 2022. The argocd app command group has been a core component of its CLI since early versions, continuously evolving with new features like resource hooks, sync waves, and improved health checks, reflecting the growing maturity and capabilities of the Argo CD platform in managing complex Kubernetes deployments using GitOps principles.

SEE ALSO

argocd account(1), argocd cluster(1), argocd repo(1), kubectl(1), git(1)

Copied to clipboard