lucky
lucky

Reputation: 429

error validating data: [ValidationError(CronJob.spec.jobTemplate.spec.template.spec): unknown field "container" in io.k8s.api.core.v1.PodSpec,

This is my yaml file that i am trying to use for cronJob creation. I am getting error like unknown field "container" in io.k8s.api.core.v1.PodSpec,

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: abc-service-cron-job
spec:
  schedule: "* * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          container:
          - name: abc-service-cron-job
            image: docker.repo1.xyz.com/hui-services/abc-application/REPLACE_ME
            imagePullPolicy: Always
            command:
            - /bin/sh
            - -c
            - date; echo Hello from the Kubernetes cluster
          restartPolicy: OnFailure  

Upvotes: 0

Views: 4459

Answers (1)

gohm'c
gohm'c

Reputation: 15530

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  ...
spec:
  ...
  jobTemplate:
    spec:
      template:
        spec:
          containers:  # <-- you have spelling error here, should be "containers"
          ...

Upvotes: 1

Related Questions