2

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

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

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

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"}
4

1 回答 1

3

这是已知的行为CronJob。它为“错过”的时间表创建工作。看看这个未解决的问题 - https://github.com/kubernetes/kubernetes/issues/63371

于 2020-01-10T08:20:08.803 回答