<p>There was an error in Kubernetes that causes failure when using <code>kubectl describe</code> with the <code>cronjob</code> resource. It was fixed at some point between the <code>v1.10.x</code> and <code>v1.12.x</code> versions (more info in this issue <a href="https://github.com/kubernetes/kubernetes/issues/45418" rel="nofollow noreferrer">#45418</a>).</p>

<p>You said:</p>

<blockquote>
  <p>According to my cron pattern, it should have started on the first
  hour.</p>
</blockquote>

<p>But your schedule is <code>* */11 * * *</code>, and it means: <a href="https://crontab.guru/#*_*/11_*_*_*" rel="nofollow noreferrer">“At every minute past every 11th hour.”</a></p>

<p>I did not understand what you exactly meant with "on the first hour", but if you are talking about running the job on every new hour, the schedule should look like <a href="https://crontab.guru/every-1-hour" rel="nofollow noreferrer">this</a>: <code>0 * * * *</code></p>

CC BY-SA 4.0
2019-04-02T00:47:58.747Z
2019-04-02T00:47:58.747Z
Eduardo Baitello
<p>I have an Amazon EKS Kubernetes cluster and have the need to run a CronJob on it.
However, when I published the manifest to k8s, the object is there, I can list it, get it, but I cannot describe it and see its events. Also, it doesn't seem to start at all. According to my cron pattern, it should have started on the first hour.</p>

<p>What I have done so far:</p>

<p>I have created the manifest for the CronJob:</p>

<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: aws-ecr-token
  namespace: default
  labels:
    app: aws-ecr-token
    component: infrastructure
spec:
  schedule: "* */11 * * *"
  jobTemplate:
    metadata:
      name: aws-ecr-token
      namespace: default
      labels:
        app: aws-ecr-token
        component: infrastructure
    spec:
      completions: 1
      backoffLimit: 3
      activeDeadlineSeconds: 60
      parallelism: 1
      template:
        metadata:
          name: aws-ecr-token
          namespace: default
          labels:
            app: aws-ecr-token
            component: infrastructure
        spec:
          containers:
          - name: aws-ecr-token
            image: docker pull mesosphere/aws-cli
            command:
            - "sh"
            - "-c"
            - "$(aws ecr get-login --no-include-email)"
            env:
            - name: AWS_ACCESS_KEY_ID
              valueFrom:
                secretKeyRef:
                  name: aws-ecr
                  key: accessKey
            - name: AWS_SECRET_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  name: aws-ecr
                  key: secretKey
            - name: AWS_DEFAULT_REGION
              valueFrom:
                secretKeyRef:
                  name: aws-ecr
                  key: defaultRegion
            volumeMounts:
            - name: aws-ecr-config
              mountPath: /root/.docker
          restartPolicy: OnFailure
          volumes:
          - name: aws-ecr-config
            secret:
              secretName: aws-ecr-config
</code></pre>

<p>Deployed it using:</p>

<pre><code>$ kubectl apply -f aws-ecr-token-cron-job.yaml
</code></pre>

<p>I can get it:</p>

<pre><code>$ kubectl get cronjobs
NAME            SCHEDULE      SUSPEND   ACTIVE    LAST SCHEDULE   AGE
aws-ecr-token   * */11 * * *   False     0         &lt;none&gt;          26m
</code></pre>

<p>But it never gets scheduled.</p>

<p>When I try to describe it, it shows:</p>

<pre><code>$ kubectl describe cronjobs
Error from server (NotFound): the server could not find the requested resource
</code></pre>

<p>Any ideas why?</p>

<p>My version is:</p>

<pre><code>$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:55:54Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10+", GitVersion:"v1.10.11-eks", GitCommit:"6bf27214b7e3e1e47dce27dcbd73ee1b27adadd0", GitTreeState:"clean", BuildDate:"2018-12-04T13:33:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p>Thanks in advance :)</p>

<amazon-web-services><kubernetes>
AWS EKS CronJob resource not found
John Smith
# AWS EKS CronJob resource not found

(Asked by: username_0 on 2018-12-05)

I have an Amazon EKS Kubernetes cluster and have the need to run a CronJob on it.
However, when I published the manifest to k8s, the object is there, I can list it, get it, but I cannot describe it and see its events. Also, it doesn't seem to start at all. According to my cron pattern, it should have started on the first hour.
What I have done so far:
I have created the manifest for the CronJob:
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: aws-ecr-token
  namespace: default
  labels:
    app: aws-ecr-token
    component: infrastructure
spec:
  schedule: "* */11 * * *"
  jobTemplate:
    metadata:
      name: aws-ecr-token
      namespace: default
      labels:
        app: aws-ecr-token
        component: infrastructure
    spec:
      completions: 1
      backoffLimit: 3
      activeDeadlineSeconds: 60
      parallelism: 1
      template:
        metadata:
          name: aws-ecr-token
          namespace: default
          labels:
            app: aws-ecr-token
            component: infrastructure
        spec:
          containers:
          - name: aws-ecr-token
            image: docker pull mesosphere/aws-cli
            command:
            - "sh"
            - "-c"
            - "$(aws ecr get-login --no-include-email)"
            env:
            - name: AWS_ACCESS_KEY_ID
              valueFrom:
                secretKeyRef:
                  name: aws-ecr
                  key: accessKey
            - name: AWS_SECRET_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  name: aws-ecr
                  key: secretKey
            - name: AWS_DEFAULT_REGION
              valueFrom:
                secretKeyRef:
                  name: aws-ecr
                  key: defaultRegion
            volumeMounts:
            - name: aws-ecr-config
              mountPath: /root/.docker
          restartPolicy: OnFailure
          volumes:
          - name: aws-ecr-config
            secret:
              secretName: aws-ecr-config

Deployed it using:
$ kubectl apply -f aws-ecr-token-cron-job.yaml

I can get it:
$ kubectl get cronjobs
NAME            SCHEDULE      SUSPEND   ACTIVE    LAST SCHEDULE   AGE
aws-ecr-token   * */11 * * *   False     0                   26m

But it never gets scheduled.
When I try to describe it, it shows:
$ kubectl describe cronjobs
Error from server (NotFound): the server could not find the requested resource

Any ideas why?
My version is:
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:55:54Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10+", GitVersion:"v1.10.11-eks", GitCommit:"6bf27214b7e3e1e47dce27dcbd73ee1b27adadd0", GitTreeState:"clean", BuildDate:"2018-12-04T13:33:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

Thanks in advance :)

**Tags:** amazon-web-services, kubernetes


---

## 1 answers

### Answer by username_1 on 2019-04-02. Score: 0 | Accepted answer

There was an error in Kubernetes that causes failure when using `kubectl describe` with the `cronjob` resource. It was fixed at some point between the `v1.10.x` and `v1.12.x` versions (more info in this issue [#45418](https://github.com/kubernetes/kubernetes/issues/45418)).

You said:

> According to my cron pattern, it should have started on the first
> hour.

But your schedule is `* */11 * * *`, and it means: [“At every minute past every 11th hour.”](https://crontab.guru/#*_*/11_*_*_*)

I did not understand what you exactly meant with "on the first hour", but if you are talking about running the job on every new hour, the schedule should look like [this](https://crontab.guru/every-1-hour): `0 * * * *`


---

