How can I trigger a Kubernetes Scheduled Job manually?

aknuds1 picture aknuds1 · Nov 3, 2016 · Viewed 55.1k times · Source

I've created a Kubernetes Scheduled Job, which runs twice a day according to its schedule. However, I would like to trigger it manually for testing purposes. How can I do this?

Answer

pedro_sland picture pedro_sland · Apr 26, 2018

The issue #47538 that @jdf mentioned is now closed and this is now possible. The original implementation can be found here but the syntax has changed.

With kubectl v1.10.1+ the command is:

kubectl create job --from=cronjob/<cronjob-name> <job-name>

It seems to be backwardly compatible with older clusters as it worked for me on v0.8.x.