Support bundle workflows
A support bundle is a portable record of cluster and host data used to investigate a problem. The workflow turns a support-bundle specification into collected evidence, evaluates checks against that evidence, removes sensitive values, packages the result, and optionally delivers it to a remote service.
Lifecycle
The lifecycle has one main path for creating a bundle and two useful post-processing paths. Collection and analysis use the same specification so that each check can read the evidence that the collectors produce.
flowchart LR
A[Load specification] --> B[Resolve specification]
B --> C[Collect cluster data]
B --> D[Collect host data]
C --> E[Redact collected data]
D --> E
E --> F[Evaluate analyzers]
F --> G[Add metadata and analysis]
G --> H[Create tar.gz archive]
H --> I[Upload or call back]
H --> J[Read, compare, or redact later]
References: pkg/…/supportbundle.go• L76-82 pkg/…/supportbundle.go• L146-266 pkg/…/load.go• L26-105
Specification sources
The specification is the workflow contract. It names cluster collectors, host collectors, analyzers, and actions that run after collection. A SupportBundle can also point to an upstream specification through spec.uri; a legacy Collector document is accepted by converting its collection fields into a support-bundle workflow.
The command accepts a local file, standard input, a URL, an OCI reference, or a Kubernetes Secret for the support-bundle specification. Additional redactor specifications follow the same general remote or local loading model. A load or parse failure stops the workflow before collection starts.
References: pkg/…/load.go• L43-105 pkg/…/load.go• L151-168 pkg/…/load.go• L225-262 pkg/…/supportbundle_types.go• L23-32
Collection stage
Collection gathers evidence from two scopes. Cluster collectors query the Kubernetes environment. Host collectors inspect node-level state either on the local host or through temporary Kubernetes workloads that run on nodes. Their outputs become named files in one shared bundle workspace.
The workflow adds foundational cluster data when cluster collection runs, removes duplicate collector definitions, and runs compatible collectors in a stable order. It records skipped collectors and collector errors in the bundle so that missing evidence remains visible. Remote host collection waits for its node workloads and uses a configured timeout when one is supplied.
Missing permissions can skip individual collectors or stop the run when the selected policy does not allow collection without those permissions. A collector error does not discard successful results from other collectors. If any results remain, the workflow can continue through analysis and archiving before it returns the collection error to the caller.
See Support bundle collection for the collection contract and execution paths.
References: pkg/…/collect.go• L47-85 pkg/…/collect.go• L88-263 pkg/…/collect.go• L299-354 pkg/…/collect.go• L400-554 pkg/…/collect.go• L647-728 pkg/…/supportbundle.go• L140-176
Analyzer stage
Analyzers turn collected files into findings. Each analyzer reads a named file or a group of files, applies a check, and returns a pass, warning, or failure result with a message and optional help link. Host analyzers use the host data collected for each node.
The normal creation path runs analyzers after collection and writes their results into the bundle. An analyzer can be skipped when it is excluded or when its required file is not present. The separate analyze command can instead unpack an existing bundle and apply default or supplied analyzer definitions without collecting new data.
See Support bundle analysis for analyzer inputs, findings, and evaluation rules.
References: pkg/…/supportbundle.go• L199-220 pkg/…/supportbundle.go• L427-439 pkg/…/download.go• L27-63 pkg/…/analyzer.go• L27-43
Redaction stage
Redaction protects data before the archive leaves the collection environment. Built-in rules and optional rules from redactor specifications inspect matching files and replace or remove sensitive values. The same protection applies to host and cluster results during normal creation.
Redaction can also be a later workflow for an existing archive. That path unpacks the archive, applies the selected rules, and creates a new archive while leaving the source archive as the input. The workflow can record which redactor changed which file. Tokenization can preserve stable references between repeated values instead of using one fixed mask. When enabled for bundle creation, tokenization can also produce a mapping file and summary data for the caller.
See Support bundle redaction for rule scope, reports, and the standalone redaction path.
References: pkg/…/collect.go• L61-85 pkg/…/collect.go• L237-262 pkg/…/supportbundle.go• L232-241 pkg/…/supportbundle.go• L309-366 pkg/…/redact.go• L57-82 pkg/…/redact.go• L105-129 cmd/…/redact.go• L37-71
Archive stage
Packaging makes the workspace portable. The archive contains the collected files plus workflow records such as the Troubleshoot version, user or cluster metadata, analyzer results, skipped-collector information, collector errors, and execution data when those records are available.
The archive is a gzip-compressed tar file. It uses a top-level directory based on the archive name, with files grouped by cluster resource, host, metadata, and analysis below that directory. A generated name is used when no output path is supplied, and an existing name is not overwritten.
See Support bundle artifacts and upload for the archive layout and artifact rules.
References: pkg/…/supportbundle.go• L94-128 pkg/…/supportbundle.go• L178-246 pkg/…/collect.go• L265-271 pkg/…/collect_test.go• L70-115 pkg/…/result.go• L315-411
Delivery stage
Delivery starts only after the archive exists. The specification can request an HTTP upload of the archive or an HTTP callback that tells another service that processing finished. An upload may also send a separate redaction report to the URI supplied for that purpose.
Delivery errors are reported with the collection response. The command-line path can keep the archive and report the error, while library callers can receive the error as a failed post-collection action. A separate upload path can send an existing archive to Replicated using a license and application identity taken from arguments or bundle data.
See Support bundle artifacts and upload for delivery targets and archive ownership.
References: pkg/…/supportbundle.go• L243-306 pkg/…/aftercollection.go• L21-99 pkg/…/aftercollection.go• L102-125 pkg/…/upload.go• L11-58
Post-processing workflows
An existing archive remains useful after creation. The analyze path reads it as evidence for new checks. The redact path produces a safer replacement archive. Both paths extract the archive to temporary storage and use the bundle's version record to confirm that it is a recognizable support bundle.
Existing bundle analysis
The analyze command loads analyzer definitions from a local file or URL, downloads or opens the selected bundle, and evaluates the definitions against its files. It prints the findings as YAML by default or as JSON when requested. It does not recollect cluster or host data.
References: cmd/…/analyze.go• L18-64 cmd/…/analyze.go• L78-115 pkg/…/download.go• L65-116
Existing bundle redaction
The redact command loads one or more redactor specifications, extracts the selected archive, applies the rules to its files, and writes a new tar.gz archive. This path is useful when the original bundle needs another privacy pass before it is shared.
References: cmd/…/redact.go• L16-29 cmd/…/redact.go• L37-71 pkg/…/redact.go• L139-206
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to
SupportBundleSpecmust stay aligned with the loaders and the conversion path that accepts both current and legacy specification kinds. - Changes to collector output paths must stay aligned with analyzer file lookups and with readers that support bundles with or without a top-level directory.
- Changes to collector error or skipped-collector records must stay aligned with the in-memory result and the on-disk bundle workspace.
- Changes to remote host collection timeouts or node output paths must stay aligned with the temporary workload lifecycle and host-data readers.
- Changes to redaction timing or report fields must stay aligned with upload actions that send the redaction report separately from the archive.
- Changes to tokenization outputs must stay aligned with response fields and any mapping file consumed outside the bundle.
- Changes to archive naming or layout must stay aligned with extraction, root-directory detection, artifact parsing, and upload identity discovery.
- Changes to post-collection actions must preserve the distinction between sending the archive and sending a callback without an archive body.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The specification cannot be loaded, parsed, or resolved from its upstream URI. | The workflow does not reach collection. | Check the source kind, location, and document kind before starting a run. |
| All configured collectors fail or produce no result. | No support-bundle archive is created. | Keep foundational collectors available and inspect collector error records and permissions. |
| A collector lacks required Kubernetes permissions and collection without permissions is disabled. | That collector is skipped or the collection run stops. | Review RBAC findings and use the intended permission policy. |
| Remote host collector workloads do not become ready before the timeout. | Host collection fails and the workflow may return only partial results. | Set a timeout that fits cluster start-up time and inspect workload readiness. |
| An analyzer expects a file that collection did not produce. | The analyzer reports a missing-data result or does not produce a finding. | Keep collector names and output paths aligned with analyzer references. |
| Tokenization mapping generation fails after collection. | A library call can fail before archive creation even though collected data exists. | Treat the mapping path and encryption settings as part of the bundle output contract. |
| An archive upload or callback returns a non-success response. | The archive remains local, but delivery is reported as failed. | Check the target method, URI, content type, and response status. |
| An archive is malformed or lacks its version record. | Analysis or later redaction cannot treat it as a support bundle. | Validate the archive before post-processing. |
Key files
| File | Why to read it |
|---|---|
| pkg/…/supportbundle.go | Shows the end-to-end orchestration from a loaded specification through analysis, archiving, tokenization, and post-collection actions. |
| pkg/…/load.go | Defines supported specification sources, document conversion, and upstream URI behavior. |
| pkg/…/collect.go | Connects cluster and host collection to redaction, remote host execution, and collection-failure records. |
| pkg/…/download.go | Shows how an existing archive is prepared and evaluated without a new collection run. |
| pkg/…/redact.go | Defines the shared redaction model and the redaction report used by later delivery. |
| pkg/…/redact.go | Connects redaction to bundle files and nested archives. |
| pkg/…/result.go | Defines the bundle result model and tar.gz archive creation. |
| pkg/…/aftercollection.go | Defines archive upload, redaction-report delivery, and callback behavior. |
| cmd/…/redact.go | Shows the standalone workflow for producing a redacted replacement archive. |
| cmd/…/analyze.go | Shows the standalone workflow for loading analyzer definitions and formatting findings. |