<p>What will be the equivalent for creating a job:</p>
<pre><code>kubectl -n my-ns create job --from=cronjob/my-cron-job my-job
</code></pre>
<p>using <a href="https://github.com/kubernetes-client/javascript" rel="noreferrer">javascript kubernetes-client</a> ?</p>

<p>Found the solution to my question, with the help of this <a href="https://github.com/kubernetes-client/python/issues/991#issuecomment-545101606" rel="nofollow noreferrer">comment</a></p>
<p>This is how it looks like with <a href="https://github.com/kubernetes-client/javascript" rel="nofollow noreferrer">javascript kubernetes-client</a>, used in a pod inside the cluster (rbac permission might be needed, im running on k8s docker-desktop so didnt need):</p>
<pre><code>const createJobFromCronJob = async (
    cronJobNamespace: string,
    cronJobName: string,
    jobNamespace: string,
    jobName: string) =&gt; {
    // next 4 lines can be initialized somewhere else
    const kubeConfig = new k8s.KubeConfig();
    kubeConfig.loadFromCluster();
    const batchV1Api = kubeConfig.makeApiClient(k8s.BatchV1Api);
    const batchV1beta1Api = kubeConfig.makeApiClient(k8s.BatchV1beta1Api);
    try {
        const cronJob = await batchV1beta1Api.readNamespacedCronJob(cronJobName, cronJobNamespace);
        const cronJobSpec = cronJob.body.spec.jobTemplate.spec;
        const job = new k8s.V1Job();
        const metadata = new k8s.V1ObjectMeta();
        job.apiVersion = 'batch/v1';
        job.kind = 'Job';
        job.spec = cronJobSpec;
        metadata.name = jobName;
        metadata.annotations = {
            'cronjob.kubernetes.io/instantiate': 'manual',
        };
        job.metadata = metadata;
        const result = await batchV1Api.createNamespacedJob(jobNamespace, job);
        console.log('job created');
    } catch (err) {
        console.error(`failed to create job: ${err.message}`);
        throw err;
    }
}
</code></pre>
