Skip to content

Commit eb0b9a2

Browse files
authored
Merge pull request #4759 from chrischdi/4471-amend-init-upgrade-to-kep
KEP-4471: kubeadm: make a control-plane's kubelet talk to the local API Server on kubeadm join
2 parents 7c97898 + 66b4039 commit eb0b9a2

File tree

1 file changed

+32
-11
lines changed
  • keps/sig-cluster-lifecycle/kubeadm/4471-cp-join-kubelet-local-apiserver

1 file changed

+32
-11
lines changed

keps/sig-cluster-lifecycle/kubeadm/4471-cp-join-kubelet-local-apiserver/README.md

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ tags, and then generate with `hack/update-toc.sh`.
8787
- [Story 1](#story-1)
8888
- [Story 2](#story-2)
8989
- [Story 3](#story-3)
90+
- [Story 4](#story-4)
9091
- [Notes/Constraints/Caveats (Optional)](#notesconstraintscaveats-optional)
9192
- [Caveats](#caveats)
9293
- [Risks and Mitigations](#risks-and-mitigations)
@@ -219,9 +220,10 @@ List the specific goals of the KEP. What is it trying to achieve? How will we
219220
know that this has succeeded?
220221
-->
221222

222-
- Add a new code path in kubeadm that can be used to join control plane nodes
223+
- Add a new code path in kubeadm that can be used to join control plane nodes
223224
without potentially violating the version skew policy, by letting the kubelet
224225
only communicate with the local kube-apiserver.
226+
- Also adjust init and upgrade to result in the same configuration.
225227
- Use a new feature gate `ControlPlaneKubeletLocalMode` to toggle the feature until
226228
graduating to GA.
227229

@@ -234,7 +236,7 @@ and make progress.
234236

235237
- Support the "old way" and "new way" indefinitely. Once the proposed feature gate
236238
graduates to GA it will hardcoded to be active.
237-
- Touch areas of kubeadm different than `kubeadm join`.
239+
- Touch areas of kubeadm different than `kubeadm join`, `kubeadm init` and `kubeadm upgrade`.
238240

239241
## Proposal
240242

@@ -248,11 +250,15 @@ nitty-gritty.
248250
-->
249251

250252
The proposal is to implement the required changes to make the kubelet point to the local available kube-apiserver.
251-
This change only relates to joining control plane nodes and does not affect worker nodes.
253+
This change relates to initializing, joining and upgrading control plane nodes and does not affect worker nodes.
252254

253-
The overall change is to adjust the file `/etc/kubernetes/bootstrap-kubelet.conf` to point to the local kube-apiserver, which gets created by kubeadm during the `KubeletStartJoinPhase` ([xref](https://github.com/kubernetes/kubernetes/blob/caf5311/cmd/kubeadm/app/cmd/phases/join/kubelet.go#L122-L125)).
255+
The overall change is:
254256

255-
To make this work, an additional change is required: etcd needs to get started and joined to the etcd cluster before waiting for the kubelet to finish its bootstrap process, instead of the other way around.
257+
- for `kubeadm join` to adjust the file `/etc/kubernetes/bootstrap-kubelet.conf` to point to the local kube-apiserver, which gets created by kubeadm during the `KubeletStartJoinPhase` ([xref](https://github.com/kubernetes/kubernetes/blob/caf5311/cmd/kubeadm/app/cmd/phases/join/kubelet.go#L122-L125)). This will also affect the kubelet's kubeconfig.
258+
- for `kubeadm init` to adjust the created kubeconfig to point to the local kube-apiserver, which gets created by kubeadm during the `kubeconfig` phase ([xref](https://github.com/kubernetes/kubernetes/blob/8871513c1b64cae321552abfe9a3a90969637560/cmd/kubeadm/app/cmd/phases/init/kubeconfig.go#L87))
259+
- for `kubeadm upgrade` to edit the kubelet config file to point to the local kube-apiserver.
260+
261+
To make this work for `kubeadm join`, an additional change is required: etcd needs to get started and joined to the etcd cluster before waiting for the kubelet to finish its bootstrap process, instead of the other way around.
256262
This requires reordering some of the operations done in different kubeadm phases by extracting the relevant parts into separate phases and changing their order.
257263

258264
Because reordering the phases can be considered a breaking change to the CLI of kubeadm for some users, this should get done behind a feature gate, while preserving the previous behavior when the feature gate is disabled.
@@ -278,6 +284,10 @@ As a kubeadm user, I wish the kubelet of a joining control plane node points to
278284

279285
As a kubeadm user, I wish the CLI of kubeadm to be stable and breaking changes to it to be announced ahead of time.
280286

287+
#### Story 4
288+
289+
As a kubeadm user, I wish the kubelet of an initializing control plane node points to the local kube-apiserver.
290+
281291
### Notes/Constraints/Caveats (Optional)
282292

283293
<!--
@@ -341,9 +351,15 @@ As explained above two minor changes are required to implement the required chan
341351

342352
**1. Make the kubelet point to the local kube-apiserver**
343353

344-
To make the kubelet point to the local apiserver, the file for kubelet's bootstrap kubeconfig
345-
needs to get adjusted, which gets created by kubeadm during the
346-
`KubeletStartJoinPhase` ([xref](https://github.com/kubernetes/kubernetes/blob/caf5311/cmd/kubeadm/app/cmd/phases/join/kubelet.go#L122-L125)).
354+
For `kubeadm init` to make the kubelet point to the local apiserver, the kubeconfig
355+
which get's written for the kubelet needs to get adjusted when the kubelet's kubeconfig
356+
file gets written
357+
([xref](https://github.com/kubernetes/kubernetes/blob/caf5311/cmd/kubeadm/app/cmd/phases/init/kubeconfig.go#L135-L163)).
358+
359+
For `kubeadm join` to make the kubelet point to the local apiserver, the file for
360+
kubelet's bootstrap kubeconfig needs to get adjusted, which gets created by kubeadm during the
361+
`KubeletStartJoinPhase`
362+
([xref](https://github.com/kubernetes/kubernetes/blob/caf5311/cmd/kubeadm/app/cmd/phases/join/kubelet.go#L122-L125)).
347363

348364
This creates the following chicken-egg issue:
349365

@@ -490,8 +506,12 @@ It can do the following:
490506
- Create a 3 control plane node cluster
491507
- Call `kubeadm init` on one of them, having the feature gate `ControlPlaneKubeletLocalMode`
492508
enabled.
493-
- Calls `kubeadm join` on the remaining control plane nodes, having the feature gate
494-
`ControlPlaneKubeletLocalMode` enabled.
509+
- Check that the kubelet is pointing to the local apiserver.
510+
- Call `kubeadm join` on the remaining control plane nodes.
511+
- Check that the kubelet's are pointing to the local apiserver.
512+
- Adjust the kubelet's kubeconfig's to point to the load balanced endpoint.
513+
- Call `kubeadm upgrade` on the nodes.
514+
- Check that all kubelet's are again pointing to the local apiserver.
495515

496516
### Graduation Criteria
497517

@@ -635,7 +655,8 @@ Major milestones might include:
635655

636656
- 01.02.2024: KEP issue created.
637657
- 08.02.2024: KEP draft created.
638-
- 07.05.2024: KEP marked as implementable for 1.31 or later
658+
- 07.05.2024: KEP marked as implementable for 1.31 or later.
659+
- 12.07.2024: KEP adjusted to match discussed implementation.
639660

640661
## Drawbacks
641662

0 commit comments

Comments
 (0)