# Dynamic Kubelet Configuration

If we wish to change the kubelet configuration on a live cluster, we can use the dynamic kubelet configuration feature provided by Kubernetes. The dynamic kubelet configuration saves us the effort of bringing down a live cluster to make changes to reconfigure kubelet. The dynamic kubelet configuration is achieved via API calls or by using the command line.

On Platform9's Managed Kubernetes, separate ConfigMaps are present for both master and worker nodes on the Kubernetes control plane by default.

The kubelet on the worker nodes is automatically configured using the worker ConfigMap, and the kubelet on the master nodes is automatically configured using the master ConfigMap. We do not have to explicitly create a ConfigMap for the masters or for the worker nodes. If we need to make changes to the overall kubelet configuration, we can modify one or both of the ConfigMaps.

{% hint style="info" %}
**Note**

The name of the ConfigMap for the master in a cluster is *master-default-kubelet-config*, and the name of the ConfigMap for the worker node in a cluster is *worker-default-kubelet-config*.
{% endhint %}

Using the dynamic kubelet configuration, we can incorporate changes to one or more parameters in the ConfigMaps. All nodes running kubelet that use the configuration will detect the changes in the dynamic kubelet configuration and then integrate those changes into the ConfigMap settings and then restarts the kubelet service. Once restarted, the kubelet service uses the new configuration in the ConfigMap. For more information on dynamic kubelet configuration, refer to the [Kubernetes documentation](https://kubernetes.io/blog/2018/07/11/dynamic-kubelet-configuration/) or to the [Kubelet configuration](https://pkg.go.dev/k8s.io/kubelet/config/v1beta1?utm_source=godoc#KubeletConfiguration) documentation.

## View ConfigMap

To view ConfigMap, run the following command in the CLI.

{% tabs %}
{% tab title="Bash" %}

```bash
kubectl get configmap -n kube-system <configmap name> -o <output format>
```

{% endtab %}
{% endtabs %}

Use the following command to view the master ConfigMap in yaml format.

<figure><img src="/files/0OoDWV5qZcicWUn86WW6" alt=""><figcaption></figcaption></figure>

## Edit ConfigMap

{% hint style="warning" %}
**Warning**

Before we make a change to a ConfigMap, we must be aware of how the change may impact the function of the cluster. If the cluster fails due to a modification, the cluster will resume operation using the previous working version of the respective ConfigMap.
{% endhint %}

Run the following command to edit a ConfigMap.

{% tabs %}
{% tab title="Bash" %}

```bash
kubectl edit configmap -n kube-system <configmap name> -o <output format>
```

{% endtab %}
{% endtabs %}

To edit the ConfigMap on worker nodes, run the following command.

{% tabs %}
{% tab title="Bash" %}

```bash
kubectl edit configmap -n kube-system worker-default-kubelet-config -o yaml
```

{% endtab %}
{% endtabs %}

Edit the required parameters in the file and then save the changes.

{% hint style="info" %}
**Info**

The commands used to edit and save the file will vary depending on the editor used.
{% endhint %}

<figure><img src="/files/NXFl2fMCZjINhlXUmz31" alt=""><figcaption></figcaption></figure>

Once the changes are made and saved, the changes will take effect automatically when the respective node is discovered. No specific command need to be run for the changes to take effect.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.platform9.com/managed-kubernetes/5.7/advanced-cluster-configuration/dynamic-kubelet-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
