<p>I am trying to make a <code>cron job</code> in Openshift but I got this error:</p>

<pre><code>error: unable to parse "openshift/cronJob-template.yml", not a valid Template but *batch.CronJob
</code></pre>

<p>I ran this command:</p>

<pre><code>oc process -f openshift/cronJob-template.yml -p namespace=test-project | oc apply -f -
</code></pre>

<p>My <code>yml</code> looks like:</p>

<pre><code>apiVersion: batch/v2alpha1
kind: CronJob
metadata:
  name: demo
spec:
  schedule: "*/30 2 * * *"
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            parent: "demo"
        spec:
          containers:
          - name: demo
            image: demo
            command: ["java",  "-jar", "test.jar"]
          restartPolicy: OnFailure
</code></pre>

<p>I did have my schedule looking like the following but I am not sure if it is correct in a <code>yml</code> file <code>schedule: "*/30 2 * * * /tmp/logs"</code></p>

<p>This is my first time creating a cron job via <code>yml</code>and on Openshift so I apologise.  </p>

<p>The template looks ok. Try run <code>oc create -f openshift/cronJob-template.yml -n test-project</code> instead.</p>
