|
1 | 1 | # Experimental Feature: MachineSetPreflightChecks (alpha)
|
2 | 2 |
|
3 |
| -The `MachineSetPreflightChecks` feature can provide additional safety while creating new Machines for a MachineSet. |
| 3 | +The `MachineSetPreflightChecks` feature can provide additional safety while creating new Machines and remediating existing unhealthy Machines of a MachineSet. |
| 4 | + |
| 5 | +When a MachineSet creates machines under certain circumstances, the operation fails or leads to a new machine that will be deleted and recreated in a short timeframe, |
| 6 | +leading to unwanted Machine churn. Some of these circumstances include, but not limited to, creating a new Machine when Kubernetes version skew could be violated or |
| 7 | +joining a Machine when the Control Plane is upgrading leading to failure because of mixed kube-apiserver version or due to the cluster load balancer delays in adapting |
| 8 | +to the changes. |
| 9 | + |
| 10 | +Enabling `MachineSetPreflightChecks` provides safety in such circumstances by making sure that a Machine is only created when it is safe to do so. |
| 11 | + |
4 | 12 |
|
5 | 13 | **Feature gate name**: `MachineSetPreflightChecks`
|
6 | 14 |
|
7 | 15 | **Variable name to enable/disable the feature gate**: `EXP_MACHINE_SET_PREFLIGHT_CHECKS`
|
8 | 16 |
|
9 |
| -The following preflight checks are performed when the feature is enabled: |
10 |
| -* ControlPlaneIsStable |
11 |
| -* KubeadmVersionSkew |
12 |
| -* KubernetesVersionSkew |
| 17 | +## Supported PreflightChecks |
| 18 | + |
| 19 | +### `ControlPlaneIsStable` |
| 20 | + |
| 21 | +* This preflight check ensures that the ControlPlane is currently stable i.e. the ControlPlane is currently neither provisioning nor upgrading. |
| 22 | +* This preflight check is only performed if: |
| 23 | + * The Cluster uses a ControlPlane provider. |
| 24 | + * ControlPlane version is defined (`ControlPlane.spec.version` is set). |
| 25 | + |
| 26 | +### `KubernetesVersionSkew` |
| 27 | + |
| 28 | +* This preflight check ensures that the MachineSet and the ControlPlane conform to the [Kubernetes version skew](https://kubernetes.io/releases/version-skew-policy/#kubelet). |
| 29 | +* This preflight check is only performed if: |
| 30 | + * The Cluster uses a ControlPlane provider. |
| 31 | + * ControlPlane version is defined (`ControlPlane.spec.version` is set). |
| 32 | + * MachineSet version is defined (`MachineSet.spec.template.spec.version` is set). |
| 33 | + |
| 34 | +### `KubeadmVersionSkew` |
| 35 | + |
| 36 | +* This preflight check ensures that the MachineSet and the ControlPlane conform to the [kubeadm version skew](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#kubeadm-s-skew-against-kubeadm). |
| 37 | +* This preflight check is only performed if: |
| 38 | + * The Cluster uses a ControlPlane provider. |
| 39 | + * ControlPlane version is defined (`ControlPlane.spec.version` is set). |
| 40 | + * MachineSet version is defined (`MachineSet.spec.template.spec.version` is set). |
| 41 | + * MachineSet uses the `Kubeadm` Bootstrap provider. |
| 42 | + |
| 43 | +## Opting out of PreflightChecks |
| 44 | + |
| 45 | +Once the feature flag is enabled the preflight checks are enabled for all the MachineSets including new and existing MachineSets. |
| 46 | +It is possible to opt-out of one or all of the preflight checks on a per MachineSet basis by specifying a comma-separated list of the preflight checks on the |
| 47 | +`machineset.cluster.x-k8s.io/skip-preflight-checks` annotation on the MachineSet. |
| 48 | + |
| 49 | +Examples: |
| 50 | +* To opt out of all the preflight checks set the `machineset.cluster.x-k8s.io/skip-preflight-checks: All` annotation. |
| 51 | +* To opt out of the `ControlPlaneIsStable` preflight check set the `machineset.cluster.x-k8s.io/skip-preflight-checks: ControlPlaneIsStable` annotation. |
| 52 | +* To opt out of multiple preflight checks set the `machineset.cluster.x-k8s.io/skip-preflight-checks: ControlPlaneIsStable,KubernetesVersionSkew` annotation. |
| 53 | + |
| 54 | +<aside class="note"> |
| 55 | + |
| 56 | +<h1>Pro-tip: Set annotation through MachineDeployment</h1> |
| 57 | + |
| 58 | +Because of the [metadata propagation](../../developer/architecture/controllers/metadata-propagation.md#machinedeployment) rules in Cluster API you can set the `machineset.cluster.x-k8s.io/skip-preflight-checks` annotation |
| 59 | +on a MachineDeployment and it will be automatically set on the MachineSets of that MachineDeployment, including any new MachineSets created when the MachineDeployment performs a rollout. |
| 60 | + |
| 61 | +</aside> |
| 62 | + |
| 63 | + |
0 commit comments