Exec into the Db2 pod

You must be able to run the exec command on the Db2® pod to perform common administration tasks.

About this task

Important: This topic is for Db2 Operator V2 deployments. If you are currently using a legacy deployment, refer to the documentation in Legacy deployment documentation. If you are unsure which deployment type you are using, use the version checker.

In the following procedure, the placeholder is used to represent the namespace used for the respective database deployments.

Before completing the procedure, define the environment variables:
export NAMESPACE="<your_namespace>"
export KCTL="oc"        # or: export KCTL="kubectl"
export DB2UINSTANCE_NAME="<db2uinstance_name>"

Procedure

  1. Optionally list the Db2 pods for your database deployment:
    ${KCTL} -n ${NAMESPACE} get pod -l app=${DB2UINSTANCE_NAME}
  2. Find the name of your main Db2 pod for your database deployment:
    db2_podname=$(${KCTL} -n ${NAMESPACE} get pod -l name=dashmpp-head-0 -o jsonpath='{.items[0].metadata.name}')
  3. Run the exec command to exec into the Db2 pod:
    ${KCTL} -n ${NAMESPACE} exec -it ${db2_podname} -- bash