Overview
This article lists argocd CLI commands that were used to review and manage the ArgoCD installation. A lot of times finding useful commands isn’t easy. This article lists the more commands I used when getting things set up.
Help
Once you log in, simply typing argocd will give you a pretty complete list of commands and flags you can use. Generally I’m checking my project and applications but other commands are available.
Available Commands:
account Manage account settings
admin Contains a set of commands useful for Argo CD administrators and requires direct Kubernetes access
app Manage applications
appset Manage ApplicationSets
cert Manage repository certificates and SSH known hosts entries
cluster Manage cluster credentials
completion output shell completion code for the specified shell (bash or zsh)
context Switch between contexts
gpg Manage GPG keys used for signature verification
help Help about any command
login Log in to Argo CD
logout Log out from Argo CD
proj Manage projects
relogin Refresh an expired authenticate token
repo Manage repository connection parameters
repocreds Manage repository connection parameters
version Print version information
Logging In
As noted in a prior article, there were a few issues with logging in to the cluster and you have to log in in order to use the CLI tool. Mainly because I didn’t set up a set of certificates, I needed to use the insecure flag to log in.
$ argocd login argocd.dev.internal.pri --insecure
WARN[0000] Failed to invoke grpc call. Use flag --grpc-web in grpc calls. To avoid this warning message, use flag --grpc-web.
Username: admin
Password:
'admin:login' logged in successfully
Context 'argocd.dev.internal.pri' updated
And I’m in. From here I can now manage my ArgoCD projects. Since I use gitops to manage my Kubernetes clusters, the commands I use here generally are getting information and not setting up the project. See my github repo for those configurations.
Project Information
First off, you need to know what projects are installed. There is always a default project. The two projects I have installed are the blue and green projects.
First commands.
Available Commands:
add-destination Add project destination
add-orphaned-ignore Add a resource to orphaned ignore list
add-signature-key Add GnuPG signature key to project
add-source Add project source repository
allow-cluster-resource Adds a cluster-scoped API resource to the allow list and removes it from deny list
allow-namespace-resource Removes a namespaced API resource from the deny list or add a namespaced API resource to the allow list
create Create a project
delete Delete project
deny-cluster-resource Removes a cluster-scoped API resource from the allow list and adds it to deny list
deny-namespace-resource Adds a namespaced API resource to the deny list or removes a namespaced API resource from the allow list
edit Edit project
get Get project details
list List projects
remove-destination Remove project destination
remove-orphaned-ignore Remove a resource from orphaned ignore list
remove-signature-key Remove GnuPG signature key from project
remove-source Remove project source repository
role Manage a project's roles
set Set project parameters
windows Manage a project's sync windows
Then you can use the list command to view the projects.
$ argocd proj list
NAME DESCRIPTION DESTINATIONS SOURCES CLUSTER-RESOURCE-WHITELIST NAMESPACE-RESOURCE-BLACKLIST SIGNATURE-KEYS ORPHANED-RESOURCES
default *,* * */* <none> <none> disabled
llamas-blue Project to install the llamas band website 4 destinations git@lnmt1cuomgitlab.internal.pri/external-unix/gitops.git */* <none> <none> disabled
llamas-green Project to install the llamas band website 4 destinations git@lnmt1cuomgitlab.internal.pri/external-unix/gitops.git */* <none> <none> disabled
If I wanted to check out the details of a project, I’d run the get command:
$ argocd proj get llamas-blue
Name: llamas-blue
Description: Project to install the llamas band website
Destinations: https://kubernetes.default.svc,llamas-blue
https://cabo0cuomvip1.qa.internal.pri:6443,llamas-blue
https://tato0cuomvip1.stage.internal.pri:6443,llamas-blue
https://lnmt1cuomvip1.internal.pri:6443,llamas-blue
Repositories: git@lnmt1cuomgitlab.internal.pri/external-unix/gitops.git
Scoped Repositories: <none>
Allowed Cluster Resources: */*
Scoped Clusters: <none>
Denied Namespaced Resources: <none>
Signature keys: <none>
Orphaned Resources: disabled
If you compare, the only real difference between the two is the get command lists the remote K8S clusters vs just indicating there are 4.
Application Information
The main thing I’m checking is the application status. Let’s see the options first.
Available Commands:
actions Manage Resource actions
create Create an application
delete Delete an application
delete-resource Delete resource in an application
diff Perform a diff against the target and live state.
edit Edit application
get Get application details
history Show application deployment history
list List applications
logs Get logs of application pods
manifests Print manifests of an application
patch Patch application
patch-resource Patch resource in an application
resources List resource of application
rollback Rollback application to a previous deployed version by History ID, omitted will Rollback to the previous version
set Set application parameters
sync Sync an application to its target state
terminate-op Terminate running operation of an application
unset Unset application parameters
wait Wait for an application to reach a synced and healthy state
For that I’d run the following list command:
$ argocd app list
NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGET
argocd/llamas-blue-dev https://kubernetes.default.svc llamas-blue llamas-blue Synced Healthy Auto <none> git@lnmt1cuomgitlab.internal.pri/external-unix/gitops.git dev/llamas-blue/ dev
argocd/llamas-blue-prod https://lnmt1cuomvip1.internal.pri:6443 llamas-blue llamas-blue Synced Healthy Auto <none> git@lnmt1cuomgitlab.internal.pri/external-unix/gitops.git prod/llamas-blue/ main
argocd/llamas-blue-qa https://cabo0cuomvip1.qa.internal.pri:6443 llamas-blue llamas-blue Synced Healthy Auto <none> git@lnmt1cuomgitlab.internal.pri/external-unix/gitops.git qa/llamas-blue/ main
argocd/llamas-blue-stage https://tato0cuomvip1.stage.internal.pri:6443 llamas-blue llamas-blue Synced Healthy Auto <none> git@lnmt1cuomgitlab.internal.pri/external-unix/gitops.git stage/llamas-blue/ main
argocd/llamas-green-dev https://kubernetes.default.svc llamas-green llamas-green Synced Healthy Auto <none> git@lnmt1cuomgitlab.internal.pri/external-unix/gitops.git dev/llamas-green/ dev
argocd/llamas-green-prod https://lnmt1cuomvip1.internal.pri:6443 llamas-green llamas-green Synced Healthy Auto <none> git@lnmt1cuomgitlab.internal.pri/external-unix/gitops.git prod/llamas-green/ main
argocd/llamas-green-qa https://cabo0cuomvip1.qa.internal.pri:6443 llamas-green llamas-green Synced Healthy Auto <none> git@lnmt1cuomgitlab.internal.pri/external-unix/gitops.git qa/llamas-green/ main
argocd/llamas-green-stage https://tato0cuomvip1.stage.internal.pri:6443 llamas-green llamas-green Synced Healthy Auto <none> git@lnmt1cuomgitlab.internal.pri/external-unix/gitops.git stage/llamas-green/ main
There is a lot of information here in part because my ArgoCD instance is connected and manages applications on four Kubernetes clusters. So you’ll see a blue and green application four times each.
Getting details though provides a ton of information.
$ argocd app get argocd/llamas-blue-dev
Name: argocd/llamas-blue-dev
Project: llamas-blue
Server: https://kubernetes.default.svc
Namespace: llamas-blue
URL: https://argocd.dev.internal.pri/applications/llamas-blue-dev
Repo: git@lnmt1cuomgitlab.internal.pri/external-unix/gitops.git
Target: dev
Path: dev/llamas-blue/
SyncWindow: Sync Allowed
Sync Policy: Automated
Sync Status: Synced to dev (1ef2090)
Health Status: Healthy
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
ResourceQuota llamas-blue llamas-rq Synced resourcequota/llamas-rq unchanged
LimitRange llamas-blue llamas-lr Synced limitrange/llamas-lr unchanged
ServiceAccount llamas-blue cschelin-admin Synced serviceaccount/cschelin-admin unchanged
ServiceAccount llamas-blue cschelin Synced serviceaccount/cschelin unchanged
rbac.authorization.k8s.io ClusterRoleBinding llamas-blue cschelin-view-llamas-blue Running Synced clusterrolebinding.rbac.authorization.k8s.io/cschelin-view-llamas-blue reconciled. clusterrolebinding.rbac.authorization.k8s.io/cschelin-view-llamas-blue unchanged
rbac.authorization.k8s.io ClusterRoleBinding llamas-blue cschelin-admin-llamas-blue Running Synced clusterrolebinding.rbac.authorization.k8s.io/cschelin-admin-llamas-blue reconciled. clusterrolebinding.rbac.authorization.k8s.io/cschelin-admin-llamas-blue unchanged
Service llamas-blue llamas Synced Healthy service/llamas unchanged
autoscaling HorizontalPodAutoscaler llamas-blue llamas Synced Healthy horizontalpodautoscaler.autoscaling/llamas unchanged
networking.k8s.io Ingress llamas-blue llamas Synced Healthy ingress.networking.k8s.io/llamas configured
argoproj.io Rollout llamas-blue llamas Synced Healthy rollout.argoproj.io/llamas unchanged
rbac.authorization.k8s.io ClusterRoleBinding cschelin-admin-llamas-blue Synced
rbac.authorization.k8s.io ClusterRoleBinding cschelin-view-llamas-blue Synced
Pingback: Kubernetes Index | Motorcycle Touring