Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ScheduledJobs on Google Container Engine (kubernetes)

Did someone has an experience running scheduled job? Due to the guide, ScheduledJobs available since 1.4 with enabled runtime batch/v2alpha1

So I was ensured with kubectl api-versions command:

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

But when I tried sample template below with command 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 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

It's possible that feature still not implemented? Or I made some error during template creation?

Thank you in advance.

like image 851
Daniil Bolsun Avatar asked Nov 11 '16 21:11

Daniil Bolsun


People also ask

Which container orchestration tool does Google Kubernetes engine use?

GKE supports the use of container images that are built with Docker, for example as part of a build and deploy pipeline. In GKE version 1.24 and later, Docker cannot manage the lifecycle of containers running on GKE nodes. To learn more about the node images that GKE supports for your workloads, see Node images.

Is Google still using Kubernetes?

Kubernetes builds on 15 years of running Google's containerized workloads and the valuable contributions from the open source community. Inspired by Google's internal cluster management system, Borg, Kubernetes makes everything associated with deploying and managing your application easier.


1 Answers

Okay, I think I resolved this issue. ScheduledJobs is currently in alpha state and Google Container Engine supports this feature only for clusters with additionally enabled APIs. I was able to create such cluster with command:

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

As a result now I have limited 30 day cluster with full feature support. I can see scheduled jobs with kubectl get scheduledjobs as well as create new ones with templates.

You can find more info about alpha clusters here.

like image 139
Daniil Bolsun Avatar answered Oct 05 '22 08:10

Daniil Bolsun