Configuration samples and CRDs
Configuration samples and CustomResourceDefinitions (CRDs) provide the Kubernetes-facing contract for Troubleshoot workflows. The CRDs let a cluster recognize and validate workflow objects, while the samples show how to describe collection, analysis, redaction, and preflight checks for deployment, demonstration, and validation.
Configuration asset model
The assets use Kubernetes YAML to turn a Troubleshoot goal into a named resource. A resource identifies a workflow kind such as SupportBundle, Collector, Analyzer, Preflight, or Redactor, then places the workflow rules under spec.
The same broad model supports both a complete workflow and reusable parts of one:
| Asset | System purpose |
|---|---|
SupportBundle | Describes collection and analysis for a diagnostic bundle. |
Collector | Describes Kubernetes data to gather. |
Analyzer | Describes checks against collected or live cluster data. |
Preflight | Describes checks to run before an application is installed or used. |
HostCollector and RemoteCollector | Describe collection from host systems or remote targets. |
HostPreflight | Describes preflight checks that need host data. |
Redactor | Describes removal of sensitive values from collected data. |
These resources are inputs to the Troubleshoot tools. The YAML does not itself produce a diagnostic result; it defines the checks and data sources that a collector, analyzer, or preflight workflow later processes.
Declarative workflow shape
The configuration model connects data collection to checks and then to user-facing outcomes. A combined SupportBundle sample shows this relationship by declaring host and cluster collectors beside analyzers with pass, warn, and fail messages (examples/…/sample-supportbundle.yaml• L1-40).
The normal relationship between an asset and a workflow is:
flowchart LR
A[Configuration YAML] --> B[Registered Kubernetes resource]
B --> C[Validated workflow definition]
C --> D[Collection or preflight run]
D --> E[Analysis and outcomes]
E --> F[Bundle or readiness result]
Collectors supply evidence. Analyzers turn that evidence into outcomes. Preflights use the same outcome model to report whether a target environment meets requirements before the main application flow starts.
References: examples/…/sample-supportbundle.yaml• L1-40 examples/…/sample-analyzers.yaml• L1-22 examples/…/sample-preflight.yaml• L1-19
CustomResourceDefinitions
The CRDs register Troubleshoot resource kinds with the Kubernetes API and define the shape that submitted objects must follow. The troubleshoot.sh family uses namespaced resources and exposes v1beta2 definitions for the main workflow kinds (config/…/troubleshoot.sh_supportbundles.yaml• L2-18).
The CRD set covers the main workflow stages rather than one large universal object. This split lets a deployment use a complete support-bundle definition or provide focused collector, analyzer, preflight, host, remote, and redaction resources.
API groups and versions
The repository publishes two API groups in its CRD assets. The troubleshoot.sh group defines the current-looking v1beta2 workflow resources, while the troubleshoot.replicated.com group defines overlapping v1beta1 kinds and separate job kinds (config/…/troubleshoot.sh_collectors.yaml• L7-18, config/…/troubleshoot.replicated.com_collectors.yaml• L7-18). The group and version are part of the resource identity, so a YAML document must select the CRD family that its target cluster and workflow support.
The replicated group also includes CollectorJob, AnalyzerJob, and PreflightJob resources. These resources expose job-oriented API objects with status support where defined, which separates an execution record from the reusable workflow descriptions (config/…/troubleshoot.replicated.com_collectorjobs.yaml• L3-22, config/…/troubleshoot.replicated.com_analyzerjobs.yaml• L3-20).
References: config/…/troubleshoot.sh_collectors.yaml• L7-18 config/…/troubleshoot.replicated.com_collectors.yaml• L7-18 config/…/troubleshoot.replicated.com_collectorjobs.yaml• L9-22 config/…/troubleshoot.replicated.com_analyzerjobs.yaml• L9-20 config/…/troubleshoot.replicated.com_preflightjobs.yaml• L9-22
Schema contract
Each CRD gives Kubernetes the kind name, plural resource name, scope, served version, and OpenAPI schema. The schema makes the main configuration boundary visible: workflow rules live under spec, and collection or analysis entries are represented as typed lists of supported operations (config/…/troubleshoot.sh_collectors.yaml• L9-18, config/…/troubleshoot.sh_collectors.yaml• L39-73).
The schemas also describe the shared outcome language used by checks. An analyzer or preflight can express pass, warn, and fail results with a message, an optional condition, and an optional reference for more information (config/…/troubleshoot.sh_analyzers.yaml• L42-96). A redactor instead describes which files and values to remove, so its contract protects bundle content rather than producing readiness outcomes (config/…/troubleshoot.sh_redactors.yaml• L39-84).
References: config/…/troubleshoot.sh_collectors.yaml• L39-73 config/…/troubleshoot.sh_analyzers.yaml• L42-96 config/…/troubleshoot.sh_redactors.yaml• L39-84
Workflow boundaries
The CRD boundaries match where data comes from and how it is used. HostCollector and HostPreflight describe host-scoped work, while RemoteCollector describes checks against a remote target (config/…/troubleshoot.sh_hostcollectors.yaml• L7-20, config/…/troubleshoot.sh_hostpreflights.yaml• L7-20, config/…/troubleshoot.sh_remotecollectors.yaml• L7-20). This distinction helps an engineer choose a resource that can reach the system being checked.
References: config/…/troubleshoot.sh_hostcollectors.yaml• L7-20 config/…/troubleshoot.sh_hostpreflights.yaml• L7-20 config/…/troubleshoot.sh_remotecollectors.yaml• L7-20
Sample configuration
The sample files serve two related needs. Small samples provide a safe starting shape for a resource, while richer examples demonstrate how checks combine into a useful deployment or validation workflow.
Starter samples
The config/samples files are short Kubernetes resource examples for v1beta2. The collector sample shows a remote specification reference, built-in cluster data collection, pod command execution, and HTTP collection. The preflight sample shows environment checks for credentials, Kubernetes version, storage, ingress, and a required CRD (config/…/troubleshoot_v1beta2_collector.yaml• L1-9, config/…/troubleshoot_v1beta2_preflight.yaml• L1-5).
The analyzer starter is a scaffold rather than a complete diagnostic policy. Its value is the resource envelope and the place where analyzer rules are added (config/…/troubleshoot_v1beta2_analyzer.yaml• L1-9). The minimal examples under examples/troubleshoot and examples/support-bundle show the same focused shape with empty collector or analyzer lists (examples/…/sample-troubleshoot.yaml• L1-6, examples/…/sample-collectors.yaml• L1-6).
References: config/…/troubleshoot_v1beta2_collector.yaml• L1-9 config/…/troubleshoot_v1beta2_preflight.yaml• L1-5 config/…/troubleshoot_v1beta2_analyzer.yaml• L1-9 examples/…/sample-troubleshoot.yaml• L1-6 examples/…/sample-collectors.yaml• L1-6
Demonstration examples
The richer examples show how a product team can express a real target environment. The support-bundle example combines host collection, Kubernetes logs, a temporary pod run, version and resource checks, deployment status, and text analysis (examples/…/sample-supportbundle.yaml• L6-28, examples/…/sample-supportbundle.yaml• L28-124).
The preflight example focuses on installation gates. It checks cluster version, required CRDs, runtime, storage, distribution, node count, memory, CPU, and ephemeral storage. Its docString values also show how a check can carry human-readable requirement context with its result (examples/…/sample-preflight.yaml• L7-87, examples/…/sample-preflight.yaml• L90-232).
The Helm template SDK example keeps its Troubleshoot dependency linked to the local library and uses Helm and YAML support to demonstrate configuration use in a chart-oriented flow. Its Go module targets Go 1.26.10 and pins Helm v3.22.1 with YAML v1.6.0; its dependency lock records the checksums needed to reproduce that example (examples/sdk/helm-template/go.mod#L1-L14, examples/sdk/helm-template/go.sum#L161-L186).
References: examples/…/sample-supportbundle.yaml• L6-28 examples/…/sample-supportbundle.yaml• L28-124 examples/…/sample-preflight.yaml• L7-87 examples/…/sample-preflight.yaml• L90-232 examples/…/go.mod• L1-14 examples/…/go.sum• L161-186
Validation examples
Examples also act as working reference inputs for checking how configuration is accepted and interpreted. They cover both v1beta2 and v1beta3 documents, so the selected API version is part of the behavior being demonstrated rather than a cosmetic header (examples/…/sample-analyzers.yaml• L1-7, examples/…/sample-preflight.yaml• L1-6).
An engineer should use these files as patterns for intent, not as a promise that every external URL, image, namespace, or resource name exists in a target cluster. The sample collector includes a deliberately broken command and an empty HTTP URL among its examples, which makes it useful for exercising error handling as well as successful collection (config/…/troubleshoot_v1beta2_collector.yaml• L28-80).
References: examples/…/sample-analyzers.yaml• L1-7 examples/…/sample-preflight.yaml• L1-6 config/…/troubleshoot_v1beta2_collector.yaml• L28-80
Asset selection
The correct asset depends on the stage of the product flow and the system boundary that must be checked. Use a complete resource when the workflow needs to travel as one definition. Use focused resources when collection, analysis, redaction, or host checks need separate ownership or reuse.
| Need | Starting point |
|---|---|
| Define a full diagnostic bundle | SupportBundle sample and CRD |
| Gather cluster or pod evidence | Collector sample and CRD |
| Check collected evidence or cluster state | Analyzer sample and CRD |
| Gate installation on environment requirements | Preflight sample and CRD |
| Inspect host or remote systems | Host or remote resource family |
| Remove sensitive bundle data | Redactor resource family |
| Track a job-style execution object | The corresponding *Job CRD in the replicated API group |
The parent page, API specification and configuration, explains the wider configuration contract. For field and type details, use Troubleshoot API types and schemas.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the
apiVersion,kind, group, plural name, and version served by the matching CRD aligned across every sample. - When a shared collector or analyzer shape changes, check all composite
SupportBundleandPreflightexamples that embed that shape. - When an outcome field changes, check both
v1beta2andv1beta3examples because their result messages and conditions are part of user-visible behavior. - When a host or remote boundary changes, update the matching resource family and any example that relies on that execution context.
- When a CRD schema changes, regenerate or update the checked-in CRD asset before treating a sample as valid.
- When a sample uses a URI, image, namespace, or named cluster resource, confirm that the example still demonstrates the intended behavior without implying that the external dependency is always available.
- When the SDK example dependencies change, keep its local Troubleshoot module link, Go version, direct dependency versions, and dependency checksums aligned so the example stays matched to the current configuration contract.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A sample uses the wrong API group or version for the installed CRD | Kubernetes rejects the object or the workflow loader cannot use it | Match apiVersion to the target CRD family and served version. |
| A required CRD is absent from the cluster | The resource cannot be created or a preflight check reports the capability as missing | Install the matching CRD set before applying the workflow. |
| A collector points to an unavailable URI or target resource | Collection returns incomplete or failed evidence | Treat external URLs, images, namespaces, and named objects as environment-specific inputs. |
| A sample contains an empty or invalid collector action | The sample may validate as YAML but produce no useful evidence or an error during collection | Use the richer examples to confirm the action can run in the target environment. |
| A schema changes without a matching sample update | Users copy configuration that the cluster accepts differently or rejects | Review embedded collector, analyzer, and outcome shapes across composite examples. |
| Results are configured for an unintended upload endpoint | Diagnostic data may leave the cluster or reach the wrong recipient | Review uploadResultsTo and callback values before using a sample outside a test environment. |
Key files
| File | Why to read it |
|---|---|
| config/…/troubleshoot.sh_supportbundles.yaml | Defines the main SupportBundle resource and its broad collection and analysis contract. |
| config/…/troubleshoot.sh_collectors.yaml | Shows the Kubernetes collection resource boundary and supported collector shape. |
| config/…/troubleshoot.sh_analyzers.yaml | Shows the analyzer resource and its shared pass, warn, and fail outcome model. |
| config/…/troubleshoot.sh_preflights.yaml | Shows how preflight checks use the same analyzer-style contract. |
| config/…/troubleshoot.sh_hostcollectors.yaml and config/…/troubleshoot.sh_remotecollectors.yaml | Define collection boundaries outside the normal in-cluster collector flow. |
| config/…/troubleshoot.sh_redactors.yaml | Defines the resource used to describe removal of sensitive bundle content. |
config/crds/troubleshoot.replicated.com_* | Shows the second API group and its resource and job-oriented variants. |
| config/…/troubleshoot_v1beta2_preflight.yaml | Provides a compact preflight pattern with common environment checks. |
| config/…/troubleshoot_v1beta2_collector.yaml | Demonstrates cluster, pod, command, and HTTP collection inputs. |
| examples/…/sample-supportbundle.yaml | Provides the broadest example of a combined diagnostic workflow. |
| examples/…/sample-preflight.yaml | Provides a broad installation-readiness workflow with human-readable requirement text. |
examples/sdk/helm-template/go.mod and examples/sdk/helm-template/go.sum | Show the dependency contract that keeps the Helm-oriented SDK example aligned with the local Troubleshoot library. |