Home > Back-end >  Manual trigger of Kubernetes Scheduled Job
Manual trigger of Kubernetes Scheduled Job

Time:07-30

I would like to trigger a scheduled kubernetes job manually for testing purposes. How can I do this?

CodePudding user response:

Set CRONJOB to the name of your scheduled job. Set JOB to whatever you want.

kubectl create job --from=cronjob/CRONJOB JOB;

Depending on which version of Kubernetes you are running, you may need to use the entire cronjob api resource name, for example:

kubectl create job --from=cronjob.v1beta1.batch/CRONJOB JOB;

You can determine the version to use by running:

kubectl api-resources | grep cronjob

CodePudding user response:

Does "scheduled kubernetes job" mean "Cronjob"??

If it is right, the command is:

kubectl -n $NS create job --from=cronjob/$CRONJOB job-test

It will create JOB and POD resources.

  • Related