<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: node-timer-analytics-parser-cronjob
spec:
  schedule: "0 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: node-timer-analytics-parser-cronjob
            image: round0.azurecr.io/node-timer-analytics-parser:latest
            args:
            - /bin/sh
            - -c
            - date; npm start
          restartPolicy: OnFailure
          imagePullSecrets:
            - name: regsecret
</code></pre>

<p>I have a following YAML file which creates a cronjob but <strong>$ kubectl get cronjob</strong> cmd gives this 
$ kubectl get cronjob</p>

<pre><code>NAME                                     KIND
node-timer-analytics-parser-controller   CronJob.v1beta1.batch
</code></pre>

<p>also <strong>$ kubectl get job</strong> says <strong><em>NO resources found.</em></strong></p>

<p>I also tried this <strong>$ kubectl describe cronjob node-timer-analytics-parser-controller</strong> which gives </p>

<pre><code>Name:       node-timer-analytics-parser-controller
Namespace:  default
Labels:     &lt;none&gt;
Events:     &lt;none&gt;
</code></pre>

<p>This docker image/container does some extensive sql queries(40-50 queries in parallel) to sql database.<br>
I tested the docker container locally it runs without any issues. One complete execution probably takes around 1- 5 minutes. I don't understand why it is not working in <strong>Kubernetes</strong> </p>

<p>I even tried the <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#creating-a-cron-job" rel="nofollow noreferrer">example of the k8 documentation</a> it seems to be working done know what is the issue with my cronjob.</p>

<p>Presumably you are running Kubernetes 1.8, according to the <a href="https://cloud.google.com/container-engine/release-notes" rel="nofollow noreferrer">release notes</a> 1.7.8 is the default version run in GKE. You can check which version you are running by using <code>kubectl version</code></p>

<p>If you are running &lt; 1.8 then you will need to enable cron jobs as per <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#prerequisites" rel="nofollow noreferrer">the CronJob documentation</a>. I don't use GKE, but looks like you do this at cluster create time:</p>

<pre><code>gcloud alpha container clusters create my-cluster --enable-kubernetes-alpha
</code></pre>

<p>For more info, take a look at <a href="https://cloud.google.com/container-engine/docs/alpha-clusters#about_feature_stages" rel="nofollow noreferrer">About Alpha Features</a></p>

<p>Even with 1.8 is seems to be listed on the <a href="https://cloud.google.com/container-engine/release-notes" rel="nofollow noreferrer">release notes</a> as a new feature</p>

<blockquote>
  <p>You can now run CronJobs on your Container Engine cluster. CronJob is a Beta feature in Kubernetes version 1.8.</p>
</blockquote>

<p>So you might need to run an upgrade.</p>

<p>I also notice that you are using an azure container. Might be worth starting with the example <code>CronJob</code> to see if you can get that to work first.</p>
