Search code examples
amazon-web-serviceskubernetescronamazon-eks

K8S EKS 1.21 trigger Cronjob manually


Ever since I upgraded my EKS cluster to v1.21, I get the following error when triggering Cronjobs manually:

➜  ~ 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"}

This is the Cronjob structure (you can see the apiVersion):

apiVersion: batch/v1
kind: CronJob 
metadata:
  name: elt-dim-customer-new
spec:
  schedule: {{ .Values.cron }}
  successfulJobsHistoryLimit: 1
  failedJobsHistoryLimit: 1
  jobTemplate:
    spec:
      template:
        spec: 

Couldn't find what has changed in EKS 1.21. Will appreciate your assistance!


Solution

  • Please upgrade your kubectl to 1.21 as well.