Search code examples
scheduled-taskskubernetesgoogle-kubernetes-engine

How can I trigger a Kubernetes Scheduled Job manually?


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?


Solution

  • 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> -n <namespace-name>

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