<p>This isn't really an ArgoCD thing. <a href="https://keel.sh/" rel="noreferrer">Keel is a good tool</a> to help keep your images updated across the cluster and is super easy to implement. Basically, you'd just add some annotations to your manifest.</p>
<pre><code>metadata:
  annotations:
    keel.sh/policy: force
    keel.sh/trigger: poll      
    keel.sh/pollSchedule: &quot;@every 10m&quot;
</code></pre>
<p>It may be worth noting that if you are moving to run this in production, avoid the use of the latest tag. This is considered bad practice as it can burn you when breaking changes are pushed. Keel can handle that through an innate understanding of semver tags allowing you to update on minor version changes, but avoid major without testing, etc.</p>

CC BY-SA 4.0
2021-05-04T14:53:13.603Z
I agree. I think I may have to just implement a system to auto push versions to the deployments
DogEatDog
CC BY-SA 4.0
2021-05-04T14:57:03.893Z
Check out Keel before you re-build it. It is super light and may save you a bit. Plus, you get a log of what keel has done to push this. Of course, you may prefer the audit trail in your infra git repo be explicit instead of managing permissions as tightly against the container repo. If that's the case though, consider if this is a bottle neck on your CD time.
Josiah
CC BY-SA 4.0
2021-05-04T14:47:30.530Z
2021-05-04T14:47:30.530Z
Josiah
<p>The canonical, ArgoCD-native way to do so is to use the ArgoCD image updater.</p>
<ul>
<li><a href="https://argocd-image-updater.readthedocs.io/en/stable/" rel="nofollow noreferrer">https://argocd-image-updater.readthedocs.io/en/stable/</a></li>
</ul>
<p>It is currently being mainlined:</p>
<ul>
<li><a href="https://github.com/argoproj-labs/argocd-image-updater/issues/491" rel="nofollow noreferrer">https://github.com/argoproj-labs/argocd-image-updater/issues/491</a></li>
<li><a href="https://github.com/argoproj/argo-cd/pull/10446" rel="nofollow noreferrer">https://github.com/argoproj/argo-cd/pull/10446</a></li>
</ul>

CC BY-SA 4.0
2022-12-14T15:20:02.820Z
2022-12-14T15:20:02.820Z
almereyda
<p>Using ArgoCD, I'd like to have the App AutoSync Update/Reploy when the docker image is updated on a specific tag such as <code>latest</code> or <code>stable</code>.</p>
<p>For example, if I have a deployment in my git repo like this:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: k8s-nginx-example
spec:
  selector:
    matchLabels:
      app: k8s-nginx-example
  replicas: 2 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: k8s-nginx-example
    spec:
      containers:
      - name: nginx
        image: my-repo/k8s-nginx-example:latest
        ports:
        - containerPort: 80
        resources:
          requests:
            memory: &quot;64Mi&quot;
            cpu: &quot;250m&quot;
          limits:
            memory: &quot;128Mi&quot;
            cpu: &quot;500m&quot;
</code></pre>
<p>I'd like ArgoCD to update the deployment when a new docker image is pushed to <code>latest</code> tag or <code>stable</code>... etc. I know that ArgoCD polls the git repo of the app every 3 seconds so it is not aware of the changes to the Docker Image Tag. Another option could be (but I'm not sure how to do it)  would be to have ArgoCD Update via a webhook that notifies ArgoCD that there is a new image to pull with the <code>latest</code> tag, although even after pushing a Docker Image to the repository with the <code>latest</code> and then manually <code>syncing</code> the app in ArgoCD, Argo does nothing. I suspect that Argo is only reaching out to the git repo to check for changes and is not concerned with the Docker image in the deployment.</p>
<p>The only way I can think of doing this currently with ArgoCD is to version the Docker images with version tags <code>1.2.3</code> and then script the build process to update the deployment in the git repository with the image tag version each time.</p>
<pre><code>...
containers:
  - name: nginx
    image: my-repo/k8s-nginx-example:1.2.3
    ports:
...
</code></pre>
<p>Is there a way to do this in ArgoCD? Or would a better option be using Argo Workflows with Argo Events? I was hoping that there might be a plugin or something that can either trigger the event or monitor the docker image.</p>
<p>Thanks</p>
<p>Meta: Need tags Argo and ArgoCD</p>

