Can I run Replicated Preflight Checks before KOTS or KURL is installed?

Answer: Yes

The preflight binary can be downloaded and installed ahead of an Embedded or Existing Cluster KOTS install in the event that you want an end-user to determine that the environment is ready prior to the initial installation.

For Embedded Clusters please see - kURL: How to do a standalone run of Host Preflights

For Existing Cluster installs, the instructions would be as follows:

  1. Download and install the Preflight binary
curl -L https://github.com/replicatedhq/troubleshoot/releases/latest/download/preflight_linux_amd64.tar.gz | tar xzvf -
  1. Run the Preflight binary using a spec that you provide by the user. The below command includes an example from our troubleshoot Github repository
./preflight https://raw.githubusercontent.com/replicatedhq/troubleshoot/main/examples/preflight/sample-preflight.yaml

A good example of where you’d might want to do this is to ensure that your customer has provisioned a resource like a PersistentVolumeClaim ahead of time, so we can make sure that it meets our minimum size requirement and has an access mode of ReadWriteMany

apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
  name: preflight-sample-pvc
spec:
  collectors:
    - cluster-resources: {}
  analyzers:
    - clusterResource:
        checkName: pvc-size
        kind: pvc
        namespace: default
        name: some-pvc
        yamlPath: "spec.resources.requests.storage"
        outcomes:
          - pass:
              when: ">= 500Gi"
              message: you have enough storage
          - fail:
              message: there is not enough storage
    - clusterResource:
        checkName: check-access-mode
        kind: pvc
        namespace: default
        name: some-pvc
        yamlPath: "spec.accessModes"
        regex: ReadWriteMany
        outcomes:
          - fail:
              when: "false"
              message: is not ReadWriteMany
          - pass:
              when: "true"
              message: is ReadWriteMany

For more info on the clusterResource analyzer see - Cluster Resource - Troubleshoot Docs - Troubleshoot Docs

Note: Because this is being run outside the context of KOTS you can’t use Replicated template functions in the Preflight spec you distribute for this purpose