|
| 1 | +import HttpSecret from "../partials/preflights/_http-requests-secret.mdx" |
| 2 | +import HttpCr from "../partials/preflights/_http-requests-cr.mdx" |
| 3 | +import MySqlSecret from "../partials/preflights/_mysql-secret.mdx" |
| 4 | +import MySqlCr from "../partials/preflights/_mysql-cr.mdx" |
| 5 | +import K8sVersionSecret from "../partials/preflights/_k8s-version-secret.mdx" |
| 6 | +import K8sVersionCr from "../partials/preflights/_k8s-version-cr.mdx" |
| 7 | +import K8sDistroSecret from "../partials/preflights/_k8s-distro-secret.mdx" |
| 8 | +import K8sDistroCr from "../partials/preflights/_k8s-distro-cr.mdx" |
| 9 | +import NodeReqSecret from "../partials/preflights/_node-req-secret.mdx" |
| 10 | +import NodeReqCr from "../partials/preflights/_node-req-cr.mdx" |
| 11 | +import NodeCountSecret from "../partials/preflights/_node-count-secret.mdx" |
| 12 | +import NodeCountCr from "../partials/preflights/_node-count-cr.mdx" |
| 13 | +import NodeMemSecret from "../partials/preflights/_node-mem-secret.mdx" |
| 14 | +import NodeMemCr from "../partials/preflights/_node-mem-cr.mdx" |
| 15 | +import NodeStorageClassSecret from "../partials/preflights/_node-storage-secret.mdx" |
| 16 | +import NodeStorageClassCr from "../partials/preflights/_node-storage-cr.mdx" |
| 17 | +import NodeEphemStorageSecret from "../partials/preflights/_node-ephem-storage-secret.mdx" |
| 18 | +import NodeEphemStorageCr from "../partials/preflights/_node-ephem-storage-cr.mdx" |
| 19 | +import NodeCpuSecret from "../partials/preflights/_node-cpu-secret.mdx" |
| 20 | +import NodeCpuCr from "../partials/preflights/_node-cpu-cr.mdx" |
| 21 | +import Tabs from '@theme/Tabs'; |
| 22 | +import TabItem from '@theme/TabItem'; |
| 23 | + |
| 24 | +# Example Preflight Specs |
| 25 | + |
| 26 | +This section includes common examples of preflight check specifications. For more examples, see the [Troubleshoot example repository](https://github.com/replicatedhq/troubleshoot/tree/main/examples/preflight) in GitHub. |
| 27 | + |
| 28 | +## Check HTTP or HTTPS Requests from the Cluster |
| 29 | + |
| 30 | +The examples below use the `http` collector and the `textAnalyze` analyzer to check that an HTTP request to the Slack API at `https://api.slack.com/methods/api.test` made from the cluster returns a successful response of `"status": 200,`. |
| 31 | + |
| 32 | +For more information, see [HTTP](https://troubleshoot.sh/docs/collect/http/) and [Regular Expression](https://troubleshoot.sh/docs/analyze/regex/) in the Troubleshoot documentation. |
| 33 | + |
| 34 | +<Tabs> |
| 35 | + <TabItem value="secret" label="Kubernetes Secret" default> |
| 36 | + <HttpSecret/> |
| 37 | + </TabItem> |
| 38 | + <TabItem value="custom-resource" label="Preflight Custom Resource"> |
| 39 | + <HttpCr/> |
| 40 | + <p>The following shows how the <code>pass</code> outcome for this preflight check is displayed in the Admin Console during KOTS installation or upgrade:</p> |
| 41 | + <img alt="Preflight checks in Admin Console showing pass message" src="/images/preflight-http-pass.png"/> |
| 42 | + <a href="/images/preflight-http-pass.png">View a larger version of this image</a> |
| 43 | + </TabItem> |
| 44 | +</Tabs> |
| 45 | + |
| 46 | +## Check Kubernetes Version |
| 47 | + |
| 48 | +The examples below use the `clusterVersion` analyzer to check the version of Kubernetes running in the cluster. The `clusterVersion` analyzer uses data from the default `clusterInfo` collector. The `clusterInfo` collector is automatically included. |
| 49 | + |
| 50 | +For more information, see [Cluster Version](https://troubleshoot.sh/docs/analyze/cluster-version/) and [Cluster Info](https://troubleshoot.sh/docs/collect/cluster-info/) in the Troubleshoot documentation. |
| 51 | + |
| 52 | +<Tabs> |
| 53 | + <TabItem value="secret" label="Kubernetes Secret" default> |
| 54 | + <K8sVersionSecret/> |
| 55 | + </TabItem> |
| 56 | + <TabItem value="custom-resource" label="Preflight Custom Resource"> |
| 57 | + <K8sVersionCr/> |
| 58 | + <p>The following shows how the <code>warn</code> outcome for this preflight check is displayed in the Admin Console during KOTS installation or upgrade:</p> |
| 59 | + <img alt="Preflight checks in Admin Console showing warning message" src="/images/preflight-k8s-version-warn.png"/> |
| 60 | + <a href="/images/preflight-k8s-version-warn.png">View a larger version of this image</a> |
| 61 | + </TabItem> |
| 62 | +</Tabs> |
| 63 | + |
| 64 | +## Check Kubernetes Distribution |
| 65 | + |
| 66 | +The examples below use the `distribution` analyzer to check the Kubernetes distribution of the cluster. The `distribution` analyzer uses data from the default `clusterInfo` collector. The `clusterInfo` collector is automatically included. |
| 67 | + |
| 68 | +For more information, see [Cluster Info](https://troubleshoot.sh/docs/collect/cluster-info/) and [Distribution](https://troubleshoot.sh/docs/analyze/distribution/) in the Troubleshoot documentation. |
| 69 | + |
| 70 | +<Tabs> |
| 71 | + <TabItem value="secret" label="Kubernetes Secret" default> |
| 72 | + <K8sDistroSecret/> |
| 73 | + </TabItem> |
| 74 | + <TabItem value="custom-resource" label="Preflight Custom Resource"> |
| 75 | + <K8sDistroCr/> |
| 76 | + <p>The following shows how the <code>pass</code> outcome for this preflight check is displayed in the Admin Console during KOTS installation or upgrade:</p> |
| 77 | + <img alt="Preflight checks in Admin Console showing pass message" src="/images/preflight-k8s-distro.png"/> |
| 78 | + <a href="/images/preflight-k8s-distro.png">View a larger version of this image</a> |
| 79 | + </TabItem> |
| 80 | +</Tabs> |
| 81 | + |
| 82 | +## Check MySQL Version Using Template Functions |
| 83 | + |
| 84 | +The examples below use the `mysql` collector and the `mysql` analyzer to check the version of MySQL running in the cluster. |
| 85 | + |
| 86 | +For more information, see [Collect > MySQL](https://troubleshoot.sh/docs/collect/mysql/) and [Analyze > MySQL](https://troubleshoot.sh/docs/analyze/mysql/) in the Troubleshoot documentation. |
| 87 | + |
| 88 | +<Tabs> |
| 89 | + <TabItem value="secret" label="Kubernetes Secret" default> |
| 90 | + <p>This example uses Helm template functions to render the credentials and connection details for the MySQL server that were supplied by the user. Additionally, it uses Helm template functions to create a conditional statement so that the MySQL collector and analyzer are included in the preflight checks only when MySQL is deployed, as indicated by a <code>.Values.global.mysql.enabled</code> field evaluating to true.</p> |
| 91 | + <p>For more information about using Helm template functions to access values from the values file, see <a href="https://helm.sh/docs/chart_template_guide/values_files/">Values Files</a>.</p> |
| 92 | + <MySqlSecret/> |
| 93 | + </TabItem> |
| 94 | + <TabItem value="custom-resource" label="Preflight Custom Resource"> |
| 95 | + <p>This example uses KOTS template functions in the Config context to render the credentials and connection details for the MySQL server that were supplied by the user in the Replicated Admin Console <strong>Config</strong> page. Replicated recommends using a template function for the URI, as shown above, to avoid exposing sensitive information. For more information about template functions, see <a href="/reference/template-functions-about">About Template Functions</a>.</p> |
| 96 | + <p>This example also uses an analyzer with <code>strict: true</code>, which prevents installation from continuing if the preflight check fails.</p> |
| 97 | + <MySqlCr/> |
| 98 | + <p>The following shows how a <code>fail</code> outcome for this preflight check is displayed in the Admin Console during KOTS installation or upgrade when <code>strict: true</code> is set for the analyzer:</p> |
| 99 | + <img alt="Strict preflight checks in Admin Console showing fail message" src="/images/preflight-mysql-fail-strict.png"/> |
| 100 | + <a href="/images/preflight-mysql-fail-strict.png">View a larger version of this image</a> |
| 101 | + </TabItem> |
| 102 | +</Tabs> |
| 103 | + |
| 104 | +## Check Node Memory |
| 105 | + |
| 106 | +The examples below use the `nodeResources` analyzer to check that a required storage class is available in the nodes in the cluster. The `nodeResources` analyzer uses data from the default `clusterResources` collector. The `clusterResources` collector is automatically included. |
| 107 | + |
| 108 | +For more information, see [Cluster Resources](https://troubleshoot.sh/docs/collect/cluster-resources/) and [Node Resources](https://troubleshoot.sh/docs/analyze/node-resources/) in the Troubleshoot documentation. |
| 109 | + |
| 110 | +<Tabs> |
| 111 | + <TabItem value="secret" label="Kubernetes Secret" default> |
| 112 | + <NodeMemSecret/> |
| 113 | + </TabItem> |
| 114 | + <TabItem value="custom-resource" label="Preflight Custom Resource"> |
| 115 | + <NodeMemCr/> |
| 116 | + <p>The following shows how a <code>warn</code> outcome for this preflight check is displayed in the Admin Console during KOTS installation or upgrade:</p> |
| 117 | + <img alt="Preflight checks in Admin Console showing warn message" src="/images/preflight-node-memory-warn.png"/> |
| 118 | + <a href="/images/preflight-node-memory-warn.png">View a larger version of this image</a> |
| 119 | + </TabItem> |
| 120 | +</Tabs> |
| 121 | + |
| 122 | +## Check Node Storage Class Availability |
| 123 | + |
| 124 | +The examples below use the `storageClass` analyzer to check that a required storage class is available in the nodes in the cluster. The `storageClass` analyzer uses data from the default `clusterResources` collector. The `clusterResources` collector is automatically included. |
| 125 | + |
| 126 | +For more information, see [Cluster Resources](https://troubleshoot.sh/docs/collect/cluster-resources/) and [Node Resources](https://troubleshoot.sh/docs/analyze/node-resources/) in the Troubleshoot documentation. |
| 127 | + |
| 128 | +<Tabs> |
| 129 | + <TabItem value="secret" label="Kubernetes Secret" default> |
| 130 | + <NodeStorageClassSecret/> |
| 131 | + </TabItem> |
| 132 | + <TabItem value="custom-resource" label="Preflight Custom Resource"> |
| 133 | + <NodeStorageClassCr/> |
| 134 | + <p>The following shows how a <code>fail</code> outcome for this preflight check is displayed in the Admin Console during KOTS installation or upgrade:</p> |
| 135 | + <img alt="Preflight checks in Admin Console showing fail message" src="/images/preflight-storageclass-fail.png"/> |
| 136 | + <a href="/images/preflight-storageclass-fail.png">View a larger version of this image</a> |
| 137 | + </TabItem> |
| 138 | +</Tabs> |
| 139 | + |
| 140 | +## Check Node Ephemeral Storage |
| 141 | + |
| 142 | +The examples below use the `nodeResources` analyzer to check the ephemeral storage available in the nodes in the cluster. The `nodeResources` analyzer uses data from the default `clusterResources` collector. The `clusterResources` collector is automatically included. |
| 143 | + |
| 144 | +For more information, see [Cluster Resources](https://troubleshoot.sh/docs/collect/cluster-resources/) and [Node Resources](https://troubleshoot.sh/docs/analyze/node-resources/) in the Troubleshoot documentation. |
| 145 | + |
| 146 | +<Tabs> |
| 147 | + <TabItem value="secret" label="Kubernetes Secret" default> |
| 148 | + <NodeEphemStorageSecret/> |
| 149 | + </TabItem> |
| 150 | + <TabItem value="custom-resource" label="Preflight Custom Resource"> |
| 151 | + <NodeEphemStorageCr/> |
| 152 | + <p>The following shows how a <code>pass</code> outcome for this preflight check is displayed in the Admin Console during KOTS installation or upgrade:</p> |
| 153 | + <img alt="Preflight checks in Admin Console showing pass message" src="/images/preflight-ephemeral-storage-pass.png"/> |
| 154 | + <a href="/images/preflight-ephemeral-storage-pass.png">View a larger version of this image</a> |
| 155 | + </TabItem> |
| 156 | +</Tabs> |
| 157 | + |
| 158 | +## Check Requirements Are Met By At Least One Node |
| 159 | + |
| 160 | +The examples below use the `nodeResources` analyzer with filters to check that the requirements for memory, CPU cores, and architecture are met by at least one node in the cluster. The `nodeResources` analyzer uses data from the default `clusterResources` collector. The `clusterResources` collector is automatically included. |
| 161 | + |
| 162 | +For more information, see [Cluster Resources](https://troubleshoot.sh/docs/collect/cluster-resources/) and [Node Resources](https://troubleshoot.sh/docs/analyze/node-resources/) in the Troubleshoot documentation. |
| 163 | + |
| 164 | +<Tabs> |
| 165 | + <TabItem value="secret" label="Kubernetes Secret" default> |
| 166 | + <NodeReqSecret/> |
| 167 | + </TabItem> |
| 168 | + <TabItem value="custom-resource" label="Preflight Custom Resource"> |
| 169 | + <NodeReqCr/> |
| 170 | + <p>The following shows how the <code>fail</code> outcome for this preflight check is displayed in the Admin Console during KOTS installation or upgrade:</p> |
| 171 | + <img alt="Preflight checks in Admin Console showing fail message" src="/images/preflight-node-filters-faill.png"/> |
| 172 | + <a href="/images/preflight-node-filters-faill.png">View a larger version of this image</a> |
| 173 | + </TabItem> |
| 174 | +</Tabs> |
| 175 | + |
| 176 | +## Check Total CPU Cores Across Nodes |
| 177 | + |
| 178 | +The examples below use the `nodeResources` analyzer to check the version of Kubernetes running in the cluster. The `nodeResources` analyzer uses data from the default `clusterResources` collector. The `clusterResources` collector is automatically included. |
| 179 | + |
| 180 | +For more information, see [Cluster Resources](https://troubleshoot.sh/docs/collect/cluster-resources/) and [Node Resources](https://troubleshoot.sh/docs/analyze/node-resources/) in the Troubleshoot documentation. |
| 181 | + |
| 182 | +<Tabs> |
| 183 | + <TabItem value="secret" label="Kubernetes Secret" default> |
| 184 | + <NodeCpuSecret/> |
| 185 | + </TabItem> |
| 186 | + <TabItem value="custom-resource" label="Preflight Custom Resource"> |
| 187 | + <NodeCpuCr/> |
| 188 | + <p>The following shows how the <code>pass</code> outcome for this preflight check is displayed in the Admin Console during KOTS installation or upgrade:</p> |
| 189 | + <img alt="Preflight checks in Admin Console showing fail message" src="/images/preflight-cpu-pass.png"/> |
| 190 | + <a href="/images/preflight-cpu-pass.png">View a larger version of this image</a> |
| 191 | + </TabItem> |
| 192 | +</Tabs> |
0 commit comments