<p>I find it &quot;a bit&quot; boring to create K8s manifests for services that I want to deploy. Typically, for an app, a set of manifests as follows is needed:</p>
<ul>
<li>deployment</li>
<li>service</li>
<li>ingress</li>
<li>configMap</li>
<li>secret</li>
</ul>
<p>I think there must be some tool that automates the generation of such templates, probably some CLI program that goes through a series of questions-and-answers to generate final manifests. I would imagine that it could also be a bit framework-specific, so it'd be able to generate configMaps based on .NET's <code>appsetting.json</code> or node's <code>.env</code> files.</p>
<p>I tries to find something like that on Google, but possibly I'm using wrong keywords. Is there anything as I described?</p>

<h2>Solution 1</h2>
<p>Kubernetes supports generating manifests for some resource types.
Here is the full list:
<a href="https://kubernetes.io/docs/reference/kubectl/conventions/#generators" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/kubectl/conventions/#generators</a></p>
<p>You can get the usage of each resource by;</p>
<pre><code>kubectl create &lt;resource-name&gt; -h
</code></pre>
<p>Then you can use;</p>
<pre><code>kubectl create --dry-run=client -o yaml &lt;resource-name&gt; [ARGS]
</code></pre>
<p>Such as for deployment;</p>
<pre><code>kubectl create --dry-run=client -o yaml deployment NAME --image=image
</code></pre>
<p>eg:</p>
<pre><code>$ kubectl create --dry-run=client -o yaml deploy nginx-deploy --image nginx

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: nginx-deploy
  name: nginx-deploy
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx-deploy
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: nginx-deploy
    spec:
      containers:
      - image: nginx
        name: nginx
        resources: {}
status: {}
</code></pre>
<h2>Solution 2</h2>
<p>If you need more sophisticated solution, you can have a look at Helm, Kustomize and Ansible Operator.</p>
<p>Some further information for each:</p>
<p>Helm:<br />
<a href="https://helm.sh/docs/intro/quickstart" rel="nofollow noreferrer">https://helm.sh/docs/intro/quickstart</a></p>
<p>Kustomize:<br />
<a href="https://kustomize.io" rel="nofollow noreferrer">https://kustomize.io</a></p>
<p>Ansible Operator:<br />
<a href="https://sdk.operatorframework.io/docs/building-operators/ansible/tutorial" rel="nofollow noreferrer">https://sdk.operatorframework.io/docs/building-operators/ansible/tutorial</a></p>
