<p>I have a cronjob file in helm that looks like the below:</p>
<pre><code>apiVersion: batch/v1
kind: CronJob
metadata:
  name: job-1
  namespace: default
  ...
apiVersion: batch/v1
kind: CronJob
metadata:
  name: job-2
  namespace: default
  ...
apiVersion: batch/v1
kind: CronJob
metadata:
  name: job-3
  namespace: default
  ...
</code></pre>
<p>How do I install all cronjobs with their names as job-1, job-2 and job-3 using just one helm install command: <code>helm install $name $chart</code></p>
<p>I tried installing it and it only installs job-1. I was expecting it to install all three jobs and when I run <code>kubectl get cronjobs</code> I should be able to see all three jobs</p>

Pastor Emmanuel
<p>Put each CronJob in a separate file in the <code>templates</code> directory.</p>
<p>In principle it is also possible to split this into separate YAML documents, but this isn't usually a preferred approach.  (It's necessary if you use the Helm template <code>range</code> construct to create multiple documents using a loop, though.)  Put <code>---</code> on its own line before each document.</p>
<pre class="lang-yaml prettyprint-override"><code>---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: job-1
---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: job-2
---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: job-3
</code></pre>
<p>Without these markers, this is taken as a single mapping with duplicated <code>key: value</code> pairs.  That is, there's a <em>single</em> YAML file as its output, that happens to contain <code>metadata:</code> multiple times.  Different tools handle this YAML in different ways, typically either producing an error or by discarding all but the last copy of a given key.  Running <code>helm template</code> over your chart will tell you for sure what Helm is generating.</p>
