Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,49 @@ NTP synchronized: yes
Sun 2015-11-01 01:00:00 EST
```

## Time synchronization
### Setting the time zone via Ignition

If you are aware of the downsides to setting a system time zone that is different from the default UTC time zone, you can set a different system time zone by setting the local time zone configuration file,[`/etc/localtime`][localtime], to be an absolute or relative symlink to a `tzfile` entry under `/usr/share/zoneinfo/`.
It is recommended that you set the same time zone across all your machines in the cluster.

For example, you can set the time zone to `America/New_York` by using a Butane config like the following:

```shell
variant: flatcar
version: 1.1.0
storage:
links:
- path: /etc/localtime
target: ../usr/share/zoneinfo/America/New_York
```
`"overwrite": true`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What' s the intention here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is necessary if a default time zone has already been set.
I'm not sure exactly, as I use existing examples as templates.

<details>

<summary>Remark to other references </summary>

If you come accross https://github.com/flatcar/Flatcar/issues/491#issuecomment-908316042 and wondering whether you have to use the fields `"overwrite": true` and `"filesystem": "root"` unlike in Fedora Core OS?
Here is the ansser: https://github.com/flatcar/Flatcar/issues/1836#issuecomment-3175310460

</details>
Comment on lines +90 to +97
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole thing can be dropped. FCOS is not using Ignition 2 since years now, so no need to mention the overwrite: true / `filesystem: root" difference.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's how the journey began.

If you start googling (or asking AI), you get a mix of old and up-to-date answers.
It's difficult to know if the things in the old examples are still needed or omitted due to other reasons, such as a slight difference in configuration.

I want to clarify things here. It always helps to give some histroical context for users not follwing a project cloelsys to keep track of such hchanges




## Time synchronization to HOST

To keep in sync with the host's timezone, you can mount the timezone configuration file to Flatcar Container Linux.
You add the following to your mount configuration section

```yaml
volumeMounts:
- name: localtime
mountPath: /etc/localtime
volumes:
- name: localtime
hostPath:
path: /etc/localtime
```

## Time synchronization to NTP

Flatcar Container Linux clusters use NTP to synchronize the clocks of member nodes, and all machines start an NTP client at boot. The operating system uses [`systemd-timesyncd(8)`][systemd-timesyncd] as the default NTP client. Use `systemctl` to check which service is running:

Expand Down Expand Up @@ -208,9 +250,11 @@ storage:
restrict [::1]
```

[localtime]: https://www.freedesktop.org/software/systemd/man/localtime.html
[timedatectl]: http://www.freedesktop.org/software/systemd/man/timedatectl.html
[ntp.org]: http://ntp.org/
[systemd-timesyncd]: http://www.freedesktop.org/software/systemd/man/systemd-timesyncd.service.html
[systemd.network]: http://www.freedesktop.org/software/systemd/man/systemd.network.html
[timesyncd.conf]: http://www.freedesktop.org/software/systemd/man/timesyncd.conf.html
[butane-configs]: ../../provisioning/config-transpiler
[issuecomment-908316042]: https://github.com/flatcar/Flatcar/issues/491#issuecomment-908316042