Skip to content

Commit 4f1db61

Browse files
authored
Merge pull request kubernetes#3312 from neolit123/1.25-kubeadm-patches-for-kubelet
sig-cl/kubeadm/1739: update KEP for support of patching kubelet config
2 parents 5000eab + c03f84d commit 4f1db61

File tree

1 file changed

+59
-23
lines changed
  • keps/sig-cluster-lifecycle/kubeadm/1739-customization-with-patches

1 file changed

+59
-23
lines changed

keps/sig-cluster-lifecycle/kubeadm/1739-customization-with-patches/README.md

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,16 @@ 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
- [Risks and Mitigations](#risks-and-mitigations)
9293
- [Design Details](#design-details)
9394
- [Code organization](#code-organization)
9495
- [Patch formats](#patch-formats)
9596
- [Patch file naming format](#patch-file-naming-format)
97+
- [Patch targets](#patch-targets)
98+
- [Control plane static Pods](#control-plane-static-pods)
99+
- [Kubelet ComponentConfig](#kubelet-componentconfig)
96100
- [Support for multiple patches per file](#support-for-multiple-patches-per-file)
97101
- [Test Plan](#test-plan)
98102
- [Graduation Criteria](#graduation-criteria)
@@ -168,11 +172,12 @@ A good summary is probably at least a paragraph in length.
168172
This KEP proposes a replacement for the feature introduced by the kubeadm KEP
169173
"20190722-Advanced-configurations-with-kubeadm-(Kustomize)".
170174

171-
It has the same scope and goals, allowing the users to amend manifests
172-
generated by kubeadm using patches, but not using Kustomize as the backend
173-
for applying the patches.
175+
It has similar scope and goals, allowing the users to amend manifests
176+
and configuration files generated by kubeadm using patches, but not using
177+
Kustomize as the backend for applying the patches.
174178

175-
The existing Kustomize implementation in kubeadm is in Alpha state.
179+
The Kustomize implementation in kubeadm was in an Alpha state and was
180+
removed.
176181

177182
## Motivation
178183

@@ -198,10 +203,10 @@ know that this has succeeded?
198203
-->
199204

200205
- Implement a solution for applying patches over kubeadm generated manifests
201-
during the common kubeadm commands "init", "join" and "upgrade" and their phases.
206+
and configuration during the common kubeadm commands "init", "join" and "upgrade"
207+
and their phases.
202208
- Deprecate and remove the existing Kustomize solution after a grace period
203209
of at least one release.
204-
- To initially allow patching of static Pod manifests only.
205210

206211
### Non-Goals
207212

@@ -214,8 +219,6 @@ and make progress.
214219
sane security values.
215220
- Allow patching of core addon configuration generated by kubeadm - e.g. CoreDNS,
216221
kube-proxy (until further notice).
217-
- Allowing patches to be added using the kubeadm ComponentConfig (until
218-
further notice).
219222
- Replace the kubeadm ComponentConfig. The sane defaults would still be
220223
generated by kubeadm.
221224

@@ -265,6 +268,11 @@ liveness probes for edge clusters.
265268
As a cluster administrator, I want to upgrade my cluster preserving all the
266269
patches that were applied during "init"/"join".
267270

271+
#### Story 4
272+
273+
As a cluster administrator, I want to be able to apply instance specific
274+
configuration to kubelets on different nodes.
275+
268276
### Notes/Constraints/Caveats (optional)
269277

270278
<!--
@@ -304,7 +312,7 @@ and release notes what is the scope of the new feature.
304312
- Users are allowed to pass configuration for components using the
305313
kubeadm ComponentConfiguration.
306314
- kubeadm applies sane / secure defaults.
307-
- The users can patch the generated manifests to their liking.
315+
- The users can patch the generated configuration to their liking.
308316

309317
_Misleading expectations on the level of flexibility_
310318

@@ -315,7 +323,7 @@ will be examined before moving forward in graduating the feature to beta.
315323

316324
_Breaking changes post upgrade_
317325

318-
A change in a kubeadm manifest can make a patch apply to fail.
326+
A change in a kubeadm generated configuration can make a patch apply to fail.
319327

320328
The kubeadm maintainers will work on release notes to make potential
321329
breaking changes more visible. Additionally, upgrade instructions will be
@@ -388,16 +396,17 @@ Conversion from YAML to JSON will be performed using the
388396

389397
Once the user passes a folder with patches to a kubeadm command,
390398
kubeadm must be able to determine what format each file is and what
391-
manifest it is targeting.
399+
is its target.
392400

393401
Parsing the patch contents to determine the patch format is not possible,
394402
because the formats `strategic` and `merge` are the same, while they do
395403
have different apply mechanisms.
396404

397405
The proposal is to have the following naming format:
398-
`componentname[suffix][+patchtype].{yaml|json}`
406+
`target[suffix][+patchtype].{yaml|json}`
399407

400-
- `componentname` must be a known component name - e.g. `kube-apiserver`.
408+
- `target` must be a known component name - e.g. `kube-apiserver` or
409+
the name of generated configuration.
401410
- `suffix` is optional and can be used to ensure an order when applying
402411
patches from multiple files for the same component.
403412
- `+patchtype` is optional and can be used to pass one of the supported
@@ -424,6 +433,28 @@ but also allow for advanced usage with patch ordering and the `json` type.
424433
- Would allow having arbitrary files that are ignored in the patch folder -
425434
e.g. having a `README.md`.
426435

436+
### Patch targets
437+
438+
The mechanism allows patching the following targets via the `target` naming property:
439+
440+
#### Control plane static Pods
441+
442+
Static Pod manifests generated on control plane nodes can be patched with the following
443+
targets: `kube-apiserver`, `kube-controller-manager`, `kube-scheduler` and `etcd`.
444+
Their API GroupVersionKind is `core/v1.Pod`.
445+
446+
Patches for the control plane static Pods are applied over the generated manifests
447+
in memory during `init/join/upgrade`.
448+
449+
#### Kubelet ComponentConfig
450+
451+
The generated per-node kubelet ComponentConfig can be patched with the `kubeletconfiguration`
452+
target. Its API GroupVersionKind is of type `kubelet.config.k8s.io/v1beta1.KubeletConfiguration`.
453+
454+
During `init` patches for the kubelet are applied over the user provided and kubeadm defaulted
455+
`KubeletConfiguration`. During `join/upgrade` patches are applied over the downloaded
456+
from the cluster global `KubeletConfiguration`.
457+
427458
### Support for multiple patches per file
428459

429460
To support multiple patches per file, the proposal is to implement
@@ -537,6 +568,7 @@ ComponentConfig version increment, so could land in GA graduation.
537568
- The feature is widely used and at least 2 cycles have passed since Beta.
538569
- The `--patches` flag is removed (optional). Depends on user feedback
539570
and the wider kubeadm plan for removing flags in favor of ComponentConfig.
571+
- More patch targets are considered (optional).
540572

541573
### Upgrade / Downgrade Strategy
542574

@@ -575,6 +607,8 @@ enhancement:
575607
CRI or CNI may require updating that component before the kubelet.
576608
-->
577609

610+
This section covers the `corev1.Pod` as a example target for version skew.
611+
578612
Once introduced, the feature will support patching at minimum the `corev1.Pod`
579613
object. If at some point the Kubernetes core API graduates to `v2`, kubeadm would
580614
have to support patching both `corev2` and `corev1` for at least one release
@@ -584,8 +618,7 @@ This is due to the fact kubeadm supports deploying Kubernetes `v1.YY` and `v1.YY
584618
And if `corev2` is added in `v1.YY`, kubeadm must be able to handle `corev1`
585619
that is supported in `v1.YY-1`.
586620

587-
If the patching mechanic one day supports patching different API types,
588-
it must also apply similar skew strategy to those types.
621+
A similar skew strategy must be applied for other supported patch target API types.
589622

590623
## Production Readiness Review Questionnaire
591624

@@ -624,7 +657,7 @@ _This section must be completed when targeting alpha to a release._
624657
- [x] Other
625658
- Describe the mechanism:
626659
When a new kubeadm control-plane Node joins the cluster it can optionally
627-
apply custom patches to the static Pods that kubeadm configures.
660+
apply custom patches to kubeadm generated configuration.
628661
- Will enabling / disabling the feature require downtime of the control
629662
plane?
630663
No, unless the user created patches result in bad configuration and
@@ -646,7 +679,7 @@ _This section must be completed when targeting alpha to a release._
646679
feature, can it break the existing applications?).
647680
Yes. Once the patches are applied for a `kubeadm init|join|upgrade` command,
648681
the user can decide to roll-back the changes which will result in a restart
649-
of the control-plane component static Pods that were patches on this Node.
682+
of component that was customized by the patches.
650683

651684
* **What happens if we reenable the feature if it was previously rolled back?**
652685
This is supported by invoking kubeadm phases. The patches will re-apply
@@ -669,7 +702,7 @@ _This section must be completed when targeting beta graduation to a release._
669702
Try to be as paranoid as possible - e.g. what if some components will restart
670703
in the middle of rollout?
671704
The feature can result in malfunctioning control-plane components, due to the
672-
fact that it targets patching of static Pod manifests with user values.
705+
fact that it targets patching of configuration with user values.
673706
The user is responsible for configuring the control-plane correctly.
674707

675708
* **What specific metrics should inform a rollback?**
@@ -744,7 +777,7 @@ _This section must be completed when targeting beta graduation to a release._
744777
- Usage description:
745778
- Impact of its outage on the feature:
746779
- Impact of its degraded performance or high error rates on the feature:
747-
No, this feature customizes static Pod manifests for the control-plane.
780+
No, this feature customizes on top of kubeadm generated configuration.
748781

749782
### Scalability
750783

@@ -793,8 +826,8 @@ No.
793826
operations covered by [existing SLIs/SLOs][]?**
794827
Think about adding additional work or introducing new steps in between
795828
(e.g. need to do X to start a container), etc. Please describe the details.
796-
No, unless the user patches the control-plane static Pods with undesired
797-
configuration.
829+
No, unless the user patches kubeadm generated configuration with undesired
830+
settings.
798831

799832
* **Will enabling / using this feature result in non-negligible increase of
800833
resource usage (CPU, RAM, disk, IO, ...) in any components?**
@@ -803,8 +836,8 @@ configuration.
803836
volume), significant amount of data send and/or received over network, etc.
804837
This through this both in small and large cases, again with respect to the
805838
[supported limits][].
806-
No, unless the user patches the control-plane static Pods with undesired
807-
configuration.
839+
No, unless the user patches kubeadm generated configuration with undesired
840+
settings.
808841

809842
### Troubleshooting
810843

@@ -859,6 +892,9 @@ Major milestones might include
859892
- 2020-05-14: addressed feedback, filled PRR questionnaire, KEP marked as implementable
860893
- 2021-09-09: marked the feature as graduated to Beta. This was done as part of
861894
the kubeadm v1beta3 API work. The actions under "Alpha -> Beta" are completed.
895+
- 2022-05-16: adapted the KEP to be more generic, allowing support for patching
896+
any kubeadm generated configuration in the future and not only control plane component
897+
manifests. Added enumeration of supported patch targets.
862898

863899
## Drawbacks
864900

0 commit comments

Comments
 (0)