<p>I am using this <a href="https://github.com/kubernetes-sigs/kustomize/blob/master/examples/multibases/README.md" rel="noreferrer">example</a>:</p>
<pre><code>├── base
│   ├── kustomization.yaml
│   └── pod.yaml
├── dev
│   └── kustomization.yaml
├── kustomization.yaml
├── production
│   └── kustomization.yaml
└── staging
    └── kustomization.yaml
</code></pre>
<p>and in <code>kustomization.yaml</code> file in root:</p>
<pre><code>resources:
- ./dev
- ./staging
- ./production
</code></pre>
<p>I also have the image transformer code in <code>dev, staging, production</code> kustomization.yaml:</p>
<pre><code>images:
- name: my-app
  newName: gcr.io/my-platform/my-app

</code></pre>
<p>To build a single deployment manifest, I use:</p>
<pre><code>(cd dev &amp;&amp; kustomize edit set image my-app=gcr.io/my-platform/my-app:0.0.2 &amp;&amp; kustomize build .)
</code></pre>
<p>which simply works!</p>
<p>to build deployment manifest for all overlays (dev, staging, production), I use:</p>
<pre><code>(kustomize edit set image my-app=gcr.io/my-platform/my-app:0.0.2 &amp;&amp; kustomize build .)
</code></pre>
<p>which uses the <code>kustomization.yaml</code> in root which contains all resources(dev, staging, production).</p>
<p>It does work and the final build is printed on console but without the image tag.</p>
<p>It seems like the <code>kusotmize edit set image</code> only updates the <code>kustomizaion.yaml</code> of the current dir.</p>
<p>Is there anything which can be done to handle this scenario in an easy and efficient way so the final output contains image tag as well for all deployments?</p>
<p><a href="https://github.com/D-GC/kustomize-multibase" rel="noreferrer">To test please use this repo</a></p>

Arian
<p>It took some time to realise what happens here. I'll explain step by step what happens and how it should work.</p>
<h2>What happens</h2>
<p>Firstly I re-created the same structure:</p>
<pre><code>$ tree
.
├── base
│   ├── kustomization.yaml
│   └── pod.yaml
├── dev
│   └── kustomization.yaml
├── kustomization.yaml
└── staging
    └── kustomization.yaml
</code></pre>
<p>When you run this command for single deployment:</p>
<pre><code>(cd dev &amp;&amp; kustomize edit set image my-app=gcr.io/my-platform/my-app:0.0.2 &amp;&amp; kustomize build .)
</code></pre>
<p>you change working directory to <code>dev</code>, manually override image from <code>gcr.io/my-platform/my-app</code> and adding tag <code>0.0.2</code> and then render the deployment.</p>
<p>The thing is previously added <code>transformer code</code> gets overridden by the command above. You can remove <code>transformer code</code>, run the command above and get the same result. And after running the command you will find out that your <code>dev/kustomization.yaml</code> will look like:</p>
<pre><code>resources:
- ./../base
namePrefix: dev-
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: my-app
  newName: gcr.io/my-platform/my-app
  newTag: 0.0.2
</code></pre>
<p><strong>Then</strong> what happens when you run this command from main directory:</p>
<pre><code>(kustomize edit set image my-app=gcr.io/my-platform/my-app:0.0.2 &amp;&amp; kustomize build .)
</code></pre>
<p><code>kustomize</code> firstly goes to overlays and do <code>transformation code</code> which is located in <code>overlays/kustomization.yaml</code>. When this part is finished, image name is <strong>not</strong> <code>my-app</code>, but <code>gcr.io/my-platform/my-app</code>.</p>
<p>At this point <code>kustomize edit</code> command tries to find image with name <code>my-app</code> and can't do so and therefore does NOT apply the <code>tag</code>.</p>
<h2>What to do</h2>
<p>You need to use transformed image name if you run <code>kustomize edit</code> in main working directory:</p>
<pre><code>$ kustomize edit set image gcr.io/my-platform/my-app=*:0.0.4 &amp;&amp; kustomize build .

apiVersion: v1
kind: Pod
metadata:
  labels:
    app: my-app
  name: dev-myapp-pod
spec:
  containers:
  - image: gcr.io/my-platform/my-app:0.0.4
    name: my-app
---
apiVersion: v1
kind: Pod
metadata:
  labels:
    app: my-app
  name: stag-myapp-pod
spec:
  containers:
  - image: gcr.io/my-platform/my-app:0.0.4
    name: my-app
</code></pre>
