Introducing a new way to review your PRs.

Read the announcement

replicatedhq / troubleshoot

Preflight Checks and Support Bundles Framework for Kubernetes Applications

View on GitHub

19 documents · Updated Nov 20, 2026

docs / support-bundle-collection

Support bundle collection

Support bundle collection turns a support-bundle specification into evidence about a Kubernetes cluster and its hosts. It loads a local, remote, OCI, or Kubernetes Secret source, selects collectors for the requested environment, and joins their files into one bundle for later analysis, redaction, and upload. See Support bundle workflows for the full life cycle.

Collection inputs

The collection input is a versioned YAML or JSON resource. A SupportBundle groups cluster collectors, host collectors, analyzers, and after-collection actions; a Collector resource can be used as a shorter collection-only form and is converted to the same support-bundle shape (pkg/…/load.go• L43-105, pkg/…/supportbundle_types.go• L23-33).

The loader accepts these source forms:

SourceRole
Local fileReads a specification from disk.
HTTP or HTTPS URLDownloads a specification from a remote service.
oci:// referencePulls a specification from an OCI source.
secret/namespace/nameReads a specification from a Kubernetes Secret.

The uri field can point to an upstream support-bundle specification. When the loader can read and parse that upstream source, it uses it in place of the local specification. If the upstream source fails, the local specification remains available (pkg/…/load.go• L80-102). Each loaded document is converted to the current internal version before it is decoded, which lets older specification forms enter the same collection flow (pkg/…/load.go• L43-55, pkg/…/load.go• L17-71).

References: pkg/…/load.go• L26-105 pkg/…/load.go• L151-168 pkg/…/load.go• L17-71 pkg/…/supportbundle_types.go• L23-33

Collection lifecycle

The support-bundle collector creates a temporary work area, runs host and Kubernetes collectors, joins their results, and then passes the files to analysis and archive stages. Collection errors are retained long enough to produce the bundle when possible, so one failed collector does not hide evidence from the other collectors (pkg/…/supportbundle.go• L94-176).

The main collection flow is:

flowchart LR
    A[Load specification] --> B[Create work area]
    B --> C[Run host collectors]
    B --> D[Run Kubernetes collectors]
    C --> E[Join collected files]
    D --> E
    E --> F[Write collector metadata and errors]
    F --> G[Redaction stage]
    G --> H[Analysis and archive stages]

Collector progress reports the current collector and its state. An excluded collector is not run. A collector that fails records an error file and allows the remaining collection and downstream bundle work to continue where the caller permits it (pkg/…/collect.go• L158-233, pkg/…/collect.go• L291-346).

References: pkg/…/supportbundle.go• L76-176 pkg/…/supportbundle.go• L178-244 pkg/…/collect.go• L47-85 pkg/…/collect.go• L88-263

Kubernetes collectors

Kubernetes collectors gather data through the Kubernetes API or through temporary workload resources. Each specification entry names one built-in collector category. The category is mapped to a collector runner that returns files under a relative path in the bundle (pkg/…/collector.go• L21-28, pkg/…/collector.go• L58-142).

Cluster evidence

Cluster evidence describes the state of the cluster and its workloads. It includes cluster information, cluster resources, custom metrics, node metrics, logs, Secrets, ConfigMaps, and support-bundle metadata (pkg/…/collector_shared.go• L20-88, pkg/…/collector_shared.go• L321-324).

These collectors use selectors, names, namespaces, or limits to narrow the evidence. Their results are files that downstream analysis can read without needing a live cluster (pkg/…/collector.go• L64-86).

References: pkg/…/collector_shared.go• L20-88 pkg/…/collector_shared.go• L321-324 pkg/…/collector.go• L64-86

Workload evidence

Workload evidence runs a command in a selected pod, starts a temporary pod, starts a temporary DaemonSet, executes in an existing pod, or copies a path from a container. These forms let a specification collect application output from the same network and runtime context as the workload (pkg/…/collector_shared.go• L96-166, pkg/…/collector.go• L77-99).

The copy category runs after other Kubernetes collectors. This order lets it copy files created by command or pod runners. It keeps files received before a later copy error, rejects archive paths that would leave the bundle destination, and records symlink targets as text files instead of recreating links (pkg/…/collector.go• L336-350, pkg/…/copy.go• L43-96, pkg/…/copy.go• L160-255). Temporary pods, DaemonSets, and generated pull secrets are removed after their work is complete (pkg/…/run_pod.go• L47-76, pkg/…/run_daemonset.go• L47-91).

References: pkg/…/collector_shared.go• L96-166 pkg/…/collector.go• L77-99 pkg/…/collector.go• L336-350 pkg/…/copy.go• L43-96 pkg/…/copy.go• L160-255 pkg/…/run_pod.go• L47-76 pkg/…/run_daemonset.go• L47-91

