<p>I have what seems like an API issue that results in not being to be able to create a job from a cron job.</p>
<p>I have a CronJob Helm file using the API like so:</p>
<pre><code>apiVersion: batch/v1beta1
kind: CronJob
</code></pre>
<p>Deploying that with helm works just fine.</p>
<p>Then after it is deployed I attempt to create a job using that cronjob like so:</p>
<pre><code> kubectl create job $(helm-release-name) --from=cronjob/connector-config
</code></pre>
<p>This used to create the job based on the chart above. Now however, since upgrading to 1.19.11 I instead get this error:</p>
<pre><code>##[error]error: unknown object type *v1beta1.CronJob
commandOutput
##[error]The process 
'/opt/hostedtoolcache/kubectl/1.22.1/x64/kubectl' failed with exit code 1
</code></pre>
<p>If I change the api in the Helm chart to this:</p>
<pre><code>apiVersion: batch/v1
kind: CronJob
</code></pre>
<p>Then the Helm chart fails to deploy.</p>
<pre><code>UPGRADE FAILED: unable to recognize &quot;&quot;: no matches for kind &quot;CronJob&quot; in version 
&quot;batch/v1&quot;
</code></pre>
<p>Suggestions?</p>
<p>Thanks!</p>

<p>CronJobs is generally available (GA) in Google Kubernetes Engine (GKE) version 1.21 and later.</p>
<p>the version you should use <code>apiVersion: batch/v1</code></p>
<p><a href="https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/</a></p>
<blockquote>
<p>CronJobs was promoted to general availability in Kubernetes v1.21. If
you are using an older version of Kubernetes, please refer to the
documentation for the version of Kubernetes that you are using, so
that you see accurate information. Older Kubernetes versions do not
support the batch/v1 CronJob API.</p>
</blockquote>
<p>You can check the support Kubernetes API versions using</p>
<pre><code>kubectl api-resources OR kubectl api-versions
</code></pre>
<p>you can also try</p>
<pre><code>kubectl explain &lt;Resource type&gt;

kubectl explain cronjob
</code></pre>
