<p><code>Kubectl</code> allows you to create ad hoc jobs based on existing crons.</p>
<p>This works great but in the documentation there is no specification for passing arguments upon creation of the job.</p>
<p>Example:</p>
<pre><code>kubectl -n my-namespace create job --from=cronjob/myjob my-job-clone
</code></pre>
<p>Is there any way I can pass arguements to this job upon creation?</p>

Nicholas Porter
<p>Although <code>kubectl</code> currently does not allow you to use the --from flag and specify a command in the same clause, you can work around this limitation by getting the yaml from a dry run and using <code>yq</code> to apply a patch to it.</p>
<p>For example:</p>
<pre><code># get the original yaml file
kubectl create job myjob --from cronjob/mycronjob --dry-run=client --output yaml &gt; original.yaml

# generate a patch with your new arguments
yq new 'spec.template.spec.containers[0].args[+]' '{INSERT NEW ARGS HERE}' &gt; patch.yaml

# apply the patch
yq merge --arrays update patch.yaml original.yaml &gt; final.yaml

# create job from the final yaml 
kubectl create -f final.yaml
</code></pre>