Service and platform evidence

Service and platform collectors query external endpoints, databases, image registries, or cluster add-ons. The built-in categories cover HTTP, PostgreSQL, MSSQL, MySQL, Redis, ClickHouse, Collectd, Ceph, Longhorn, registry images, Sysctl, Certificates, Helm, Goldpinger, Sonobuoy, DNS, Etcd, and S3 status (pkg/…/collector_shared.go• L178-369, pkg/…/collector.go• L100-139).

These collectors keep their output in the same result model as cluster and workload evidence. Registry image checks can use inline credentials or a Kubernetes pull Secret. Database and endpoint collectors can use TLS settings from the specification (pkg/…/collector_shared.go• L178-234, pkg/…/collector_shared.go• L263-369, pkg/…/registry.go• L60-91).

References: pkg/…/collector_shared.go• L178-234 pkg/…/collector_shared.go• L263-369 pkg/…/collector.go• L100-139 pkg/…/registry.go• L60-91

Host collectors

Host collectors gather data from the operating system rather than from Kubernetes objects. The support-bundle specification can run them in the process that creates the bundle or inside Kubernetes pods with access to each node's host file system (pkg/…/supportbundle_types.go• L23-33, pkg/…/collect.go• L47-59).

Local host collection

Local host collection maps each HostCollect entry to a built-in host runner. The categories cover CPU, memory, network checks, disk use, port checks, host HTTP, time, block devices, system packages, kernel data, certificates, services, operating-system data, journald, cgroups, DNS, Sysctl, file-system performance, image registry checks, file copies, and host commands (pkg/…/hostcollector_shared.go• L13-246, pkg/…/host_collector.go• L23-112).

The time collector records the host time zone, NTP state, and, when available, a comparison with a trusted hypervisor clock. On Linux it recognizes supported hypervisor clock sources and accepts the comparison only when the sample is quick and stable; other operating systems keep the normal time evidence without a hypervisor sample (pkg/…/host_time.go• L16-77, pkg/…/host_time.go• L95-164, pkg/…/host_time_linux.go• L16-66, pkg/…/host_time_others.go• L1-7).

The host runner writes host evidence below host-collectors. A host command also records its standard output, standard error, exit state, and any files that it places in its output directory. Its working directory is temporary, so command output does not alter the caller's directory (pkg/…/host_run.go• L41-180).

References: pkg/…/hostcollector_shared.go• L13-246 pkg/…/host_collector.go• L23-112 pkg/…/host_time.go• L16-164 pkg/…/host_time_linux.go• L16-66 pkg/…/host_time_others.go• L1-7 pkg/…/host_run.go• L41-180

Node host collection

Node host collection creates a privileged DaemonSet with host network, process, and IPC access. It schedules one collector pod per selected node, sends each host specification to the pod, reads the result, and places the data below the node name in host-collectors (pkg/…/collect.go• L392-546).

The node path is useful when the bundle creator cannot inspect the host directly. It also makes the node that produced each file explicit. A host-path copy uses the same node-oriented result model: a temporary DaemonSet mounts the requested path on each node, and the copied files are stored below that node's name. The temporary DaemonSet is removed after collection, while the node list remains in the bundle (pkg/…/collect.go• L403-438, pkg/…/collect.go• L513-546, pkg/…/copy_from_host.go• L50-124, pkg/…/copy_from_host.go• L259-289).

References: pkg/…/collect.go• L392-546 pkg/…/collect.go• L564-636 pkg/…/copy_from_host.go• L50-124 pkg/…/copy_from_host.go• L259-289

Remote host collection

Remote host collection runs one host collector on each node selected by a label selector. For each node, it creates a temporary pod with host access, copies the collector specification into that pod, waits for completion, and reads the command output as collector data (pkg/…/host_collector.go• L122-184, pkg/…/runner.go• L39-64).

The remote runner places results under a path that includes the node name. It combines files with the same logical result path across nodes instead of losing one node's data (pkg/…/host_collector.go• L156-184, pkg/…/host_collector.go• L218-247). The separate RemoteCollector resource exposes the same model for a collection command that targets selected nodes (pkg/…/remote_collector_types.go• L23-41, pkg/…/remote_collector.go• L58-150).

References: pkg/…/host_collector.go• L122-184 pkg/…/host_collector.go• L187-247 pkg/…/runner.go• L39-64 pkg/…/remote_collector_types.go• L23-41 pkg/…/remote_collector.go• L58-150

Collector runners

