...
- TZ Environment Variable: Another way to set the timezone in a container is to use the
TZ
environment variable. This doesn't require mounting/etc/localtime
but can be less consistent across different environments or container images.
Example Configuration
With this setup, your container will display the time according to the host system's timezone.
Code Block | ||
---|---|---|
| ||
volumes: - name: localtime hostPath: path: /etc/localtime volumeMounts: - name: localtime mountPath: /etc/localtime readOnly: true |
...
Summary
The mounting of /etc/localtime
in your Helm chart is a method to ensure the container uses the same timezone as the host system. This is useful for applications that need to display the correct local time, especially in logs and time-sensitive operations.
...