You can edit the advOpts field to set a specific timezone for new or existing Db2
deployments.
About this task
You can add a timezone
field within advOpts
in your YAML file
to set a timezone for new or existing Db2 deployments. The timezone
field holds a
string value that specifies the preferred timezone. This value follows the form
"Continent/Specific city in continent".
While the code examples show commands for db2ucluster
custom resources, this
task can also be run for db2uinstance
. You can replace occurrences of
db2ucluster
in code blocks with db2uinstance
.
Procedure
- For new deployments:
- Before you deploy Db2, specify the
timezone by creating a
timezone
field inside of advOpts
in your
YAML file, as seen in example:
advOpts:
timezone: "Europe/Madrid"
- Save the YAML file and then create the cluster or instance. Example:
oc create -f tz-spec.yaml
- For existing deployments:
- Run this command, replacing <Continent/City> with the timezone
you want to use:
oc patch db2ucluster -n <PROJECT> <DB2UCLUSTER-NAME> --type merge -p '{"spec": { "advOpts": { "timezone": "<Continent/City>" } }}'
- Check that the corresponding
db2uconfig
configMap reflects the new
timezone value:
oc get cm -n <PROJECT> -o yaml c-<DB2UCLUSTER-NAME>-db2uconfig | grep -i timezone
- Delete one or more corresponding Db2 engine pods to enable the configMap changes to
take effect:
oc delete pods -n <PROJECT> c-<DB2UCLUSTER-NAME>-db2u-0
After the pod is recreated, it will deploy in the updated timezone.