Understand preflight checks

In Anthos clusters on bare metal you can run preflight checks for different situations:

  • Anthos clusters on bare metal runs preflight checks when you create or update admin, hybrid, standalone, or user clusters and nodepool resources with bmctl. If the checks fail, no changes are made. You can also bypass these checks.
  • Anthos clusters on bare metal also runs internal preflight checks when you apply Kubernetes resources to user clusters from an admin or hybrid cluster. The checks are run before changes are actually applied to affected user clusters. If the checks fail, no changes are made. You can also bypass these checks, or run them explicitly.

Preflight checks for cluster creation with bmctl

When you create admin, hybrid, standalone, or user clusters with the bmctl command, Anthos clusters on bare metal automatically runs preflight checks before any changes are made.

When the checks pass, Anthos clusters on bare metal will create the clusters.

Ignore the results of automated preflight checks

If you want to bypass these automated preflight checks, you can use the optional --force flag in the command.

Run preflight checks independently

You can also run preflight checks by themselves, before you create a cluster. This can help save time by ensuring your machine and node resources pass checks.

  • The following command validates the specified cluster config file, but doesn't try to create the cluster itself:

    bmctl check config --cluster CLUSTER_NAME
    

    Replace CLUSTER_NAME with the name of the cluster whose config file you're checking.

  • This command checks whether the machines and network are ready for cluster creation:

    bmctl check preflight --cluster CLUSTER_NAME
    

    Replace CLUSTER_NAME with the name of the cluster you're checking.

Run latest preflight checks and health checks

You can perform preflight checks on your system. Preflight checks ensure that your machines and network are ready for cluster creation. The following command checks your machines and network to ensure they are ready for cluster creation using the latest list of checks:

bmctl check preflight --cluster CLUSTER_NAME --check-image-version latest

Replace CLUSTER_NAME with the name of the cluster you're checking.

You can also perform health checks of a live cluster to determine whether the cluster is healthy. To perform the most up-to-date health checks on a live cluster, run the following command:

bmctl check cluster --cluster CLUSTER_NAME --check-image-version latest

Replace CLUSTER_NAME with the name of the cluster you're checking.

Preflight checks for upgrades

The bmctl check preflight command lets you run a preflight check before upgrading your cluster. You can check if the clusters are ready for an upgrade by running the following preflight check command before starting the upgrade:

  1. Update the cluster version (anthosBareMetalVersion) in the cluster configuration file.
  2. The following command enables you to check if the clusters are ready for an upgrade and run a preflight check:

    bmctl check preflight --kubeconfig ADMIN_CLUSTER_KUBECONFIG_PATH
     -c CLUSTER_NAME
    

    Replace the following:

    • CLUSTER_NAME: the name of the cluster to upgrade.
    • ADMIN_CLUSTER_KUBECONFIG_PATH: the path to the admin cluster kubeconfig file.

    Note that the bmctl check preflight for upgrade works when the original cluster is version 1.13.1 or later.

    When you create the preflight check with this command to test an admin or user cluster upgrade, a PreflightCheck custom resource is created in the admin cluster.

Preflight checks for user cluster creation

User clusters are created from an existing admin or hybrid cluster. Anthos clusters on bare metal automatically runs preflight checks before making any changes. You can also run preflight checks with bmctl before you create a cluster.

  • The following command validates the specified cluster config file, but doesn't try to create the cluster itself:

    bmctl check config --cluster CLUSTER_NAME --admin-kubeconfig ADMIN_KUBECONFIG_PATH
    

    Replace CLUSTER_NAME with the name of the user cluster you're checking and replace ADMIN_KUBECONFIG_PATH with the path to the associated admin cluster's kubeconfig file.

  • This command checks whether the machines and network are ready for cluster creation:

    bmctl check preflight --cluster CLUSTER_NAME --admin-kubeconfig ADMIN_KUBECONFIG_PATH
    

bmctl supports the use of --kubeconfig as an alias for the--admin-kubeconfig flag.

Internal preflight checks on existing clusters

Anthos clusters on bare metal also performs internal preflight checks when you apply Kubernetes resources to an existing cluster. If any checks fail, Anthos clusters on bare metal will not make any changes to the related nodes unless you've specifically bypassed the checks.

Bypass preflight checks when applying Kubernetes resources

To ignore the internal preflight checks when applying resources to existing clusters, you need to set the BypassPreflightCheck field to true in the cluster YAML file.

Here is a fragment of a cluster config YAML file, showing the bypassPreflightCheck field set to true.

# Sample cluster config to bypass preflight check errors:

apiVersion: v1
kind: Namespace
metadata:
  name: cluster-user1
---
apiVersion: baremetal.cluster.gke.io/v1
kind: Cluster
metadata:
  name: user1
  namespace: cluster-user1
spec:
  type: user
  bypassPreflightCheck: true
  # Anthos cluster version.
  anthosBareMetalVersion: 1.16.1
....

Installation preflight check details

Anthos clusters on bare metal checks a variety of operating system, software, and machine prerequisite conditions when running preflight checks.

For more detailed information, see Installation prerequisites overview.