1

With GCP, you can click the RUN NOW button on a CronJob's page and the generated pod will be visible under the Managed Pods section on that same page. How can I do the same using the kubectl CLI?

I tried the command kubectl create job ... but it creates a completely separate Job and it's not connected to the CronJob.

kbariotis
  • 783
  • 1
  • 12
  • 25

1 Answers1

0

kubectl create job --from=cronjob/${NAME_OF_EXISTING_CRONJOB} ${JOB_NAME}

Gari Singh
  • 11,418
  • 2
  • 18
  • 41
  • This doesn't behave the same as when you click the RUN NOW button in the GCP UI. It seems like its creating a completely new Job as opposed to GCP creating a managed pod inside the CronJob. – kbariotis Sep 01 '21 at 09:57
  • You can check out a similar case on [How can I trigger a Kubernetes Scheduled Job manually](https://stackoverflow.com/questions/40401795/how-can-i-trigger-a-kubernetes-scheduled-job-manually/46062397#46062397) for further more details . – Fariya Rahmat Sep 09 '21 at 10:38