/
1
Collect
2
Redact
3
Analyze

Analyzing Data

Introduction to the analyze phase


Analyzers are YAML specifications that define a set of criteria and operations to run against data collected in a preflight check or support bundle. Each analyzer included will result in either 0 or 1 outcomes. If an analyzer produces zero outcomes, it will not be displayed in the results.

Analyzers are specified inside either a Preflight or a SupportBundle YAML file. To build a set of analyzers, start with a Kubernetes YAML file:

apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
  name: my-application-name
spec:
  analyzers: []

or

apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
  name: my-application-name
spec:
  analyzers: []

The above files contain all of the necessary scaffolding and structure needed to write analyzers, but don't contain any analyzers. Given this analyzer definition, there will be nothing on the analysis page.

The troubleshoot project defines a number of built-in and easy-to-use analyzers, and many helper functions to build custom analyzers.

To add additional analyzers to a manifest, read the docs in this section to understand each one, and add them as an array item below spec.

For example, a complete Preflight check might be:

apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
  name: my-application-name
spec:
  analyzers:
    - imagePullSecret:
          checkName: Has Access to Quay.io
          registryName: quay.io
          outcomes:
            - fail:
                message: Cannot pull from quay.io
            - pass:
                message: Found credentials to pull from quay.io
    - clusterVersion:
        outcomes:
          - fail:
              when: "< 1.13.0"
              message: Sorry, my-application-name requires at least Kubernetes 1.14.0. Please update your Kubernetes cluster before installing.
              uri: https://enterprise.my-application.com/install/requirements/kubernetes
          - warn:
              when: "< 1.15.0"
              message: The version of Kubernetes you are running meets the minimum requirements to run my-application-name. It's recommended to run Kubernetes 1.15.0 or later.
              uri: https://enterprise.my-application.com/install/requirements/kubernetes
          - pass:
              message: The version of Kubernetes you have installed meets the required and recommended versions.
    - storageClass:
        checkName: Required storage classes
        storageClassName: "microk8s-hostpath"
        outcomes:
          - fail:
              message: The required storage class was not found in the cluster.
          - pass:
              message: The required storage class was found in the cluster.
    - customResourceDefinition:
        customResourceDefinitionName: cephclusters.ceph.rook.io
        outcomes:
          - fail:
              message: Rook is required for my-application. Rook was not found in the cluster.
          - pass:
              message: Found a supported version of Rook installed and running in the cluster.

Shared Properties

The following properties are supported on all analyzers:

checkName

Optionally, an analyzer can specify the checkName property.

exclude

For analyzers that are optional, based on runtime available configuration, the conditional can be specified in the exclude property. This is useful for deployment techniques that allow templating for optional components (Helm and KOTS). When this value is true, the analyzer will not be called.

strict

Optionally, an analyzer can be set to strict. When strict: true is set for an analyzer, tools using Troubleshoot know that that particular analyzer must not fail.

When exclude: true is specified, exclude will override strict and the analyzer will not be executed.

Edit on GitHub