Generate a support bundle using the CLI and upload it into the application installer

If you need to generate a support bundle using the support-bundle kubectl plugin, one way is to use the application installer UI and get the CLI command from the UI.
However, in some case you might not be able to access the UI, or you might want to automate the process of creating a support bundle. For example, create a new support bundle based on a cron pattern.

Below is a bash script that can do this for you. Replace the KOTS_PWD, KOTS_ENPOINT and APP_SLUG with your values, and give it a try!

KOTS_PWD=[your kotsadm password]
KOTS_ENDPOINT=[your kotsadm endpoint, for example: https://someip:8800]
APP_SLUG=[your application slug]

json=$( jq -n -c --arg password "${KOTS_PWD}" '$ARGS.named' )
token=$(curl -k -H "Content-Type: application/json" --request POST -d "$json" ${KOTS_ENDPOINT}/api/v1/login | jq -r ".token")
origin=$( jq -n -c --arg origin "${KOTS_ENDPOINT}" '$ARGS.named' )
command=$(curl -s -k -H "Content-Type: application/json" -H "Authorization: $token" --request POST -d "$origin" ${KOTS_ENDPOINT}/api/v1/troubleshoot/app/$APP_SLUG/supportbundlecommand | jq -r ".command[1]")
${command} --insecure-skip-tls-verify=true --interactive=false
1 Like

Does kotsadm have an endpoint to initiate its own support bundle collection and upload it to vendor portal? That would solve a bunch of grief where there’s (a) no kubectl user available at the customer because, you know how IT can work, and (b) no kotsadm access for the same reason.

Hi @Mitch
A while ago I created a sample that uses a k8s CronJob to generate a support bundle and store it on an s3 bucket. I’m pretty sure you could do something similar.

Yeah, good point, Josh. Kubectl support-bundle inside a pod is an option. I was wondering if the Kots API offered it since it’s already in kots and the kots GUI service does it.

On second thought, I also wonder if the new Helm SDK might offer such an endpoint down the roadmap?

cc: @Alex_Parker

Yes, there’s a very good chance we’ll add an endpoint to the SDK API to collect a support bundle.