Skip to content

Commit c7eba21

Browse files
committed
Add more documentation about the KCP pre-terminate hook
Signed-off-by: Stefan Büringer [email protected]
1 parent a8ae016 commit c7eba21

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

api/v1beta1/machine_types.go

+10
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ const (
6161
// search each annotation for during the pre-terminate.delete lifecycle hook
6262
// to pause reconciliation of deletion. These hooks will prevent removal of
6363
// an instance from an infrastructure provider until all are removed.
64+
//
65+
// Notes for Machines managed by KCP (starting with Cluster API v1.8.2):
66+
// * KCP adds its own pre-terminate hook on all Machines it controls. This is done to ensure it can later remove
67+
// the etcd member right before Machine termination (i.e. before InfraMachine deletion). If the etcd member would be
68+
// removed earlier, kubelet would start failing and the Node drain would not work.
69+
// * Starting with Kubernetes v1.31 the KCP pre-terminate hook will wait for all other pre-terminate hooks to finish to
70+
// ensure it runs last (thus ensuring that kubelet is still working while other pre-terminate hooks run). This is only done
71+
// for v1.31 or above because the kubeadm ControlPlaneKubeletLocalMode was introduced with kubeadm 1.31. This feature configures
72+
// the kubelet to communicate with the local apiserver. Only because of that the kubelet immediately starts failing after the etcd
73+
// member is removed. We need the ControlPlaneKubeletLocalMode feature with 1.31 to adhere to the kubelet skew policy.
6474
PreTerminateDeleteHookAnnotationPrefix = "pre-terminate.delete.hook.machine.cluster.x-k8s.io"
6575

6676
// MachineCertificatesExpiryDateAnnotation annotation specifies the expiry date of the machine certificates in RFC3339 format.

docs/book/src/developer/providers/migrations/v1.8-to-v1.9.md

+10
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ maintainers of providers and consumers of our Go API.
1717

1818
### Other
1919

20+
- Notes for Machines managed by KCP (starting with Cluster API v1.8.2):
21+
- KCP adds its own pre-terminate hook on all Machines it controls. This is done to ensure it can later remove
22+
the etcd member right before Machine termination (i.e. before InfraMachine deletion). If the etcd member would be
23+
removed earlier, kubelet would start failing and the Node drain would not work.
24+
- Starting with Kubernetes v1.31 the KCP pre-terminate hook will wait for all other pre-terminate hooks to finish to
25+
ensure it runs last (thus ensuring that kubelet is still working while other pre-terminate hooks run). This is only done
26+
for v1.31 or above because the kubeadm ControlPlaneKubeletLocalMode was introduced with kubeadm 1.31. This feature configures
27+
the kubelet to communicate with the local apiserver. Only because of that the kubelet immediately starts failing after the etcd
28+
member is removed. We need the ControlPlaneKubeletLocalMode feature with 1.31 to adhere to the kubelet skew policy.
29+
2030
### Suggested changes for providers
2131

2232
- The Errors package was created when capi provider implementation was running as machineActuators that needed to vendor core capi to function. There is no usage recommendations today and its value is questionable since we moved to CRDs that inter-operate mostly via conditions. Instead we plan to drop the dedicated semantic for terminal failure and keep improving Machine lifecycle signal through conditions. Therefore the Errors package [has been deprecated in v1.8](https://github.com/kubernetes-sigs/cluster-api/issues/10784). It's recommented to remove any usage of the currently exported variables.

0 commit comments

Comments
 (0)