From fefcf469226ca245dfd7d30ba0d7cfed208bbeb0 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Mon, 13 Jun 2022 15:43:44 +0300 Subject: [PATCH] kubeadm: document the option to use kubeletconfiguration patches The 'kubeletconfiguration' patch target is a new one in 1.25. It allows to apply instance-specific configuration to kubelets in a kubeadm cluster by patching the base KubeletConfiguration object that is shared by all nodes. --- .../tools/kubeadm/control-plane-flags.md | 33 ++++++++++--------- .../tools/kubeadm/kubelet-integration.md | 13 ++++---- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/content/en/docs/setup/production-environment/tools/kubeadm/control-plane-flags.md b/content/en/docs/setup/production-environment/tools/kubeadm/control-plane-flags.md index f15315f3ad..6b3724c8f7 100644 --- a/content/en/docs/setup/production-environment/tools/kubeadm/control-plane-flags.md +++ b/content/en/docs/setup/production-environment/tools/kubeadm/control-plane-flags.md @@ -134,13 +134,13 @@ etcd: election-timeout: 1000 ``` -## Customizing the control plane with patches {#patches} +## Customizing with patches {#patches} {{< feature-state for_k8s_version="v1.22" state="beta" >}} Kubeadm allows you to pass a directory with patch files to `InitConfiguration` and `JoinConfiguration` -on individual nodes. These patches can be used as the last customization step before the control -plane component manifests are written to disk. +on individual nodes. These patches can be used as the last customization step before component configuration +is written to disk. You can pass this file to `kubeadm init` with `--config `: @@ -168,7 +168,8 @@ patches: The directory must contain files named `target[suffix][+patchtype].extension`. For example, `kube-apiserver0+merge.yaml` or just `etcd.json`. -- `target` can be one of `kube-apiserver`, `kube-controller-manager`, `kube-scheduler` and `etcd`. +- `target` can be one of `kube-apiserver`, `kube-controller-manager`, `kube-scheduler`, `etcd` +and `kubeletconfiguration`. - `patchtype` can be one of `strategic`, `merge` or `json` and these must match the patching formats [supported by kubectl](/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch). The default `patchtype` is `strategic`. @@ -183,20 +184,22 @@ flag, which must point to the same directory. `kubeadm upgrade` currently does n API structure that can be used for the same purpose. {{< /note >}} -## Customizing the kubelet +## Customizing the kubelet {#kubelet} -To customize the kubelet you can add a `KubeletConfiguration` next to the `ClusterConfiguration` or -`InitConfiguration` separated by `---` within the same configuration file. This file can then be passed to `kubeadm init`. +To customize the kubelet you can add a [`KubeletConfiguration`](/docs/reference/config-api/kubelet-config.v1beta1/) +next to the `ClusterConfiguration` or `InitConfiguration` separated by `---` within the same configuration file. +This file can then be passed to `kubeadm init` and kubeadm will apply the same base `KubeletConfiguration` +to all nodes in the cluster. -{{< note >}} -kubeadm applies the same `KubeletConfiguration` to all nodes in the cluster. To apply node -specific settings you can use kubelet flags as overrides by passing them in the `nodeRegistration.kubeletExtraArgs` -field supported by both `InitConfiguration` and `JoinConfiguration`. Some kubelet flags are deprecated, -so check their status in the [kubelet reference documentation](/docs/reference/command-line-tools-reference/kubelet) -before using them. -{{< /note >}} +For applying instance-specific configuration over the base `KubeletConfiguration` you can use the +[`kubeletconfiguration` patch target](#patches). -For more details see [Configuring each kubelet in your cluster using kubeadm](/docs/setup/production-environment/tools/kubeadm/kubelet-integration) +Alternatively, you can use kubelet flags as overrides by passing them in the +`nodeRegistration.kubeletExtraArgs` field supported by both `InitConfiguration` and `JoinConfiguration`. +Some kubelet flags are deprecated, so check their status in the +[kubelet reference documentation](/docs/reference/command-line-tools-reference/kubelet) before using them. + +For additional details see [Configuring each kubelet in your cluster using kubeadm](/docs/setup/production-environment/tools/kubeadm/kubelet-integration) ## Customizing kube-proxy diff --git a/content/en/docs/setup/production-environment/tools/kubeadm/kubelet-integration.md b/content/en/docs/setup/production-environment/tools/kubeadm/kubelet-integration.md index 63c1f718ab..13814f4117 100644 --- a/content/en/docs/setup/production-environment/tools/kubeadm/kubelet-integration.md +++ b/content/en/docs/setup/production-environment/tools/kubeadm/kubelet-integration.md @@ -87,20 +87,21 @@ networking, or other host-specific parameters. The following list provides a few - To specify the container runtime you must set its endpoint with the `--container-runtime-endpoint=` flag. -You can specify these flags by configuring an individual kubelet's configuration in your service manager, -such as systemd. +The recommended way of applying such instance-specific configuration is by using +[`KubeletConfiguration` patches](/docs/setup/production-environment/tools/kubeadm/control-plane-flags#patches). ## Configure kubelets using kubeadm -It is possible to configure the kubelet that kubeadm will start if a custom `KubeletConfiguration` +It is possible to configure the kubelet that kubeadm will start if a custom +[`KubeletConfiguration`](/docs/reference/config-api/kubelet-config.v1beta1/) API object is passed with a configuration file like so `kubeadm ... --config some-config-file.yaml`. By calling `kubeadm config print init-defaults --component-configs KubeletConfiguration` you can see all the default values for this structure. -Also have a look at the -[reference for the KubeletConfiguration](/docs/reference/config-api/kubelet-config.v1beta1/) -for more information on the individual fields. +It is also possible to apply instance-specific patches over the base `KubeletConfiguration`. +Have a look at [Customizing the kubelet](/docs/setup/production-environment/tools/kubeadm/control-plane-flags#kubelet) +for more details. ### Workflow when using `kubeadm init`