rancher / k3os

Purpose-built OS for Kubernetes, fully managed by Kubernetes.
https://k3os.io
Apache License 2.0
3.5k stars 397 forks source link

System clock not synced #730

Closed axot closed 3 years ago

axot commented 3 years ago

Version (k3OS / kernel) v0.20.7-k3s1r0 5.4.0-73-generic rancher/k3os#82 SMP Thu Jun 3 02:29:43 UTC 2021

Architecture x86_64

Describe the bug I checked both date and hwclock command, the system current time is not correct. In my case, it was 3 minus advanced.

Expected behavior It should be sync via a NTP daemon.

Actual behavior It seems time is not synced.

dweomer commented 3 years ago

ntpd is not started by default because connman is supposed to take care of clock skew. Depending on your configuration and network (can it access the internet?), this can be easy to break. I like to start ntpd with a run_cmd in my config.yaml, e.g.:

run_cmd:
- rc-service ntpd start

If your network is isolated from the public internet you will of course need to add a write_files entry to properly configure /etc/conf.d/ntpd


The other bit is timezone. k3OS only supports UTC by default. Anything else is an exercise left to the reader.

axot commented 3 years ago

Thanks @dweomer, I tested this method works great!