<p>I just start using kustomize. I have the following yaml files for kustomize:</p>

<pre><code>ls -l ./kustomize/base/
816 Apr 18 21:25 deployment.yaml
110 Apr 18 21:31 kustomization.yaml
310 Apr 18 21:25 service.yaml
</code></pre>

<p>where deployment.yaml and service.yaml are generated files with jib and they are fine in running. And the content of the kustomization.yaml is the following:</p>

<pre><code>apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:  
- service.yaml
- deployment.yaml  
</code></pre>

<p>And in another directory</p>

<pre><code>ls -l ./kustomize/qa
133 Apr 18 21:33 kustomization.yaml
95 Apr 18 21:37 update-replicas.yaml
</code></pre>

<p>where </p>

<pre><code>apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../base

patchesStrategicMerge:
- update-replicas.yaml
</code></pre>

<p>and </p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: 2
</code></pre>

<p>After running "kustomize build ./kustomize/base", I run</p>

<pre><code>~/kustomize build ./kustomize/qa
Error: no matches for OriginalId ~G_~V_Deployment|~X|my-app; no matches for CurrentId ~G_~V_Deployment|~X|my-app; failed to find unique target for patch ~G_~V_Deployment|my-app
</code></pre>

<p>I have a look related files and don't see any typo on the application name. </p>

<p>And here is the deployment.yaml file.</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: my-app
  name: my-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-app
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: my-app
    spec:
      containers:
        - image: docker.io/[my Docker ID]/my-app
        name: my-app
        resources: {}
        readinessProbe:
          httpGet:
            port: 8080
            path: /actuator/health/readiness
        livenessProbe:
          httpGet:
            port: 8080
            path: /actuator/health/liveness
        lifecycle:
          preStop:
            exec:
              command: ["sh", "-c", "sleep 10"]
status: {}
</code></pre>

<p>Again, the above file is generated with jib with some modifications. And it runs on Kubernetes directly.</p>

<p>How to resolve this problem?</p>

vic
<p>I got the same issue and fixed.
This issue is related to Kustomize version installed. Check! <code>kustomize version</code>.
From Kustomize v3.0.x  and above, we need to mention namespace in patches too. After added namespace in patches yaml files, issue get resolved.</p>
<p>In your example add namespace under metadata in update-replicas.yaml patch file.</p>
<p>For more details regarding kustomize version related issues(like &quot;...failed to find unique target for patch...&quot;): <a href="https://github.com/kubernetes-sigs/kustomize/issues/1351" rel="noreferrer">https://github.com/kubernetes-sigs/kustomize/issues/1351</a></p>
