CronJob: unknown field "configMapRef"

kubernetes cron job environment variables
kubernetes suspend cron job
kubernetes cronjob
configmapkeyref
kubernetes dynamic environment variables
kubernetes valuefrom
kubectl delete cronjob
kubernetes deployment environment variables

I'm applying a Kubernetes CronJob. So far it works. Now I want to add the environment variables. (env: -name... see below) While tryng to apply I get the error

unknown field "configMapRef" in io.k8s.api.core.v1.EnvVarSource

I don't like to set all singles variables here. I prefer to link the configmap to not to double the variables. How is it possible set a link to the configmap.yaml variables in a CronJob file, how to code it?

Frank

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: ad-sync
  creationTimestamp: 2019-02-15T09:10:20Z
  namespace: default
  selfLink: /apis/batch/v1beta1/namespaces/default/cronjobs/ad-sync
spec:
  concurrencyPolicy: Allow
  failedJobsHistoryLimit: 1
  successfulJobsHistoryLimit: 3
  suspend: false
  schedule: "0 */1 * * *"
  jobTemplate:
    metadata:
      labels:
        job: ad-sync
    spec:
      template:
        spec:
          containers:
          - name: ad-sync
            image: foo.azurecr.io/foobar/ad-sync
            command: ["dotnet", "AdSyncService.dll"]
            args: []
            env:
              - name: AdSyncService
                valueFrom:
                  configMapRef:
                    name: ad-sync-service-configmap
          restartPolicy: OnFailure

There is no such field configMapRef in env field instead there is a field called configMapKeyRef

in order to get more detail about kubernetes objects, its convenient to use kubectl explain --help

for example if you would like to check all of the keys and their types you can use following command

kubectl explain cronJob --recursive

kubectl explain cronjob.spec.jobTemplate.spec.template.spec.containers.env.valueFrom.configMapKeyRef

CronJob: unknown field “configMapRef” - kubernetes - php, Now I want to add the environment variables. (env: -name see below) While tryng to apply I get the error unknown field "configMapRef" in io.k8s.api.core.v1. For example, suppose a CronJob is set to schedule a new Job every one minute beginning at 08:30:00, and its startingDeadlineSeconds field is not set. If the CronJob controller happens to be down from 08:29:00 to 10:21:00 , the job will not start as the number of missed jobs which missed their schedule is greater than 100.

You should use configMapKeyRef for single value or configMapRef with envFrom

Running Automated Tasks with a CronJob, These automated jobs run like Cron tasks on a Linux or UNIX system. Cron jobs The .spec.schedule is a required field of the .spec . It takes a� A Job creates one or more Pods and ensures that a specified number of them successfully terminate. As pods successfully complete, the Job tracks the successful completions. When a specified number of successful completions is reached, the task (ie, Job) is complete. Deleting a Job will clean up the Pods it created. A simple case is to create one Job object in order to reliably run one Pod to

It works this way:

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  ...
spec:
  ...
  jobTemplate:
    metadata:
      ...
    spec:
      template:
        spec:
          containers:
          - name: ad-sync
            ...
            envFrom:
              - configMapRef:
                  name: ad-sync-service-configmap
            command: ["dotnet", "AdSyncService.dll"]

Set the concurrencyPolicy in a cronjob, job.yaml": error validating data: ValidationError(CronJob.spec.jobTemplate.spec. template.spec): unknown field "concurrencyPolicy" in� The sixth field (see below for field description) is the name of a user for the command to run as. This gives the system crontab the ability to run commands as any user. The user crontabs: User can install their own cron jobs using the crontab command. The sixth field is the command to run, and all commands run as the user who created the crontab

CronJob Documentation Fails to Create Cron Job � Issue #2325 , This is a Feature Request Bug Report Problem: The https://kubernetes.io/docs/ user-guide/cron-jobs/ guide fails at the first step, which is� The CronJob controller will check the every 10 seconds the list of cronjobs in the given Kubernetes Client. For every CronJob, it checks how many schedules it missed in the duration from the lastScheduleTime till now. If there are more than 100 missed schedules, then it doesn't start the job and records the event:

unknown field "selector" in io.k8s.api.batch.v1beta1 , unknown field "selector" in io.k8s.api.batch.v1beta1.CronJobSpec #191. Closed. gameforce opened this issue on Nov 29, 2019 � 7 comments. Closed� Fill in the Run text field with cron-style time syntax, for example: CONFIG_TEXT: * */4 * * * Fill in the Command text field with the cron command, for example:

CronJobs | Kubernetes Engine Documentation, The spec.schedule field defines when, and how often, the CronJob runs, using Unix standard crontab format. All CronJob times are in UTC. There are 5 fields,� kustomize creates an invalid metadata block in the CronJob Job spec and kubectl correctly complains about an invalid spec. Steps to reproduce: Unzip cronjobs.zip to create the directory structure below: cronjobs ├── base │ ├── cronjob.ya

"Unknown field" error at every cron run [#1952856], Hi, folks. I get the following error every time I run cron: EntityFieldQueryException: Unknown field: field_user_chats in� Plesk Onyx is not accessible after an upgrade on a Linux server: Unknown column 'id' in 'field list', query was: SELECT id, name, descr, enabled FROM actions An operation fails in Plesk: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'X' for key 'PRIMARY'

Comments
  • Hi i think it should be configMapKeyRef
  • it works but is not the same thing as you described in your example, please check my answer below.