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