<p>In Helm, it is possible to specify a release name using</p>
<p><code>helm install my-release-name chart-path</code></p>
<p>This means, I can specify the release name and its components (using fullname) using the CLI.</p>
<p>In kustomize (I am new to kustomize), there is a similar concept, <a href="https://kubectl.docs.kubernetes.io/references/kustomize/nameprefix/" rel="nofollow noreferrer"><code>namePrefix</code></a> and <a href="https://kubectl.docs.kubernetes.io/references/kustomize/namesuffix/" rel="nofollow noreferrer"><code>nameSuffix</code></a> which can be defined in a <code>kustomization.yaml</code></p>
<pre><code>apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namePrefix: overlook-

resources:
- deployment.yaml
</code></pre>
<p>However, this approach needs a custom file, and using a &quot;dynamic&quot; namePrefix would mean that a <code>kustomization.yaml</code> has to be generated using a template and kustomize is, well,  about avoiding templating.</p>
<p>Is there any way to specify that value dynamically?</p>

<p>You can use <a href="https://github.com/kubernetes-sigs/kustomize/blob/master/examples/mySql/README.md#name-customization" rel="nofollow noreferrer"><code>kustomize edit</code></a> to edit the <code>nameprefix</code> and <code>namesuffix</code> values.</p>
<p>For example:</p>
<p><code>Deployment.yaml</code></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: the-deployment
spec:
  replicas: 5
  template:
    containers:
      - name: the-container
        image: registry/conatiner:latest
</code></pre>
<p><code>Kustomization.yaml</code></p>
<pre><code>apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deployment.yaml
</code></pre>
<p>Then you can run <code>kustomize edit set nameprefix dev-</code> and <code>kustomize build .</code> will return following:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: dev-the-deployment
spec:
  replicas: 5
  template:
    containers:
    - image: registry/conatiner:latest
      name: the-container
</code></pre>