A collector runner is the execution form that connects one specification category to its environment. Kubernetes runners use the API client and workload resources. Host runners use the local operating system or a host-enabled pod. Every runner exposes a title, an exclusion check, and a collection result (pkg/…/collector.go• L21-28, pkg/…/host_collector.go• L23-27).

Kubernetes API runners

API runners read cluster objects and write their evidence directly into the bundle result. They are used for cluster state, workload logs, resource data, metadata, and checks that need Kubernetes access (pkg/…/collector.go• L64-86).

Kubernetes workload runners

Workload runners use short-lived Kubernetes resources or pod connections when collection must happen near an application or node. run, runPod, and runDaemonSet start commands in controlled workloads. exec runs in an existing pod. copy transfers files from a selected container and applies the same partial-result and safe-path rules as the collection result (pkg/…/run.go• L30-76, pkg/…/run_pod.go• L47-112, pkg/…/run_daemonset.go• L47-130, pkg/…/exec.go• L38-110, pkg/…/copy.go• L41-90, pkg/…/copy.go• L160-255).

The runner checks access before it starts a collector when the collector needs Kubernetes permissions. The collection can stop on missing permissions or continue in the configured reduced-permission mode. Collectors that still have permission errors are recorded as skipped, except for cluster resource collection which can still provide partial evidence (pkg/…/collect.go• L112-153, pkg/…/collect.go• L180-201).

References: pkg/…/run.go• L30-76 pkg/…/run_pod.go• L47-112 pkg/…/run_daemonset.go• L47-130 pkg/…/exec.go• L38-110 pkg/…/copy.go• L41-90 pkg/…/copy.go• L160-255 pkg/…/collect.go• L112-153 pkg/…/collect.go• L180-201

Host process runners

Host process runners call operating-system functions or commands on the host that starts collection. They return files and structured status without requiring a Kubernetes workload. This path supports direct host evidence and keeps command artifacts inside the bundle's host area (pkg/…/host_collector.go• L43-112, pkg/…/host_run.go• L41-180).

References: pkg/…/host_collector.go• L43-112 pkg/…/host_run.go• L41-180

Node pod runners

Node pod runners use a Kubernetes pod as a controlled bridge to the host. The pod mounts the node root and runs the collector with host privileges. The runner waits for the pod to finish, reads its logs, and removes the temporary pod and configuration (pkg/…/runner.go• L39-64, pkg/…/runner.go• L66-145).

References: pkg/…/runner.go• L39-64 pkg/…/runner.go• L66-145

Collected results

Collected results are a map from a bundle-relative file path to file bytes or to a file written in the temporary work area. This common result model lets collectors use different data sources while downstream stages treat the output as one set of files (pkg/…/result.go• L19-23, pkg/…/result.go• L94-138).

Result paths

Result paths preserve the source context needed for diagnosis. Kubernetes data uses collector and workload paths. Host data uses host-collectors and can add a node name. A result can also include error or status files when collection was incomplete (pkg/…/collect.go• L209-233, pkg/…/collect.go• L324-343, pkg/…/host_collector.go• L166-182).

Result merging

The bundle joins Kubernetes and host maps after both collection paths finish. Duplicate structured results from different nodes are combined by file key so one collector run does not overwrite another node's evidence. The final result map is also the source for the archive (pkg/…/supportbundle.go• L162-169, pkg/…/host_collector.go• L218-247, pkg/…/result.go• L86-92).

Skip and error records

Excluded collectors and collectors blocked by permissions are listed in skipped-collectors.json. A collector that starts but fails gets an error record under collector-errors or host-collectors/errors. These records tell analysis users whether missing evidence was not requested, not allowed, or unable to run (pkg/…/collector.go• L307-333, pkg/…/collect.go• L171-199, pkg/…/collect.go• L205-233, pkg/…/host_collector.go• L166-182).

Copy results keep files that were fully saved before a stream or extraction error. They do not write archive entries outside the bundle destination. Symlink entries become text notes that show their targets, which preserves useful context without creating links during collection (pkg/…/copy.go• L167-186, pkg/…/copy.go• L189-255, pkg/…/copy_test.go• L68-256).

References: pkg/…/result.go• L19-23 pkg/…/result.go• L86-138 pkg/…/supportbundle.go• L162-169 pkg/…/collect.go• L171-233 pkg/…/collect.go• L320-343 pkg/…/copy.go• L167-255 pkg/…/copy_test.go• L68-256

