即使超过时间,Kubernetes Cronjob 也会立即触发 Job

Kubernetes Cronjob triggers Job immediately even though the time exceeded

我有每天早上 5 点运行的 Kubernetes 作业。今天我想把它改成早上 6 点。我现在的时间是上午 10 点。

将时间从早上 5 点修改为早上 6 点后,我注意到 Kubernetes Cronjob 会立即触发作业,即使我现在的时间是上午 10 点。

这是什么原因?是否有任何参数可用于 enable/disable 此行为?

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: do-not-want-to-reveal
  namespace: default
spec:
  concurrencyPolicy: Forbid
  failedJobsHistoryLimit: 2
  jobTemplate:
    metadata:
      creationTimestamp: null
    spec:
      backoffLimit: 1
      template:
        metadata:
          creationTimestamp: null
        spec:
          containers:
          - image: myrepo/myimage:mytag
            imagePullPolicy: Always
            name: do-not-want-to-reveal
            resources: {}
            terminationMessagePath: /dev/termination-log
            terminationMessagePolicy: File
          dnsPolicy: ClusterFirst
          restartPolicy: OnFailure
          schedulerName: default-scheduler
          securityContext: {}
          serviceAccount: myjob-sa
          serviceAccountName: myjob-sa
          terminationGracePeriodSeconds: 30
  schedule: 00 5 * * *
  successfulJobsHistoryLimit: 2
  suspend: false

Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.9", GitCommit:"16236ce91790d4c75b79f6ce96841db1c843e7d2", GitTreeState:"clean", BuildDate:"2019-03-25T06:30:48Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}

这是 CronJob 的已知行为。它为 "missed" 计划创建作业。看看这个未解决的问题 - https://github.com/kubernetes/kubernetes/issues/63371