> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmk/how-to/how-to-disable-and-re-enable-dynamic-kubelet-configuration.md).

# How To Disable and Re-enable Dynamic Kubelet Configuration

## Problem

If you incorrectly configure the Master node with the wrong configuration you might lose the apiserver container on the node. Because of that kubectl will no longer work and you will not be able to revert your changes.

This article will walk you through the steps to disable the Dynamic Kubelet Config, edit the Node to use the correct config map, then re-enable Dynamic Kubelet Config.

## Environment

* Platform9 Managed Kubernetes - All Versions

## Procedure

* Disable Dynamic Kubelet Config
  * Stop pf9-hostagent and pf9-nodelet
  * Make the following 2 changes to the /opt/pf9/pf9-kube/utils.sh file
    * On line 506, comment out or delete the `--dynamic-config-dir=${KUBELET_DYNAMIC_CONFIG_DIR}"` line. Be sure to correctly end the list, the last few lines should look something this: (The parameters can be different in your utils.sh file, do not make any other edits except removing the above line)

`504 --register-schedulable=false \`

`505 --pod-infra-container-image=${pause_img}"`

```
    - On line 401, change the following value to false
```

`featureGates`:

`DynamicKubeletConfig: true`

```
- Run `/opt/pf9/nodelet/nodeletd phases stop --force`

- Run `systemctl start pf9-hostagent.`
- Wait for all the phases to start running and ensure that kubectl is functional
```

* Correct the Master Configuration and Re-enabling Dynamic Kubelet Config
  * Run kubectl edit node .
  * Add the desired Config map to the node under the spec configSource section and save. Eg

`spec`:

`configSource`:

`configMap`:

`kubeletConfigKey: kubelet`

`name: master-default-kubelet-config` -> Change name here.

`namespace: kube-system`

```
- Stop pf9-hostagent and pf9-nodelet
- Run /opt/pf9/nodelet/nodeletd phases stop --force

- Revert the changes made in first 2 points of Step 1. The parameters will look like this now 
```

`504 --register-schedulable=false \ #values on this line may be different in your file`

`505 --pod-infra-container-image=${pause_img} \ #values on this line may be different in your file`

`506 --dynamic-config-dir=${KUBELET_DYNAMIC_CONFIG_DIR}"`

`413 featureGates: #line numbers may vary`

`414 DynamicKubeletConfig: true #line numbers may vary`

```
- Delete the 2 folders under /var/opt/pf9/kube/kubelet-config/dynamic-config/. This will prevent the Kubelet from picking up the previously checkpointed worker config. - Run systemctl start pf9-hostagent

- Once the pf9-nodelet service brings up the Kubernetes stack you will see that the Master node now has the updated configuration and the cluster is functioning as expected.
```

## Additional Information

* [Dynamic Kubelet Configuration](https://kubernetes.io/blog/2018/07/11/dynamic-kubelet-configuration/)
* [Reconfigure a Node's Kubelet in a Live Cluster](https://kubernetes.io/docs/tasks/administer-cluster/reconfigure-kubelet/)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://platform9.com/kb/pmk/how-to/how-to-disable-and-re-enable-dynamic-kubelet-configuration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
