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

**URL:** <https://community.replicated.com/t/generate-a-support-bundle-using-the-cli-and-upload-it-into-the-application-installer/1045>\
**Category:** How do I?\
**Tags:** kots, support-bundle\
**Created:** [November 18, 2022, 8:03pm UTC](https://community.replicated.com/t/generate-a-support-bundle-using-the-cli-and-upload-it-into-the-application-installer/1045 "2022-11-18T20:03:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdewinne](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/jdewinne/32/152_2.png) [@jdewinne](https://community.replicated.com/u/jdewinne)\
**Post date:** [November 18, 2022, 8:03pm UTC](https://community.replicated.com/t/generate-a-support-bundle-using-the-cli-and-upload-it-into-the-application-installer/1045/1 "2022-11-18T20:03:13Z")

</div>

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!

```auto
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

```

---

<div class="post-metadata">

**Author:** ![Mitch](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Mitch](https://community.replicated.com/u/Mitch)\
**Post date:** [July 6, 2023, 4:03pm UTC](https://community.replicated.com/t/generate-a-support-bundle-using-the-cli-and-upload-it-into-the-application-installer/1045/2 "2023-07-06T16:03:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jdewinne](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/jdewinne/32/152_2.png) [@jdewinne](https://community.replicated.com/u/jdewinne)\
**Post date:** [July 11, 2023, 10:18pm UTC](https://community.replicated.com/t/generate-a-support-bundle-using-the-cli-and-upload-it-into-the-application-installer/1045/3 "2023-07-11T22:18:49Z")

</div>

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.

> **[GitHub - jdewinne/cron-support-bundle](https://github.com/jdewinne/cron-support-bundle/tree/main)**
>
> main

---

<div class="post-metadata">

**Author:** ![Mitch](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Mitch](https://community.replicated.com/u/Mitch)\
**Post date:** [July 12, 2023, 12:18am UTC](https://community.replicated.com/t/generate-a-support-bundle-using-the-cli-and-upload-it-into-the-application-installer/1045/4 "2023-07-12T00:18:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Alex\_Parker](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/alex_parker/32/777_2.png) [@Alex\_Parker](https://community.replicated.com/u/Alex_Parker)\
**Post date:** [July 12, 2023, 1:04am UTC](https://community.replicated.com/t/generate-a-support-bundle-using-the-cli-and-upload-it-into-the-application-installer/1045/5 "2023-07-12T01:04:08Z")

</div>

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