
This assumes:
- You have an ArgoCD server up and running. If not, check out my article Install Red Hat OpenShift GitOps Operator using the console (Argo CD)
- You have installed the ArgoCD CLI.
- You are able to log into ArgoCD using the CLI. If not, check out my article Log into ArgoCD using the CLI on OpenShift
The argocd app list command can then be used to list the apps you have created.
~]$ argocd app list
NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGET
openshift-gitops/demo https://kubernetes.default.svc default default OutOfSync Missing Manual <none> https://github.com/my_project/my_repo.git python
The argocd app delete command can be used to delete an application.
~]$ argocd app delete openshift-gitops/demo
Are you sure you want to delete 'openshift-gitops/demo' and all its resources? [y/n] y
application 'openshift-gitops/demo' deleted
By default, there will be an interactive prompt. The --yes flag can be used to disable the interactive prompt.
~]$ argocd app delete openshift-gitops/demo --yes
application 'openshift-gitops/demo' deleted
Or you can use the kubectl (Kubernetes) or oc (OpenShift) login command to log into the Kubernetes or OpenShift cluster that ArgoCD is running in and then use the auth can-i command to determine if you have permission to list and delete an ArgoCD application.
~]$ oc login -u john.doe api.dev.openshift.example.com:6443
~]$ oc auth can-i list applications.argoproj.io
yes
~]$ oc auth can-i delete applications.argoproj.io
yes
Assuming you have permission to delete an application the kubectl (Kubernetes) or oc (OpenShift) get applications.argoproj.io command can be used to list the ArgoCD application.
~]$ oc get applications.argoproj.io --namespace <the namespace argocd is in, usually argocd or openshift-gitops>
NAME SYNC STATUS HEALTH STATUS
my-app Synced Healthy
hello-world
bad-app OutOfSync Degraded
And then the kubectl (Kubernetes) or oc (OpenShfit) delete command can be used to delete the application.
oc delete applications.argoproj.io my-app --namespace <the namespace argocd is in, usually argocd or openshift-gitops>
Or you can remove files from your version control system such as GitHub that were used to deploy certain resources to ArgoCD, such as an applications deployment YAML file, and then use the argocd app sync command with the --prune flag to remove the resources from ArgoCD that no longer exist in the Git repo.
argocd app sync openshift-gitops/demo --prune
Did you find this article helpful?
If so, consider buying me a coffee over at