<p>The Kubernetes <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="nofollow noreferrer">documentation</a> mentions that a <code>CronJob</code> supports the use case of:</p>
<blockquote>
<p>Once at a specified point in time</p>
</blockquote>
<p>But, I don't see any examples of how this would be possible. Specifically, I'm looking to kick off a job to run once in <em>N</em> hours.</p>

Aaron H
<p>According to <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="nofollow noreferrer">documentation</a>, CronJob uses the common <a href="https://en.wikipedia.org/wiki/Cron" rel="nofollow noreferrer">Cron</a> format of schedule:</p>

<p>Here are some examples:</p>

<pre><code>  schedule: "1 2-14 * * 0-1,5-6" (first minute of every hour from 2am to 2pm UTC on Sun,Mon,Fri,Sat)
  schedule: "*/1 * * * *" (every minute)
</code></pre>

<p>CronJobs also have some limitations:</p>

<blockquote>
  <p>A cron job creates a job object about once per execution time of its
  schedule. We say “about” because there are certain circumstances where
  two jobs might be created, or no job might be created. We attempt to
  make these rare, but do not completely prevent them. Therefore, <strong>jobs
  should be idempotent</strong>.</p>
  
  <p>If <code>startingDeadlineSeconds</code> is set to a large value or left unset (the
  default) and if <code>concurrencyPolicy</code> is set to <code>Allow</code>, the jobs will
  always run at least once.</p>
  
  <p>Jobs may fail to run if the CronJob controller is not running or
  broken for a span of time from before the start time of the CronJob to
  start time plus <code>startingDeadlineSeconds</code>, or if the span covers
  multiple start times and <code>concurrencyPolicy</code> does not allow concurrency.
  For example, suppose a cron job is set to start at exactly <code>08:30:00</code>
  and its <code>startingDeadlineSeconds</code> is set to <code>10</code>, if the CronJob
  controller happens to be down from <code>08:29:00</code> to <code>08:42:00</code>, the job will
  not start. Set a longer <code>startingDeadlineSeconds</code> if starting later is
  better than not starting at all.</p>
  
  <p>The Cronjob is only responsible for creating Jobs that match its
  schedule, and the Job in turn is responsible for the management of the
  Pods it represents.</p>
</blockquote>

<p>The other important thing is that Kubernetes uses <strong>UTC</strong> exclusively. Make sure you take that into account when you’re creating your schedule.</p>

<p>To run a job just once, you can use <code>kubectl create -f job.yaml</code> started by <strong><a href="https://www.computerhope.com/unix/uat.htm" rel="nofollow noreferrer">at</a></strong> command on the admin machine or on the master node.</p>

<pre><code>echo "kubectl create -f job.yaml" | at midnight 
</code></pre>
