From 282d5a7ea7efbae0114935d04bc1f5f38d17f077 Mon Sep 17 00:00:00 2001 From: xenolinux Date: Thu, 23 Jan 2025 16:46:37 +0530 Subject: [PATCH] OSDOCS#12977: Reference the config map in node pools --- hosted_control_planes/hcp-machine-config.adoc | 7 +++ modules/configuring-node-pools-for-hcp.adoc | 7 ++- modules/hcp-kubeconf-nodepool.adoc | 62 +++++++++++++++++++ 3 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 modules/hcp-kubeconf-nodepool.adoc diff --git a/hosted_control_planes/hcp-machine-config.adoc b/hosted_control_planes/hcp-machine-config.adoc index b7b66f1198..4434735c58 100644 --- a/hosted_control_planes/hcp-machine-config.adoc +++ b/hosted_control_planes/hcp-machine-config.adoc @@ -8,6 +8,11 @@ toc::[] In a standalone {product-title} cluster, a machine config pool manages a set of nodes. You can handle a machine configuration by using the `MachineConfigPool` custom resource (CR). +[TIP] +==== +You can reference any `machineconfiguration.openshift.io` resources in the `nodepool.spec.config` field of the `NodePool` CR. +==== + In {hcp}, the `MachineConfigPool` CR does not exist. A node pool contains a set of compute nodes. You can handle a machine configuration by using node pools. [NOTE] @@ -17,6 +22,8 @@ In {product-title} 4.18 or later, the default container runtime for worker nodes include::modules/configuring-node-pools-for-hcp.adoc[leveloffset=+1] +include::modules/hcp-kubeconf-nodepool.adoc[leveloffset=+1] + include::modules/node-tuning-hosted-cluster.adoc[leveloffset=+1] include::modules/sriov-operator-hosted-control-planes.adoc[leveloffset=+1] diff --git a/modules/configuring-node-pools-for-hcp.adoc b/modules/configuring-node-pools-for-hcp.adoc index 42c3c1cdc3..bd97c1a3b0 100644 --- a/modules/configuring-node-pools-for-hcp.adoc +++ b/modules/configuring-node-pools-for-hcp.adoc @@ -21,7 +21,7 @@ On {hcp}, you can configure node pools by creating a `MachineConfig` object insi apiVersion: v1 kind: ConfigMap metadata: - name: + name: namespace: clusters data: config: | @@ -30,7 +30,7 @@ data: metadata: labels: machineconfiguration.openshift.io/role: worker - name: + name: spec: config: ignition: @@ -64,9 +64,10 @@ metadata: # ... spec: config: - - name: ${configmap-name} + - name: <1> # ... ---- +<1> Replace `` with the name of your config map. //.Verification diff --git a/modules/hcp-kubeconf-nodepool.adoc b/modules/hcp-kubeconf-nodepool.adoc new file mode 100644 index 0000000000..870199baf8 --- /dev/null +++ b/modules/hcp-kubeconf-nodepool.adoc @@ -0,0 +1,62 @@ +// Module included in the following assemblies: +// +// * hosted_control_planes/hcp-machine-config.adoc + +:_mod-docs-content-type: PROCEDURE +[id="hcp-kubeconf-nodepool_{context}"] += Referencing the kubelet configuration in node pools + +To reference your kubelet configuration in node pools, you add the kubelet configuration in a config map and then apply the config map in the `NodePool` resource. + +.Procedure + +. Add the kubelet configuration inside of a config map in the management cluster by entering the following information: ++ +.Example `ConfigMap` object with the kubelet configuration +[source,yaml] +---- +apiVersion: v1 +kind: ConfigMap +metadata: + name: <1> + namespace: clusters +data: + config: | + apiVersion: machineconfiguration.openshift.io/v1 + kind: KubeletConfig + metadata: + name: <2> + spec: + kubeletConfig: + registerWithTaints: + - key: "example.sh/unregistered" + value: "true" + effect: "NoExecute" +---- +<1> Replace `` with the name of your config map. +<2> Replace `` with the name of the `KubeletConfig` resource. + +. Apply the config map to the node pool by entering the following command: ++ +[source,yaml] +---- +$ oc edit nodepool --namespace clusters <1> +---- +<1> Replace `` with the name of your node pool. ++ +.Example `NodePool` resource configuration +[source,yaml] +---- +apiVersion: hypershift.openshift.io/v1alpha1 +kind: NodePool +metadata: +# ... + name: nodepool-1 + namespace: clusters +# ... +spec: + config: + - name: <1> +# ... +---- +<1> Replace `` with the name of your config map.