Collection is the source stage for the other support-bundle systems. Redaction protects the files before they leave the customer environment. Analysis reads the collected files and produces findings. Artifact and upload handling archives and sends the result.

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep every specification category mapped to one supported Kubernetes or host runner. An added schema field without a runner becomes silent missing evidence.
  • Keep run, runPod, runDaemonSet, exec, and copy ordering aligned. Copy depends on files created by the other workload runners.
  • Keep local host paths and node host paths aligned with the consumers that read them. A path change can make host analysis miss valid files.
  • Keep the host time result contract stable. Changes to time-zone, NTP, or hypervisor-clock fields can change how downstream analysis judges host clock health.
  • Keep platform-specific host time behavior aligned. Linux hypervisor-clock support must remain optional so unsupported systems can still collect the base time evidence.
  • Keep the remote host result merge aligned with node naming. A collision can replace one node's evidence with another node's data.
  • Keep permission checks aligned with collector access needs. A new API call can turn a collector into a skipped result without a matching access review.
  • Keep skipped and error record paths aligned with analysis and bundle viewers. These records are the only clear explanation for missing evidence.
  • Keep archive path checks and symlink-note behavior aligned with result consumers. A change can reintroduce unsafe paths or remove context from copied links.
  • Keep host-path copy output and temporary DaemonSet cleanup aligned with node-level result consumers. A change can mix node data or leave collection workloads behind.
  • Keep legacy resource conversion aligned with SupportBundle fields. A new collector field must survive Collector conversion and version conversion.

Important failure modes

TriggerConsequenceGuard
The specification source cannot be read or parsed.No collector plan is created, so collection cannot start.Use a valid local path, URL, OCI reference, or Secret path and a supported resource kind.
An upstream uri cannot be loaded.The run uses the local specification instead of the intended upstream rules.Treat the local specification as the fallback and verify remote source reachability when the upstream source is required.
A collector category has no registered runner.The requested evidence is omitted or the collection reports an unknown collector.Add the category to the schema and runner mapping together.
Kubernetes permissions are missing and reduced-permission mode is off.Collection stops before the affected Kubernetes collectors run.Grant the required access or explicitly allow collection without all permissions.
A host collector needs node access but runs in the local process.Host evidence can describe the bundle creator rather than cluster nodes.Enable host collection in pods when node-level evidence is required.
A temporary pod or DaemonSet cannot schedule or complete before its timeout.The collector produces an error and its expected evidence is absent.Check node availability, image access, workload permissions, and the collector timeout.
A Linux host has no readable supported hypervisor clock.The time result has no hypervisor comparison, but its time-zone and NTP fields can still be collected.Treat the hypervisor comparison as optional and use the recorded error to explain its absence.
A hypervisor clock sample is slow or the system clock changes during the sample.The sample is rejected and clock synchronization cannot use that comparison.Keep the sample within the short read window and reject unstable measurements.
Two node results use the same output key without node separation.One node's data can overwrite another node's data.Preserve node-qualified result paths and use the remote merge behavior.
A copy collector runs before its source workload collector.The copied path is missing or stale.Keep copy collectors at the end of the execution list.
A copied archive contains a path outside the bundle destination.The copy fails instead of saving that archive entry.Keep archive path validation enabled and treat the copy as failed when validation rejects an entry.
A host path is absent or cannot be mounted on a node.That node has an error record instead of the requested host files.Use a path present on the target nodes and allow the temporary host-copy workload to mount it.

Key files

FileWhy to read it
pkg/…/load.goShows how support-bundle specifications enter the system and how Collector resources become SupportBundle resources.
pkg/…/supportbundle.goShows the top-level collection sequence and how host and Kubernetes results join the bundle.
pkg/…/collect.goShows collector preparation, permission checks, execution order, host modes, and error records.
pkg/…/supportbundle_types.goDefines the support-bundle fields that connect collection to later stages.
pkg/…/collector_shared.goDefines the built-in Kubernetes collector categories and their common specification fields.
pkg/…/hostcollector_shared.goDefines the built-in host collector categories.
pkg/…/collector.goMaps Kubernetes specification categories to runners and defines skip-record behavior.
pkg/…/host_collector.goMaps host categories to local runners and supports collection on selected nodes.
pkg/…/host_time.goDefines the host time result and the optional hypervisor-clock comparison.
pkg/…/host_time_linux.goShows how Linux reads supported hypervisor clock sources.
pkg/…/host_time_others.goShows the no-hypervisor-clock behavior on non-Linux systems.
pkg/…/copy.goShows how container files enter the bundle and how archive paths, symlinks, and partial results are handled.
pkg/…/copy_from_host.goShows how host paths are copied through temporary node workloads and stored by node.
pkg/…/runner.goShows the pod runner used to execute host collection against a node.
pkg/…/run_pod.goShows the short-lived pod runner for application-context commands.
pkg/…/run_daemonset.goShows the node-wide workload runner and its result collection.
pkg/…/result.goDefines the shared result model and archive input.
pkg/…/remote_collector.goShows the separate remote collector resource and per-node execution model.