Setting the Timezone for the Containerized Unix Agent
search cancel

Setting the Timezone for the Containerized Unix Agent

book

Article ID: 449417

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine

Issue/Introduction

A containerized Unix Agent (agent-unix) runs in UTC or another incorrect timezone, and there is no direct timezone or TZ field available in the values.yaml file. Standard Kubernetes methods, such as manually adding env entries or mounting /etc/localtime from the host, cannot be applied because the Pod spec is generated from a fixed Helm chart template that cannot be modified by the user.

Environment

Product: Automic Automation / Automic Automation Kubernetes Edition (AAKE)
Component: Containerized Unix Agent (agent-unix Helm chart)
Version: 26.0.0

Cause

The Helm chart's templates/deployment.yaml uses the envFrom directive to inject the entire agent-unix-config ConfigMap into the container as environment variables.

envFrom:
  - configMapRef:
      name: "{{ .Values.iniConfiguration.name }}"

While documentation primarily focuses on AUTOMIC_* prefixed keys, envFrom passes all keys in the ConfigMap to the container. Any key, such as TZ, becomes a real environment variable inside the container.

Note: Mounting /etc/localtime via hostPath is not possible with this chart because the volume list is fixed; however, setting the TZ environment variable is sufficient for the agent's logs and the container's system time to reflect the correct zone.

Resolution

1. Verify the Current Timezone

Run the following commands to check the current date and whether a TZ variable is already set:

kubectl -n <namespace> exec <pod-name> -- date

2. Confirm Timezone Availability in the Image

Ensure the desired IANA timezone file exists within the container image. This example uses Montreal:

kubectl -n <namespace> exec <pod-name> -- ls -la /usr/share/zoneinfo/America/ | grep -i montreal

If a specific name is missing, check for a canonical equivalent (e.g., America/Toronto for Montreal).

3. Update the ConfigMap

Apply a merge patch to the ConfigMap. This adds the TZ key without overwriting existing Automic configuration keys:

kubectl -n <namespace> patch configmap agent-unix-config --type merge \  -p '{"data":{"TZ":"America/Montreal"}}'

4. Restart the Agent

Environment variables are only loaded during container startup. Perform a rollout restart to apply the change:

kubectl -n <namespace> rollout restart deployment/agent-unix

5. Verify the Change

Check the new Pod to ensure the date command and the agent logs reflect the new timezone:

kubectl -n <namespace> exec <new-pod-name> -- date
kubectl -n <namespace> exec <new-pod-name> -- tail -5 /opt/agent-unix/temp/ucxjxxx_l00.txt

Additional Information

  • Helm Upgrades: The agent-unix-config ConfigMap is externally managed and not defined within the Helm chart templates. Therefore, helm upgrade or helm uninstall will not remove or reset this ConfigMap.
  • Lifecycle: The setting persists through Pod restarts, crashes, or node rescheduling as it is stored in the Kubernetes API (etcd)