My Database was down today and multiple applications in my cluster lost the connection with the database, but the Pod was Healthy (I know, I should have better Health Checks, but I don't). So, when the database was back online, the applications weren't able to connect again. So, I would like to restart all my Deployments. They share a label and are in the same Kubernetes namespace. We use ArgoCD to manage the applications.

In ArgoCD, I know I can restart all Deployments in one ArgoCD Application by typing this command:

argocd app actions run my-app restart --kind Deployment --all

But I do not know how to restart the Deployment of multiple independent applications in ArgoCD. I tried, but none of these work:

argocd app actions run my-app1 my-app2 restart --kind Deployment --all argocd app actions run -l mylabel=value restart --kind Deployment --all 

I wonder how can I restart multiple applications in ArgoCD in one command?

I would like to use same syntax of the sync command ():

argocd app sync [APPNAME... | -l selector] [flags]

I tried to use sync, but it does not restart Deployments, unless I make some change in the Deployment itself (or if I use a configMap Generator, which is not my case).

Thank you in advance.

EDIT: I created a shell script for my needs:

 for i in $(argocd app list -l yourgroup=your.label --output name); do argocd app actions run $i restart --kind Deployment --all; done 

It will fail for those apps which does not have a Deployment, but, for me, restarted everything I wanted.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.