Preflight and host readiness
Preflight and host readiness checks decide whether kURL can safely start or continue an install, join, upgrade, or maintenance action. They combine local host facts, existing cluster state, selected add-on needs, and action-specific rules into a result that can allow, warn, ask, or stop.
Readiness model
Readiness has two scopes. Host checks inspect the machine that runs the action. Cluster checks inspect an existing Kubernetes cluster. The action context selects which rules apply to a primary node, a joining node, or an upgrade.
flowchart LR
C[Installer and action context] --> H[Host readiness]
C --> K[Cluster readiness]
H --> P[Pass, warning, or failure]
K --> P
P --> G[Action gate]
G --> A[Continue, confirm, or stop]
The result is not only a report. The install or maintenance flow applies a policy to it. A failure blocks the action. A warning can block the action or request confirmation. An explicit ignore path lets the action continue while recording that the result was bypassed.
Host readiness
Host readiness determines whether one machine has the system state needed for its role. The baseline covers platform support, Kubernetes compatibility, swap, container runtime, firewall and security settings, name-server access, and other local install conditions. Selected add-ons can add their own host rules.
The host runner also receives the action role. A primary, join, or upgrade action can therefore use different checks. Join checks can include access to services on other hosts. This links local readiness to the remote services that the node must use. See Host preflight checks for the host-level rules.
References: scripts/…/preflights.sh• L2-19 scripts/…/preflights.sh• L55-59 scripts/…/preflights.sh• L578-685
Cluster readiness
Cluster readiness determines whether an existing Kubernetes cluster can support the next action. It runs only when the host has the tools and administrator configuration needed to access Kubernetes. This keeps new-host installs separate from actions that depend on a running cluster.
The cluster path applies the same result policy as host checks, but its facts come from cluster state. Capacity, node coverage, and service connectivity can add stronger rules for a specific maintenance action. See Cluster capacity and connectivity checks for those checks.
References: scripts/…/preflights.sh• L687-783 scripts/…/preflights.sh• L696-704
Action gates
Action gates group checks by the point in the lifecycle where they protect the system. The common gate runs on all nodes for init, join, and upgrade. Init adds checks for the first node and selected services. Join prevents an incompatible existing Kubernetes node from being reused. Upgrade and maintenance actions add checks for the state they are about to change.
The main gates are:
- Common host gate: Checks architecture, operating system, Kubernetes pairing, swap, container runtime, network name servers, and host security settings.
- Init gate: Checks selected object-store and storage relationships, existing kURL pod health, migration support, release order, and registry requirements.
- Join gate: Checks that the host is not already an incompatible Kubernetes node.
- Maintenance gate: Checks the current cluster and service state before a change such as storage migration. Capacity and minimum-node rules can stop the action before data movement begins.
References: scripts/…/preflights.sh• L2-30 scripts/…/preflights.sh• L33-59 scripts/…/preflights.sh• L836-950
Installation conditions
Installation conditions protect the relationship between the selected components and the host. The installer can require a container runtime, reject an unsupported operating system or Kubernetes version pairing, disable swap, and ask how to handle active firewall or security controls. It can also warn about Docker conflicts when a new install selects containerd.
These checks can change the host before installation continues. The flow may disable swap, firewall services, or SELinux when the configured policy permits it. A refusal becomes a blocking result rather than an unrecorded partial state.
References: scripts/…/preflights.sh• L69-139 scripts/…/preflights.sh• L199-335 scripts/…/preflights.sh• L344-383 scripts/…/preflights.sh• L810-834
Upgrade and migration conditions
Upgrade and migration checks protect existing state. The installer rejects a kURL release that is older than the version already used. It also checks whether storage transitions are supported, whether required object storage exists, and whether selected storage versions meet automated scaling or migration requirements.
The checks use the current cluster when it is available. They do not treat a missing cluster version as proof of failure because a new install may have no prior state to inspect.
References: scripts/…/preflights.sh• L23-30 scripts/…/preflights.sh• L836-950
Preflight specifications
Preflight specifications describe the facts to collect and the outcomes to report. Host specifications describe machine state. Cluster specifications describe Kubernetes state. The command layer combines built-in rules with caller and add-on rules before it runs them.
The merged specification carries action context such as primary status, join status, upgrade status, and peer host names. This lets one readiness system express different conditions without changing the meaning of the final pass, warning, or failure result.
Built-in checks
Built-in checks provide the default safety baseline. They are not the full set of rules for every action because add-ons and maintenance operations can extend or narrow the applicable conditions.
The shell can exclude built-in host checks. It can also add the host preflight files supplied by selected add-ons and by the selected container runtime. Add-on rules therefore become part of the same host result and use the same warning and failure policy.
References: scripts/…/preflights.sh• L604-625 scripts/…/preflights.sh• L722-724
System package checks
System package checks turn an add-on manifest into a host preflight when the add-on declares required packages. The check reports whether each platform-specific package is installed, so an add-on can stop before its services depend on a missing host package.
References: scripts/…/preflights.sh• L457-576
Preflight runners
Runners connect the install command to the preflight engine. The host runner collects local facts. The cluster runner collects facts through Kubernetes access. Both return analyzed results that the action gate can apply.
The shell writes each run to a readable results directory. The record includes the kURL version, the options used, and the reported results. This gives support and later review the context needed to distinguish a failed check from an ignored or non-enforced warning.
References: scripts/…/preflights.sh• L578-685 scripts/…/preflights.sh• L687-783 scripts/…/preflights.sh• L785-808
Result policy
Result policy converts check outcomes into action behavior. The normal path stops on failures. Warnings can stop the action when warning enforcement is enabled or can ask the operator for confirmation when they are not enforced. The ignore path continues but logs that failures or warnings were bypassed.
The host and cluster paths use the same exit-code meaning:
| Result | Normal action | Ignored action |
|---|---|---|
| Failure | Stop | Continue and report the bypass |
| Blocking warning | Stop | Continue and report the bypass |
| Non-blocking warning | Ask for confirmation | Continue and report the bypass |
| Pass | Continue | Continue |
References: scripts/…/preflights.sh• L591-603 scripts/…/preflights.sh• L634-685 scripts/…/preflights.sh• L709-783
Host identity utilities
Host identity utilities provide stable values for commands and integrations that need to name a machine. The hostname value is normalized and rejected when empty. The protected host ID is derived from the machine identity without exposing the raw machine ID.
These values support host-related diagnostics and identity contracts. They do not decide readiness by themselves. Readiness checks use them only when a rule needs a host name or a stable host identifier.
References: pkg/…/hostname.go• L9-26 pkg/…/protectedid.go• L3-7 pkg/…/hostname.go• L10-21 pkg/…/host_protectedid.go• L10-21
Installation and maintenance flow
The flow builds the checks from the installer specification and action context, runs the checks that are available, records the results, and applies the action gate. Host checks can run before Kubernetes exists. Cluster checks are skipped when Kubernetes access is not available.
The main sequence is:
- Select common, built-in, add-on, and action-specific checks.
- Run host checks for the current node.
- Run cluster checks when
kubectland/etc/kubernetes/admin.confare available. - Record the version, options, and results.
- Stop, ask, or continue according to the result policy.
This diagram shows how local and cluster facts become a decision for installation or maintenance.
sequenceDiagram
participant Action as Install or maintenance action
participant Host as Host preflight
participant Cluster as Cluster preflight
participant Gate as Action gate
Action->>Host: Run applicable host checks
Host-->>Action: Host results
Action->>Cluster: Run when cluster access exists
Cluster-->>Action: Cluster results
Action->>Gate: Apply result policy
Gate-->>Action: Continue, confirm, or stop
References: scripts/…/preflights.sh• L578-783 scripts/…/preflights.sh• L785-808
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the lifecycle functions aligned with the action that calls them. A rule added to the common gate affects init, join, and upgrade.
- When a host or cluster result code changes, update both normal enforcement and the explicit ignore path.
- When add-on or container-runtime preflight inputs change, review how they are merged into the host run.
- When cluster access requirements change, review the skip behavior for new installs and the result record produced for support.
- When a component relationship changes, review init checks for object storage, storage, registry, and migration compatibility.
- When host identity behavior changes, review the CLI consumers and any external contract that uses the normalized name or protected ID.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The host uses an unsupported platform or Kubernetes pairing | Installation stops or proceeds only as an explicit best-effort case | The common host gate checks the platform matrix and target version |
| Swap remains active | The application cannot meet its memory-safety requirement | The installer asks to disable swap and stops when the operator refuses |
| A required runtime is missing or incompatible | Kubernetes setup cannot use the selected container runtime | The runtime gate requires a supported runtime and version pairing |
| A join host already has an incompatible Kubernetes installation | The join can target the wrong cluster or corrupt existing state | The join gate rejects an existing installation or asks about a different API endpoint |
| Cluster access is unavailable | In-cluster checks produce no result | The cluster gate runs only with kubectl and /etc/kubernetes/admin.conf |
| A warning is enforced or a failure is returned | Installation or maintenance stops | The result policy maps blocking warnings and failures to a bail path |
| A migration lacks required storage, object store, version, or capacity support | The change is refused before it can move or depend on data | Init and maintenance gates validate the selected component relationships |
| The hostname is empty or machine identity cannot be read | The identity command cannot return a usable value | Host identity utilities validate and propagate identity errors |
Key files
| File | Why to read it |
|---|---|
| scripts/…/preflights.sh | Defines lifecycle gates, host and cluster runners, result policy, action conditions, and readiness records. |
| docs/host-preflight-checks.md | Explains the detailed host checks and their role-specific conditions. |
| docs/cluster-capacity-and-connectivity.md | Explains cluster capacity, node, image, storage, and connectivity checks. |
| pkg/…/host_preflight.go | Shows how installer context selects and runs host or cluster preflight checks. |
| pkg/…/host-preflights.yaml | Defines the built-in host readiness baseline. |
| pkg/…/preflights.yaml | Defines the built-in cluster readiness baseline. |
| pkg/…/runner.go | Defines the runner boundary for host and cluster collection. |
| pkg/…/hostname.go | Defines normalized hostname behavior. |
| pkg/…/protectedid.go | Defines protected host identity behavior. |