自从我将EKS集群升级到v1.21
以来,我在手动触发Cronjobs时得到以下错误:
➜ ~ kubectl create job --from=cronjob/elt-dim-customer-new test-1 -n dwh-dev
error: from must be an existing cronjob: no kind "CronJob" is registered for version "batch/v1" in scheme "k8s.io/kubectl/pkg/scheme/scheme.go:28"
➜ ~ kubectl version
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2",
GitCommit:"faecb196815e248d3ecfb03c680a4507229c2a56", GitTreeState:"clean",
BuildDate:"2021-01-13T13:28:09Z", GoVersion:"go1.15.5", Compiler:"gc",
Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"21+", GitVersion:"v1.21.2-eks-0389ca3", GitCommit:"8a4e27b9d88142bbdd21b997b532eb6d493df6d2", GitTreeState:"clean",
BuildDate:"2021-07-31T01:34:46Z", GoVersion:"go1.16.5", Compiler:"gc",
Platform:"linux/amd64"}
这是Cronjob结构(您可以看到apiVersion
):
apiVersion: batch/v1
kind: CronJob
metadata:
name: elt-dim-customer-new
spec:
schedule: {{ .Values.cron }}
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
找不到EKS 1.21有什么变化。非常感谢您的帮助!
请将kubectl升级到1.21。