Setting the Node Time Zone

All nodes of a cluster should run with one agreed time zone, so that platform logs, audit records and monitoring timelines line up with the operator's wall clock. On Alauda OS nodes you set the time zone with a MachineConfig object — never by logging in to nodes and changing them one by one.

The time zone cannot be shipped as a file: /etc/localtime is a symbolic link, and machine configuration manages file contents, systemd units, and SSH public keys — not symbolic links. Instead, a oneshot systemd unit runs timedatectl set-timezone on each node.

Configure the Node Disruption Policy First

Without a node disruption policy, a systemd unit change falls back to the default action — rebooting the node — so applying the MachineConfig below would roll every node in the pool through a drain and reboot. Configure the policy first, confirm it took effect, and only then apply the MachineConfig.

  1. Add set-timezone.service to the nodeDisruptionPolicy.units list of the cluster-scoped MachineConfiguration singleton named cluster:

    apiVersion: machineconfiguration.alauda.io/v1alpha1
    kind: MachineConfiguration
    metadata:
      name: cluster
    spec:
      nodeDisruptionPolicy:
        units:
          - name: set-timezone.service
            actions:
              - type: DaemonReload
              - type: Restart
                restart:
                  serviceName: set-timezone.service
    WARNING

    cluster is a singleton that may already carry policies for other units or files — for example the /etc/chrony.conf entry from Configuring the Chrony Time Service. Append to the units list; do not replace the existing policy. Any unit not listed falls back to the default reboot action.

  2. Confirm the policy is active before going on:

    kubectl get machineconfiguration cluster \
      -o jsonpath='{.status.nodeDisruptionPolicyStatus}' | grep set-timezone

Apply the Time Zone

Create one MachineConfig per role — the two objects differ only in metadata.name and the role label. Replace Asia/Shanghai with the agreed tz database name; do not deliver the example value unchanged.

apiVersion: machineconfiguration.alauda.io/v1alpha1
kind: MachineConfig
metadata:
  name: 99-worker-timezone # name the control plane copy 99-master-timezone
  labels:
    machineconfiguration.alauda.io/role: worker # and label it master
spec:
  config:
    ignition:
      version: 3.4.0
    systemd:
      units:
        - name: set-timezone.service
          enabled: true
          contents: |
            [Unit]
            Description=Set node timezone
            After=multi-user.target

            [Service]
            Type=oneshot
            ExecStart=/usr/bin/timedatectl set-timezone Asia/Shanghai
            RemainAfterExit=yes

            [Install]
            WantedBy=multi-user.target

Verify

kubectl get machineconfigpool

Wait until each pool reports UPDATED=True and DEGRADED=False, and confirm no node went through an unexpected drain or reboot. Then spot-check nodes:

timedatectl                             # time zone and NTP state
systemctl status set-timezone.service   # ran once, exited successfully

Platform logs, audit records and monitoring timelines should now agree with the configured time zone.

  • Time zone at install time is a host prerequisite — see the bare metal page's Host Clock and Time Zone requirements. This page is for normalizing or changing the time zone on a running cluster.
  • Time synchronization is a separate concern, configured through Configuring the Chrony Time Service.