<p>I'm on my way to learn k8s, and I'd love to know how we can create boilerplate for <strong>cronjob</strong>.</p>

<p>I know it used to be follwoing.</p>

<p><code>kubectl run mycron --schedule "1 * * * *" --image nginx -o yaml --dry-run</code>. </p>

<p>Even it still outputs the boilerplate but it says following. </p>

<blockquote>
  <p>kubectl run --generator=cronjob/v1beta1 is DEPRECATED and will be
  removed in a future version. Use kubectl create instead.</p>
</blockquote>

<p>However I couldn't find how to generate it with <code>kubectl create</code>. Any ideas?</p>

Toshi
<p>It looks it's no more possible to create the scaffolding directly from the CLI:</p>

<pre><code># kubectl create
(...)
Available Commands:
  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>

<p>As you can see, no <code>cronjobs</code> command available: from my experience, I would suggest you to checkout <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#cronjob-v2alpha1-batch" rel="nofollow noreferrer">API documentation</a> according to your Kubernetes running version and fill a temporary YAML and then proceed with a <code>kubectl create -f path/to/file.yaml</code></p>
