Troubleshooting

Learn how to collect logs that can help you troubleshoot issues related to Business Teams Service (BTS).

apiVersion: v1
kind: ConfigMap
metadata:
  name: ibm-bts-operator-config
  namespace: bts-namespace
data:
  # enables operator tracing in general
  traceEnabled: "true"
  # verbose YAML output (only if trace is enabled)
  debugYaml: "true"

The BTS Operator will then output diagnostic trace to its stdout.

#!/bin/bash

commmon_service_namespace="ibm-common-services"
if [[ $1 != "" ]]
then
  commmon_service_namespace=$1
fi

echo "Check if common services namespace $commmon_service_namespace exists"
nsStatus=$(kubectl get ns $commmon_service_namespace -o jsonpath="{.status.phase}")
if [[ $nsStatus == "Active" ]]
then
  echo "Namespace $commmon_service_namespace exists"
else
  echo "ERROR: Namespace $commmon_service_namespace does not exist. Please provide the correct common services namespace."
  exit 1;
fi

DIR=$(mktemp -d)

#Collecting the description, configuration, logs and referenced secrets of BTS pods
pods="$(kubectl get pod --selector='app.kubernetes.io/component=ibm-bts,role=application-pod' -o custom-columns=NAME:.metadata.name --no-headers)"

for pod in $pods
 do
   echo "Gathering description, configuration and log for $pod"
   kubectl describe pod $pod > $DIR/$pod-description.txt
   kubectl get pod $pod -o yaml > $DIR/$pod-configuration.txt
   echo "Secrets referenced in $pod:" >> $DIR/referencedSecrets.txt
   kubectl get pods $pod -o json |grep secretName >> $DIR/referencedSecrets.txt
   mkdir $DIR/$pod-logs
   kubectl cp $pod:/logs/UMS/$pod/  $DIR/$pod-logs
 done

operatorpod="$(kubectl get pod -n $commmon_service_namespace  -o custom-columns=NAME:.metadata.name --no-headers | grep ibm-bts-operator)" 

echo "Gathering description, configuration and log for $operatorpod" in namespace $commmon_service_namespace
kubectl describe pod $operatorpod -n $commmon_service_namespace > $DIR/$operatorpod-description.txt
kubectl get pod $operatorpod -n $commmon_service_namespace -o yaml > $DIR/$operatorpod-configuration.txt
kubectl logs $operatorpod -n $commmon_service_namespace>  $DIR/$operatorpod.log


 echo "Zip the must-gather directory"
 outputdir=$(pwd)
 (cd $DIR; zip -r $outputdir/bts-must-gather-$(date +"%y-%m-%d_%T").zip ./*)
 rm -rf $DIR

Run the script. Attach the generated .zip file to your support ticket.