Kubernetes cronjob reports "found invalid field" for failed and successfuJobsHistoryLimit

6/29/2017

I created a CronJob in my Kubernetes cluster that is working fine. I tried to add the spec fields for successfulJobsHistoryLimit and failedJobsHistoryLimit. Based on the documentation at https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/, they should be at the top level spec section, but I am getting the error when applying:

error validating data: [found invalid field successfulJobsHistoryLimit for v2alpha1.CronJobSpec, found invalid field failedJobsHistoryLimit for v2alpha1.CronJobSpec]; if you choose to ignore these errors, turn validation off with --validate=false

My YAML looks like this:

apiVersion: batch/v2alpha1
kind: CronJob
metadata:
  name: test-cronjob
spec:
  schedule: "05 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: test-cronjob
              image: my-cron-image              
          restartPolicy: OnFailure
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 5
  failedJobsHistoryLimit: 5

I am running Kubernetes 1.5.4 in Rancher.

-- zoidberg
docker
kubernetes

1 Answer

6/29/2017

The field successfulJobsHistoryLimit is not part of 1.5.4. It is first usable in 1.6

-- Norbert van Nobelen
Source: StackOverflow