<p>My k8s version:</p>
<pre><code>    kubectl version
Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;22&quot;, GitVersion:&quot;v1.22.2&quot;, GitCommit:&quot;8b5a19147530eaac9476b0ab82980b4088bbc1b2&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-09-15T21:38:50Z&quot;, GoVersion:&quot;go1.16.8&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;20+&quot;, GitVersion:&quot;v1.20.7-eks-d88609&quot;, GitCommit:&quot;d886092805d5cc3a47ed5cf0c43de38ce442dfcb&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-07-31T00:29:12Z&quot;, GoVersion:&quot;go1.15.12&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
WARNING: version difference between client (1.22) and server (1.20) exceeds the supported minor version skew of +/-1
</code></pre>
<p>My cronjob file:</p>
<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  labels:
    app: git-updater
  name: git-updater
  namespace: my-ns
spec:
  concurrencyPolicy: Replace
  failedJobsHistoryLimit: 2
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            app: git-updater
          name: git-updater
        spec:
          containers:
          - args:
            - sh
            - -c
            - apk add --no-cache git openssh-client &amp;&amp; cd /repos &amp;&amp; ls -d */*.git/
              | while read dir; do cd /repos/$dir; git gc; git fetch --prune; done
            image: alpine
            name: updater
            volumeMounts:
            - mountPath: test
              name: test
            - mountPath: test
              name: test
          restartPolicy: Never
          volumes:
          - persistentVolumeClaim:
              claimName: pvc
            name: repos
  schedule: '@daily'
  successfulJobsHistoryLimit: 4

...
</code></pre>
<p>When I create the job from file, all goes well:<br></p>
<pre><code>kubectl -n my-ns create -f git-updater.yaml
cronjob.batch/git-updater created
</code></pre>
<p>But I would like to trigger it manually just for testing purposes, so I do:<br></p>
<pre><code>kubectl -n my-ns create job --from=cronjob/git-updater test-job
error: unknown object type *v1beta1.CronJob
</code></pre>
<p>Which is strange because I have just been able to create it from file.<br>
In another similar post it was suggested to switch from ApiVersion <code>v1beta1</code> to <code>v1</code>.... but when I do so then I get:<br></p>
<pre><code> kubectl -n my-ns create -f git-updater.yaml
error: unable to recognize &quot;git-updater.yaml&quot;: no matches for kind &quot;CronJob&quot; in version &quot;batch/v1&quot;
</code></pre>
<p>I am a little stuck here, how can I test my newly and successfully created CronJob?</p>

JBoy
<p>That's your <strong>v1.20</strong> cluster version, that doing that.
Short answer is you should <strong>upgrade cluster to 1.21</strong>, where cronjobs works more or less stable.</p>
<p>Check</p>
<ol>
<li><a href="https://stackoverflow.com/questions/67520866/no-matches-for-kind-cronjob-in-version-batch-v1(https://stackoverflow.com/a/67521713/9929015)">no matches for kind &quot;CronJob&quot; in version &quot;batch/v1&quot;</a> , especially comment</li>
</ol>
<blockquote>
<p>One thing is the api-version, another one is in which version the
resource you are creating is available. By version 1.19.x you do have
batch/v1 as an available api-resource, but you don't have the resource
CronJob under it.</p>
</blockquote>
<ol start="2">
<li><a href="https://stackoverflow.com/a/68902379/9929015">Kubernetes Create Job from Cronjob not working</a></li>
</ol>
<hr />
<p>I have an 1.20.9 GKE cluster and face the same issue as you</p>
<pre><code>$kubectl version

Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;22&quot;, GitVersion:&quot;v1.22.2&quot;, GitCommit:&quot;8b5a19147530eaac9476b0ab82980b4088bbc1b2&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-09-15T21:38:50Z&quot;, GoVersion:&quot;go1.16.8&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;20+&quot;, GitVersion:&quot;v1.20.9-gke.1001&quot;, GitCommit:&quot;1fe18c314ed577f6047d2712a9d1c8e498e22381&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-08-23T23:06:28Z&quot;, GoVersion:&quot;go1.15.13b5&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
WARNING: version difference between client (1.22) and server (1.20) exceeds the supported minor version skew of +/-1

cronjob.batch/git-updater created

$kubectl -n my-ns create job --from=cronjob/git-updater test-job
error: unknown object type *v1beta1.CronJob
</code></pre>
<hr />
<p>At the same time, your <code>cronjob</code> yaml perfectly works with <code>apiVersion: batch/v1</code> on <strong>1.21</strong> GKE one.</p>
<pre><code>$kubectl version
Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;22&quot;, GitVersion:&quot;v1.22.2&quot;, GitCommit:&quot;8b5a19147530eaac9476b0ab82980b4088bbc1b2&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-09-15T21:38:50Z&quot;, GoVersion:&quot;go1.16.8&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;21&quot;, GitVersion:&quot;v1.21.3-gke.2001&quot;, GitCommit:&quot;77cdf52c2a4e6c1bbd8ae4cd75c864e9abf4c79e&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-08-20T18:38:46Z&quot;, GoVersion:&quot;go1.16.6b7&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}


$kubectl -n my-ns create -f cronjob.yaml
cronjob.batch/git-updater created
$ kubectl -n my-ns create job --from=cronjob/git-updater test-job
job.batch/test-job created

$kubectl describe job test-job -n my-ns
Name:           test-job
Namespace:      my-ns
Selector:       controller-uid=ef8ab972-cff1-4889-ae11-60c67a374660
Labels:         app=git-updater
                controller-uid=ef8ab972-cff1-4889-ae11-60c67a374660
                job-name=test-job
Annotations:    cronjob.kubernetes.io/instantiate: manual
Parallelism:    1
Completions:    1
Start Time:     Tue, 02 Nov 2021 17:54:38 +0000
Pods Statuses:  1 Running / 0 Succeeded / 0 Failed
...
Events:
  Type    Reason            Age   From            Message
  ----    ------            ----  ----            -------
  Normal  SuccessfulCreate  16m   job-controller  Created pod: test-job-vcxx9
</code></pre>
