Specifying a time zone for the pods

You can specify different time zones for the service pods.

Before you begin

The Operating system where you run Kubernetes command-line interface (CLI) or OpenShift® CLI is Linux®.

About this task

Fix Pack 9 and laterBy default, the time zone is Coordinated Universal Time (UTC).

Procedure

  1. Create a ConfigMap with your time zone settings by using the following command.
    # oc create configmap tz-kolkata --from-file=localtime=/usr/share/zoneinfo/Asia/Kolkata
  2. Add the ConfigMap as set volumes to each service pod by using the following command.
    # oc set volumes statefulset/productmaster-admin --add \
        --type=configmap --name=tz --configmap-name=tz-kolkata \
        --mount-path=/e# octc/localtime --sub-path=localtime
    # oc set volumes statefulset/productmaster-personaui --add \
        --type=configmap --name=tz --configmap-name=tz-kolkata \
        --mount-path=/etc/localtime --sub-path=localtime
    # oc set volumes statefulset/productmaster-restapi --add \
        --type=configmap --name=tz --configmap-name=tz-kolkata \
        --mount-path=/etc/localtime --sub-path=localtime
    # oc set volumes statefulset/productmaster-sch --add \
        --type=configmap --name=tz --configmap-name=tz-kolkata \
        --mount-path=/etc/localtime --sub-path=localtime
    # oc set volumes statefulset/productmaster-wfl --add \
        --type=configmap --name=tz --configmap-name=tz-kolkata \
        --mount-path=/etc/localtime --sub-path=localtime
    # oc set volumes statefulset/productmaster-fts-indexer --add \
        --type=configmap --name=tz --configmap-name=tz-kolkata \
        --mount-path=/etc/localtime --sub-path=localtime
    # oc set volumes statefulset/productmaster-fts-pim --add \
        --type=configmap --name=tz --configmap-name=tz-kolkata \
        --mount-path=/etc/localtime --sub-path=localtime
    # oc set volumes statefulset/productmaster-gds --add \
        --type=configmap --name=tz --configmap-name=tz-kolkata \
        --mount-path=/etc/localtime --sub-path=localtime
    # oc set volumes statefulset/productmaster-ml --add \
        --type=configmap --name=tz --configmap-name=tz-kolkata \
        --mount-path=/etc/localtime --sub-path=localtime
    

Results

Pods get re-created.

What to do next

After the service pods are up and running, you can verify the timestamp.
# oc rsh productmaster-gds-1
# date
# Wed Apr 12 12:09:54 IST 2023