Dynamic Kubelet Configuration with Platform9 Managed Kubernetes
If you wish to change the kubelet configuration for a live cluster, you can use the dynamic kubelet configuration feature provided by Kubernetes.
Dynamic kubelet configuration saves the effort of bringing down a live cluster to make changes to reconfigure kubelet.
Dynamic kubelet configuration is done through API calls or by using the command line.
Separate ConfigMaps are present for masters and worker nodes on the Kubernetes control plane, by default, for Platform9 Managed Kubernetes.
The kubelet on the worker nodes is automatically configured with the worker ConfigMap, and the kubelet on the master nodes is automatically configured with the master ConfigMap. You do not have to explicitly create a ConfigMap for the masters or for the worker nodes.
However, you can modify one or both of the ConfigMaps, if you wish to make changes to the kubelet configuration.
Dynamic kubelet configuration comprises making changes to one or more parameters in a ConfigMap. Kubelet on all nodes associated with the ConfigMap detects changes in the ConfigMap, after which the kubelet service restarts. On restart, the kubelet service starts up with the new configuration in the ConfigMap. For more information on dynamic kubelet configuration, refer to Kubernetes documentation.
To view ConfigMap, run the following command on the CLI.
kubectl get configmap -n kube-system <configmap name> -o <output format>
For example, use the following command to view the master ConfigMap in yaml format.
To edit a ConfigMap, run the following command on the CLI.
kubectl edit configmap -n kube-system <configmap name> -o <output format>
For example, run the following command to edit the ConfigMap for worker nodes.
kubectl edit configmap -n kube-system worker-default-kubelet-config -o yaml
You can edit the required parameters in the file and save the file. The commands to edit and save the file would depend on the editor that you would use to edit your file, for example, vim editor.
Once the changes are saved to the file, the changes take effect automatically when the respective node is discovered. You do not have to run any specific command for the changes to take effect.