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?
The Kubernetes scheduler is a control plane process which assigns Pods to Nodes. The scheduler determines which Nodes are valid placements for each Pod in the scheduling queue according to constraints and available resources. The scheduler then ranks each valid Node and binds the Pod to a suitable Node.
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/
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!
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.
Seems like "Cron Jobs" (since 1.4) is the answer: http://kubernetes.io/docs/user-guide/cron-jobs/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With