CC BY-SA 4.0
2021-05-03T00:42:54.163Z
See our approach here - https://itnext.io/building-kubernetes-cicd-pipeline-with-github-actions-argocd-and-reliza-hub-e7120b9be870 . Currently we use slightly updated approach which works on pure manifests with no need for extra templating language (going to document updates soon). If you'd like to implement this, feel free to join discord https://discord.gg/UTxjBf9juQ - will help with implementation.
taleodor
<docker><kubernetes>
ArgoCD Autosync based off of Docker Image `latest` Tag
DogEatDog
# ArgoCD Autosync based off of Docker Image `latest` Tag

(Asked by: username_0 on 2021-05-02)

Using ArgoCD, I'd like to have the App AutoSync Update/Reploy when the docker image is updated on a specific tag such as latest or stable.
For example, if I have a deployment in my git repo like this:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: k8s-nginx-example
spec:
  selector:
    matchLabels:
      app: k8s-nginx-example
  replicas: 2 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: k8s-nginx-example
    spec:
      containers:
      - name: nginx
        image: my-repo/k8s-nginx-example:latest
        ports:
        - containerPort: 80
        resources:
          requests:
            memory: "64Mi"
            cpu: "250m"
          limits:
            memory: "128Mi"
            cpu: "500m"

I'd like ArgoCD to update the deployment when a new docker image is pushed to latest tag or stable... etc. I know that ArgoCD polls the git repo of the app every 3 seconds so it is not aware of the changes to the Docker Image Tag. Another option could be (but I'm not sure how to do it)  would be to have ArgoCD Update via a webhook that notifies ArgoCD that there is a new image to pull with the latest tag, although even after pushing a Docker Image to the repository with the latest and then manually syncing the app in ArgoCD, Argo does nothing. I suspect that Argo is only reaching out to the git repo to check for changes and is not concerned with the Docker image in the deployment.
The only way I can think of doing this currently with ArgoCD is to version the Docker images with version tags 1.2.3 and then script the build process to update the deployment in the git repository with the image tag version each time.
...
containers:
  - name: nginx
    image: my-repo/k8s-nginx-example:1.2.3
    ports:
...

Is there a way to do this in ArgoCD? Or would a better option be using Argo Workflows with Argo Events? I was hoping that there might be a plugin or something that can either trigger the event or monitor the docker image.
Thanks
Meta: Need tags Argo and ArgoCD

**Tags:** docker, kubernetes

> **Comments:**
> **username_1**: See our approach here - https://itnext.io/building-kubernetes-cicd-pipeline-with-github-actions-argocd-and-reliza-hub-e7120b9be870 . Currently we use slightly updated approach which works on pure manifests with no need for extra templating language (going to document updates soon). If you'd like to implement this, feel free to join discord https://discord.gg/UTxjBf9juQ - will help with implementation.  

---

## 2 answers

### Answer by username_2 on 2021-05-04. Score: 8

This isn't really an ArgoCD thing. Keel is a good tool to help keep your images updated across the cluster and is super easy to implement. Basically, you'd just add some annotations to your manifest.
metadata:
  annotations:
    keel.sh/policy: force
    keel.sh/trigger: poll      
    keel.sh/pollSchedule: "@every 10m"

It may be worth noting that if you are moving to run this in production, avoid the use of the latest tag. This is considered bad practice as it can burn you when breaking changes are pushed. Keel can handle that through an innate understanding of semver tags allowing you to update on minor version changes, but avoid major without testing, etc.

> **Comments:**
> **username_0**: I agree. I think I may have to just implement a system to auto push versions to the deployments  
> **username_2**: Check out Keel before you re-build it. It is super light and may save you a bit. Plus, you get a log of what keel has done to push this. Of course, you may prefer the audit trail in your infra git repo be explicit instead of managing permissions as tightly against the container repo. If that's the case though, consider if this is a bottle neck on your CD time.  

---

### Answer by username_3 on 2022-12-14. Score: 4

The canonical, ArgoCD-native way to do so is to use the ArgoCD image updater.

* <https://argocd-image-updater.readthedocs.io/en/stable/>

It is currently being mainlined:

* <https://github.com/argoproj-labs/argocd-image-updater/issues/491>
* <https://github.com/argoproj/argo-cd/pull/10446>


---

