Add and customize support bundles
This topic describes how to add a default support bundle spec to a release for your application. It also describes how to customize the default support bundle spec based on your application's needs. For more information about support bundles, see About Preflight Checks and Support Bundles.
Add the default support bundle spec to a release
When you add an empty support bundle spec to your Helm chart, the spec automatically includes the clusterInfo and clusterResources collectors by default. You do not need manually include these collectors in the spec.
To add the default support bundle spec to a release for your application:
-
In your Helm chart
templatesdirectory, create a YAML file. Name the filesupport-bundle.yamlor similar.noteIf you deploy your application as multiple Helm charts, Replicated recommends that you create separate support bundle specs for each subchart. This allows you to make specs that are specific to different components of your application. When Replicated generates a support bundle, it combines all the specs into a single bundle.
-
In the YAML file, add the following to create a Kubernetes Secret with the default support bundle spec:
# templates/support-bundle.yamlapiVersion: v1kind: Secretmetadata:# troubleshoot.sh/kind: support-bundle label is requiredlabels:troubleshoot.sh/kind: support-bundlename: example# add the spec in a support-bundle-spec key under stringDatastringData:support-bundle-spec: |apiVersion: troubleshoot.sh/v1beta2kind: SupportBundlemetadata:name: support-bundlespec:collectors: []analyzers: [] -
(Recommended) Customize the default spec by adding more collectors and analyzers or editing the default collectors. See Customize the default support bundle spec on this page.
-
If you deploy your application as multiple subcharts, repeat the previous steps to add a support bundle spec to the templates directory of each chart.
-
Test the support bundle by following the instructions in Generating a Support Bundle.
-
From the root directory of your Helm chart, package the chart into a
.tgzarchive:helm package --dependency-update . -
Add the chart archive to a new release. Promote the release to an internal development channel, and install the release in a development environment to test your changes.
(Recommended) Customize the default support bundle spec
You can customize the support bundle spec by:
- Adding collectors and analyzers
- Editing or excluding the default
clusterInfoandclusterResourcescollectors
Add collectors and analyzers
For common examples of collectors and analyzers used in support bundle specs, see Examples of support bundle specs.
To add collectors and analyzers:
-
In your Helm chart's templates directory, open the Kubernetes Secret that contains the support bundle spec.
-
Update
spec.collectorswith additional collectors based on your application needs. For a list of all available collectors, see All Collectors in the Troubleshoot documentation.The following are some recommended collectors:
- logs
- secret and configMap
- postgresql, mysql, and redis
- runPod
- copy and copyFromHost
- http
-
Update
spec.analyzerswith additional analyzers based on your application needs. For the list of all available analyzers, see the Analyze section in the Troubleshoot documentation.The following are some recommended analyzers:
- textAnalyze
- deploymentStatus
- clusterPodStatuses
- replicasetStatus
- statefulsetStatus
- postgresql, mysql, and redis
noteGood analyzers clearly identify failure modes and provide troubleshooting guidance for the user. For example, if you can identify a log message that indicates a problem in your database component, write an analyzer to check for that log. Include a description of the error for the user.
-
Test the support bundle by following the instructions in Generating a Support Bundle.
-
From the root directory of your Helm chart, package the chart into a
.tgzarchive:helm package --dependency-update . -
Add the chart archive to a new release. Promote the release to an internal development channel, and install the release in a development environment to test your changes.
Customize the default clusterResources collector
You can edit the default clusterResources using the following properties:
-
namespaces: The list of namespaces from which to collect resources and information. If thenamespaceskey is not specified, then theclusterResourcescollector defaults to collecting information from all namespaces. You cannot remove thedefaultnamespace, but you can specify additional namespaces. -
ignoreRBAC: When true, theclusterResourcescollector does not check for RBAC authorization before collecting resource information from each namespace. This is useful when your cluster uses authorization webhooks that do not support SelfSubjectRuleReviews. Defaults to false.
The following example shows how to specify the namespaces where the clusterResources collector collects information:
spec:
collectors:
- clusterResources:
namespaces:
- default
- my-app-namespace
ignoreRBAC: true
The following example shows how to use Helm template functions to set the namespace:
spec:
collectors:
- clusterResources:
namespaces: {{ .Release.Namespace }}
ignoreRBAC: true
The following example shows how to use the Replicated Namespace template function to set the namespace:
spec:
collectors:
- clusterResources:
namespaces: '{{repl Namespace }}'
ignoreRBAC: true
For more information, see Namespace in Static Context.
Exclude the default collectors
Replicated recommends including the default clusterInfo and clusterResources collectors because they collect a large amount of data for installation and debugging. However, you can exclude them.
The following example shows how to exclude both the clusterInfo and clusterResources collectors from your support bundle spec:
spec:
collectors:
- clusterInfo:
exclude: true
- clusterResources:
exclude: true
Add a support bundle spec for non-Helm applications or KOTS v1.94.1 and earlier
For non-Helm applications or installations with KOTS v1.94.1 and earlier, add the SupportBundle custom resource to a YAML file at the root level of your release:
# support-bundle.yaml
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: example
spec:
collectors: []
analyzers: []
Customize the collectors and analyzers as desired.