<p>According to the <a href="https://github.com/kubernetes-sigs/kustomize/blob/master/examples/image.md" rel="noreferrer">official documentation</a> I should be able to easily override the tags and name of my docker images using some nifty <code>kustomization</code> syntax. I have tried to reproduce this.</p>
<p><strong>In my <code>deployment.yaml</code> I have the following:</strong></p>
<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    service: my-app
  name: my-app
spec:
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        service: my-app
    spec:
      imagePullSecrets:
      - name: my-docker-secret
      containers:
      - name: my-app
        image: the-my-app
        imagePullPolicy: Always
        ports:
        - containerPort: 1234
      restartPolicy: Always
</code></pre>
<p><strong>In my <code>kustomization.yaml</code> I have the following:</strong></p>
<pre><code>bases:
- ../base
resources:
- deployment.yaml
namespace: my-namespace

images:
- name: the-my-app
- newName: my.docker.registry.com/my-project/my-app
  newTag: test
</code></pre>
<p>However, when I do this:</p>
<pre><code>kubectl apply -k my-kustomization-dir
</code></pre>
<p>and wait for the deployment to spin up, and later do</p>
<pre><code>kubectl describe pod/my-app-xxxxxxxxx-xxxxx
</code></pre>
<p>The events looks like this:</p>
<pre><code>Events:
  Type     Reason                  Age                From                                              Message
  ----     ------                  ----               ----                                              -------
  Successfully assigned my-namespace/my-app-xxxxxxxxxx-xxxxx to default-pool-xxxxxxxxxx-xxxxx
  Normal   Pulling                 2s                 kubelet, default-pool-xxxxxxxxxx-xxxxx  pulling image &quot;the-my-app&quot;
  Warning  Failed                  0s                 kubelet, default-pool-xxxxxxxxxx-xxxxx  Failed to pull image &quot;the-my-app&quot;: rpc error: code = Unknown desc = Error response from daemon: pull access denied for the-my-app, repository does not exist or may require 'docker login'
  Warning  Failed                  0s                 kubelet, default-pool-xxxxxxxxxx-xxxxx  Error: ErrImagePull
  Normal   BackOff                 0s                 kubelet, default-pool-xxxxxxxxxx-xxxxx  Back-off pulling image &quot;the-my-app&quot;
  Warning  Failed                  0s                 kubelet, default-pool-xxxxxxxxxx-xxxxx  Error: ImagePullBackOff
</code></pre>
<p>Indicating that this did not work as expected (it tries to pull the original name specified in <code>deployment.yaml</code>).</p>
<p>So my question is, what am I doing wrong here?</p>

<p>You have to remove "-" in newName line under the images section. It should be like this, it is worked.</p>

<pre><code> images:
 - name: the-my-app
   newName: my.docker.registry.com/my-project/my-app
   newTag: test
</code></pre>
