<p>Is there a way through which I can run an existing Job using CronJob resource.
In CronJob Spec template can we apply a selector using labels. Something like this:</p>

<p>Job Spec: (<a href="https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#running-an-example-job" rel="nofollow noreferrer">Link to job docs</a>)</p>

<pre><code>apiVersion: batch/v1
kind: Job
label:
  name: pi
spec:
  template:
    spec:
      containers:
      - name: pi
        image: perl
        command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
      restartPolicy: Never
  backoffLimit: 4
</code></pre>

<p>Cron Spec:</p>

<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: pi-cron
spec:
  schedule: "*/1 * * * *"
  jobTemplate:
    spec:
      labelSelector:
        name: pi # refer to the job created above
</code></pre>

<p>I came across this. I want to try inverse of this.
<a href="https://stackoverflow.com/questions/40401795/how-can-i-trigger-a-kubernetes-scheduled-job-manually">Create-Job-From-Cronjob</a></p>

Ankit Deshpande
<p>No, you can not do this in the way you want. <code>kubectl</code> only allows you to create jobs based on cronjob, but not vise-versa.</p>

<pre><code> kubectl create job NAME [--image=image --from=cronjob/name] -- [COMMAND] [args...] [flags] [options]
</code></pre>

<p>Available commands right now for kubectl create:</p>

<pre><code>  clusterrole         Create a ClusterRole.
  clusterrolebinding  Create a ClusterRoleBinding for a particular ClusterRole
  configmap           Create a configmap from a local file, directory or literal value
  deployment          Create a deployment with the specified name.
  job                 Create a job with the specified name.
  namespace           Create a namespace with the specified name
  poddisruptionbudget Create a pod disruption budget with the specified name.
  priorityclass       Create a priorityclass with the specified name.
  quota               Create a quota with the specified name.
  role                Create a role with single rule.
  rolebinding         Create a RoleBinding for a particular Role or ClusterRole
  secret              Create a secret using specified subcommand
  service             Create a service using specified subcommand.
  serviceaccount      Create a service account with the specified name
</code></pre>
