<p>I want to create boiler plate for any k8s object. </p>

<p>For instance, the <code>deployment</code> object boilerplate can be generated by using <code>kubectl</code>: </p>

<p><code>kubectl run --dry-run -o yaml ...</code> </p>

<p>This will generate the yaml configuration file of the deployment object. I can redirect this to a file and modify the fields I need.</p>

<p>But how about objects other than deployment? What about CronJob? Are there any ways to generate boilerplate config file for CronJob object (or any other k8s object at that matter)?</p>

<p>While <code>kubectl create object-type -o yaml</code> will give you the very basics, it doesn't normally cover much of the spec.</p>

<p>Instead, I prefer to fetch existing objects and modify:</p>

<p><code>kubectl get configmap configMapName -o yaml &gt; configmap.yaml</code></p>

<p>Strip away everything you don't need, including generated fields; and you're good to go. This step probably requires a solid understanding of what to expect in each YAML.</p>

<p>EDIT://</p>

<p>I just realised there's <code>--export</code> when using this approach that strips generated fields for you :)</p>
