<p>Does Kubernetes have a way of reusing manifests without copying and paste them? Something akin to Terraform templates.</p>

<p>Is there a way of passing values between manifests?</p>

<p>I am looking to deploy the same service to multiple environments and wanted a way to call the necessary manifest and pass in the environment specific values.</p>

<p>I'd also like to do something like:</p>

<p><strong>Generic-service.yaml</strong></p>

<pre><code>Name={variablename}
</code></pre>

<p><strong>Foo-service.yaml</strong></p>

<pre><code>Use=General-service.yaml
variablename=foo-service-api
</code></pre>

<p>Any guidance is appreciated.</p>

Confounder
<p><a href="https://kustomize.io/" rel="nofollow noreferrer">Kustomize</a>, now part of <code>kubectl apply -k</code> is a way to <em>parameterize</em> your Kubernetes manifests files.</p>

<p>With Kustomize, you have a <em>base manifest</em> file (e.g. of <code>Deployment</code>) and then multiple <em>overlay</em> directories for parameters e.g. for <em>test</em>, <em>qa</em> and <em>prod</em> environment.</p>

<p>I would recommend to have a look at <a href="https://speakerdeck.com/spesnova/introduction-to-kustomize" rel="nofollow noreferrer">Introduction to kustomize</a>.</p>

<p>Before Kustomize it was common to use Helm for this.</p>
