Time based container scheduling on Kubernetes?

7/10/2015

What is the recommended way to execute a container or pod based on a time-based schedule? For example, a task to run at 2am for 10 minutes every day.

On a traditional linux server, crontab would easily work, and that obviously still is possible inside the container. However, since this task only executes for 10 minutes I was looking for a mechanism to execute a basic container on a given time interval, then dispose of of the container.

Chronos (part of Mesos) appears to have a similar behavior, is this possible in Container Engine?

-- TimK
google-kubernetes-engine
kubernetes

5 Answers

11/18/2016

As noted, this was added as part of K8s 1.4 and here is the official documentation. (moved url updated)

-- TimK
Source: StackOverflow

6/7/2016

This is expected to be supported in 1.3: https://github.com/kubernetes/kubernetes/pull/11980

UPDATE:

didn't meet the 1.3 deadline so it'll sleep into 1.4

https://github.com/kubernetes/kubernetes/issues/2156#issuecomment-223385808

UPDATE (thanks @Kevinoid): Looks like it has reached alpha in 1.4 and progress is now being tracked in https://github.com/kubernetes/features/issues/19 with usage documentation at http://kubernetes.io/docs/user-guide/cron-jobs/

-- Jesús Carrera
Source: StackOverflow

7/10/2015

Unfortunately, there isn't currently support for cron jobs in Kubernetes or Container Engine. The Github Issue tracking it is here, if you'd like to share ideas for what features it should have or express your interest in it!

-- Alex Robinson
Source: StackOverflow

7/11/2015

A work around for now would be to use a run-once Pod and add kubectl to your cron tab on a machine.

e.g. add

kubectl create -f <run-once-pod>

to your cron tab.

-- Brendan Burns
Source: StackOverflow

11/29/2016

Seems like "Cron Jobs" (since 1.4) is the answer: http://kubernetes.io/docs/user-guide/cron-jobs/

-- Slava V
Source: StackOverflow