<p>I am working on a test case that checks if an action that supports <a href="https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm" rel="nofollow noreferrer">Cron</a>-based schedule occurred within the Kubernetes cluster within next 1 minute. I first need to set this Cron expression in a CRD within the cluster (details are not important). I am worried that if I use the test machine's local time, there is possibility of a time skew and even if this skew is of around 30 seconds, the test case is supposed to fail.</p>
<p>Is there a way to get the current time on the cluster? If so, I can use that time instead of local time to set the Cron expression to have a more predictable test case. I may not have a Kubernetes pod with a shell to execute a shell command.</p>
<p>I am relatively new to Kubernetes and understand that the cluster can be running over multiple nodes but they might be synchronizing time among themselves. Let me know if I am fundamentally wrong on certain aspect of Kubernetes.</p>

Jatin Sanghvi
<p>A kubernetes cluster is a conceptual thing, it consists of physical nodes that execute the workload.
Depending on how you operate your cluster the kubernetes controllers are running on one of the nodes as well. Controllers are responsible for implementing the api objects like a CronJob.</p>
<p>You just need to make sure that each node has synchronized time and the creation of the Job as a result from a CronJob will happen as expected.</p>
<p>If you have enough resources on the nodes the scheduling of the Pod that executes the job should be quite fast, a couple of seconds and starting should be reasonable fast, if no slow image pull is involved too.</p>
<p>So: Have ntp running on all nodes and don't worry about 'kubernetes internal cluster time' as there is no such thing.</p>
