ScheduledJobs on Google Container Engine

Does anyone have experience doing the scheduled work? Due to the guide , ScheduledJobs are available from version 1.4 with the batch / v2alpha1 runtime enabled

So, I was provided with the kubectl api-versions command:

 autoscaling/v1 batch/v1 batch/v2alpha1 extensions/v1beta1 storage.k8s.io/v1beta1 v1 

But when I tried the template template below with the kubectl apply -f job.yaml

 apiVersion: batch/v2alpha1 kind: ScheduledJob metadata: name: hello spec: schedule: 0/1 * * * ? jobTemplate: spec: template: spec: containers: - name: hello image: busybox args: - /bin/sh - -c - date; echo Hello from the Kubernetes cluster restartPolicy: OnFailure 

I got an error

 error validating "job.yaml": error validating data: couldn't find type: v2alpha1.ScheduledJob; if you choose to ignore these errors, turn validation off with --validate=false 

Is it possible that the function is not yet implemented? Or did I make a mistake when creating the template?

Thanks in advance.

+7
google-container-engine kubernetes google-cloud-platform kubectl
source share
1 answer

Ok, I think I solved this problem. ScheduledJobs is currently in alpha state, and the Google Container Engine only supports this feature for clusters with additional APIs . I was able to create such a cluster with the command:

gcloud alpha container clusters create my-cluster --enable-kubernetes-alpha

As a result, I now have a limited 30-day cluster with full feature support. I can see scheduled tasks with kubectl get scheduledjobs , and also create new ones with templates.

Read more about alpha clusters here .

+6
source share

All Articles