Kubernetes CronJob未能开始工作“超时”和“工作已经存在”

时间:2018-01-23 10:33:44

标签: cron kubectl kubernetes

我正在尝试在kubernetes中运行一个cronjob,但要继续发生这两个错误:

type: 'Warning' reason: 'FailedCreate' Error creating job: jobs.batch "dev-cron-1516702680" already exists

type: 'Warning' reason: 'FailedCreate' Error creating job: Timeout: request did not complete within allowed duration

以下是我的cronjob yaml

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  creationTimestamp: 2018-01-23T09:45:10Z
  name: dev-cron
  namespace: dev 
  resourceVersion: "16768201"
  selfLink: /apis/batch/v1beta1/namespaces/dev/cronjobs/dev-cron
  uid: 1a32eb94-0022-11e8-9256-065eb556d6a2
spec:
  concurrencyPolicy: Allow
  failedJobsHistoryLimit: 1
  jobTemplate:
    metadata:
      creationTimestamp: null
    spec:
      template:
        metadata:
          creationTimestamp: null
        spec:
          containers:
          - args:
            - for country in th; 
            - do
            - 'curl -X POST -d "{'footprint':'xxxx-xxxx'}"-H "Content-Type: application/json" https://dev.xxx.com/xxx/xxx'
            - done
            image: appropriate/curl:latest
            imagePullPolicy: Always
            name: cron
            resources: {}
            terminationMessagePath: /dev/termination-log
            terminationMessagePolicy: File
          dnsPolicy: ClusterFirst
          restartPolicy: Never
          schedulerName: default-scheduler
          securityContext: {}
          terminationGracePeriodSeconds: 30
  schedule: '* * * * *'
  startingDeadlineSeconds: 10
  successfulJobsHistoryLimit: 3
  suspend: false
status: {}

我不确定为什么会这种情况继续发生。我在AWS集群中运行Kubernetes版本1.9.1。知道为什么吗?

1 个答案:

答案 0 :(得分:0)

事实证明是因为Istio初始化器有一个自动注入器。一旦我为cronjobs禁用了Istio初始化程序注入,它就可以正常工作。