
Application preflight checks enable you to catch a customer environment that can't properly run your application before any app install attempt is started. Whether the problem is not enough memory, an unsupported Kubernetes version, a database the application can't reach, and more. Each problem an app preflight helps to catch is a product installation failure averted, and a support case that doesn't get opened and escalated.
troubleshoot.sh/v1beta3 is the application preflight format that every Replicated installation method now runs, including Embedded Cluster v3. Moving to v1beta3 is a small change you make once. After that, your checks keep working as your customers update, change installation methods, or move to Embedded Cluster v3.
This post is about application preflight checks only, the Preflight spec that is packaged within your release. You don't need to change your Embedded Cluster host preflight checks (HostPreflight) as part of this move.
One v1beta3 spec covers every installation method:
You test and maintain one set of checks. When you add a requirement or fix a check, it reaches every customer in the same release, whichever way they install.
Embedded Cluster v3 runs only v1beta3 application preflight checks. If you move your checks now, every customer you bring to Embedded Cluster v3 gets the same checks on their first installation, and you don't have a conversion to fit into that upgrade. A v1beta2 spec doesn't run on Embedded Cluster v3, and nothing tells the customer it was skipped, so it's worth switching before your first Embedded Cluster v3 customer rather than after.
For a typical spec, moving application preflight checks to v1beta3 is a short edit to one file in your Helm chart, shipped in your next release. If you support Embedded Cluster v2, ship it in a release that uses Embedded Cluster v2 2.19.16 or later. Customers who update from an earlier Embedded Cluster v2 version don't need to do anything first, because the update runs the new release's application preflight checks with the version of KOTS that ships in that release.
A v1beta3 application preflight spec is a Helm template, packaged in a labeled Secret in your chart, and it renders with the same values your chart installs with. When you convert a v1beta2 spec, anything that used repl{{ }} Replicated template functions moves to chart values. A check that used ConfigOption reads the matching chart value instead, and a license check reads the license values the Replicated SDK adds to your chart, such as {{ .Values.global.replicated.licenseFields.node_count.value }}, in place of LicenseFieldValue.
While you're converting, you can also give each analyzer a docString, a short description of the requirement and why it exists. The Troubleshoot preflight docs command turns those into a requirements list you can share with customers. It reads a Preflight spec file rather than the Secret in your chart, so render your chart with helm template first and save the spec from the Secret's preflight.yaml key to a file.
Here's a chart-packaged v1beta3 application preflight spec with a Kubernetes version check driven by chart values and a GPU check that only renders when GPU support is enabled. For more about gating checks on chart values, see Conditional checks with chart values.
# templates/preflight.yaml
apiVersion: v1
kind: Secret
metadata:
name: "{{ .Release.Name }}-preflight-config"
labels:
troubleshoot.sh/kind: preflight
stringData:
preflight.yaml: |
apiVersion: troubleshoot.sh/v1beta3
kind: Preflight
metadata:
name: my-app-preflights
spec:
analyzers:
- docString: |
Title: Kubernetes version
Requirement:
- Minimum: {{ .Values.preflight.kubernetes.minVersion }}
Older versions are missing APIs that the application uses.
clusterVersion:
checkName: Kubernetes version
outcomes:
- fail:
when: "< {{ .Values.preflight.kubernetes.minVersion }}"
message: Kubernetes {{ .Values.preflight.kubernetes.minVersion }} or later is required.
- pass:
message: Kubernetes version is supported.
{{- if .Values.gpu.enabled }}
- docString: |
Title: GPU node
Requirement:
- At least one node with an allocatable NVIDIA GPU
Required only when GPU support is enabled.
nodeResources:
checkName: GPU node available
filters:
resourceName: nvidia.com/gpu
resourceAllocatable: "1"
outcomes:
- fail:
when: "count() < 1"
message: At least one node with an NVIDIA GPU is required when GPU support is enabled.
- pass:
message: GPU node available.
{{- end }}
apiVersion to troubleshoot.sh/v1beta3. Leave any HostPreflight spec on v1beta2. Keep the Secret, its troubleshoot.sh/kind: preflight label, and the preflight.yaml key.v1beta2 Preflight spec from the release. KOTS v1.129.4 and later and the Helm CLI run both, so customers would see every application preflight check twice.minKotsVersion to 1.134.0 in your Application custom resource.Customers who run KOTS in their own existing cluster upgrade KOTS separately from your application, so some may be on an earlier version. To make sure they're on a version that runs v1beta3, set minKotsVersion to 1.134.0 in your Application custom resource. Customers on an earlier version are asked to upgrade KOTS before they can install or update. You can set this in releases that also support Embedded Cluster. Each version of Embedded Cluster v2 includes a specific version of KOTS, and an Embedded Cluster v2 installation fails only if minKotsVersion is higher than that version. Embedded Cluster v2 2.19.16 and later include KOTS 1.134.0 or later, so 1.134.0 is safe with them. Embedded Cluster v3 doesn't use KOTS and ignores the minKotsVersion setting.
In Embedded Cluster v3, application preflight connectivity collectors such as postgres, mysql, redis, and http run on the host rather than inside the cluster. To check that a database is reachable from inside the cluster, wrap the collector in a runPod collector, as shown in Run connectivity checks inside the cluster. If the check needs a credential, pass it to the Pod from a Secret instead of templating it into the spec, so it doesn't end up in a support bundle. See Use a credential in a preflight check.
For Embedded Cluster v3 air gap installations, add any images your application preflight spec uses, such as the Troubleshoot image in a runPod collector, to additionalImages in your Application custom resource. See Include preflight images in air gap bundles.
The change applies only to application preflight checks, the Preflight custom resource. You don't need to change your host preflight (HostPreflight), support bundle (SupportBundle), or redactor (Redactor) specs.
Some customers who run KOTS in their own cluster can't upgrade KOTS on your schedule, so you might not be able to set minKotsVersion to 1.134.0 yet. You can still move to Embedded Cluster v3 now by shipping both specs for a while and letting each installation use one of them.
v1beta2 spec and add the v1beta3 spec, each in its own labeled Secret. Wrap each Secret in a chart value, for example {{- if eq (toString .Values.preflightSpecs.v1beta3) "true" }}. In your chart's values.yaml, set preflightSpecs.v1beta3 to true and preflightSpecs.v1beta2 to false, so Helm CLI installations run v1beta3.values:
preflightSpecs:
v1beta2: 'repl{{ and (ne KotsVersion "") (KotsVersion | semverCompare "< 1.134.0") }}'
v1beta3: 'repl{{ or (eq KotsVersion "") (KotsVersion | semverCompare ">= 1.134.0") }}'
KOTS earlier than 1.134.0 runs the v1beta2 spec. KOTS 1.134.0 and later, Embedded Cluster v2 2.19.16 and later, Embedded Cluster v3, and the Helm CLI run the v1beta3 spec. Each customer sees each check once. Embedded Cluster v3 doesn't use KOTS, so KotsVersion is empty there, which is why the values check for an empty version first.
You maintain two specs while this is in place. When all your customers run KOTS 1.134.0 or later, remove the v1beta2 spec and the version check, and set minKotsVersion instead.
For more information, see Define preflight checks, including Move an existing release to v1beta3, and the Troubleshoot v1beta3 overview and migration guide.