Skip to content

K8tz

k8tz exists because try as we might, time is still hard. It is a Kubernetes admission controller and a CLI tool to inject timezones into Pods and CronJobs.

Containers do not inherit timezones from host machines and only access the clock from the kernel. The default timezone for most images is UTC, yet it is not guaranteed and may be different from container to container. With k8tz it is easy to standardize selected timezone across pods and namespaces automatically with minimal effort.

smol-k8s-lab uses this to ensure your cronjobs and your backups are all in the same timezone, so that if you have any special cronjobs that need to run as a specific time in a specific timezone, you can rest assured they will actually run at that time.

Please trust us when we say that you very likely want k8tz if you have non-standard backup processes for something like Nextcloud.

smol-k8s-lab requires only one variable for our default k8tz Argo CD Application: timezone, which should be a timezone from the TZ database (in the wikipedia list, you want the second column, TZ Identifier).

example config

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
apps:
  k8tz:
    enabled: false
    description: |
      k8tz is a kubernetes admission controller and a CLI tool to inject timezones into Pods and CronJobs.

      Containers do not inherit timezones from host machines and have only access to the clock from the kernel. The default timezone for most images is UTC, yet it is not guaranteed and may be different from container to container. With k8tz it is easy to standardize selected timezone across pods and namespaces automatically with minimal effort.

      You can find your timezone identifier here: [link=https://wikipedia.org/wiki/List_of_tz_database_time_zones#List]https://wikipedia.org/wiki/List_of_tz_database_time_zones[/link]

      Learn more: [link=https://github.com/k8tz/k8tz]https://github.com/k8tz/k8tz[/link]
    init:
      enabled: true
    argo:
      secret_keys:
        timezone: "Europe/Amsterdam"
      # git repo to install the Argo CD app from
      repo: "https://github.com/small-hack/argocd-apps"
      # path in the argo repo to point to. Trailing slash very important!
      path: "k8tz/"
      # either the branch or tag to point at in the argo repo above
      revision: "main"
      # kubernetes cluster to install the k8s app into, defaults to Argo CD default
      cluster: https://kubernetes.default.svc
      # namespace to install the k8s app in
      namespace: "k8tz"
      # source repos for Argo CD App Project (in addition to app.argo.repo)
      project:
        name: k8tz
        source_repos:
          - "https://k8tz.github.io/k8tz/"
        destination:
          namespaces:
            - argocd