How To Change Configuration for Kubelet Service on All Worker or Master Nodes in a PMK Cluster
Problem
There is a need to change the configuration of the Kubelet service on all Worker or Master nodes and have the custom configuration(s) persist through cluster upgrades.
Environment
Platform9 Managed Kubernetes - All Versions
Kubernetes up to v1.23
Kubelet
Warning
The Dynamic kubelet configuration feature has been completely removed from Kubernetes v1.24. Therefore, the procedure below only works for Kubernetes clusters up to v1.23.
Please contact Platform9 support if you have a similar requirement for Kubernetes clusters v1.24 & higher.
Procedure
In this example, we will edit node-status-update-frequency value on the Worker Nodes.
Having scoped to the target cluster, Identify the currently set Worker and/or Master Node ConfigMap that is used to deploy the Kubelet configuration on cluster nodes.
$ kubectl get cm -n kube-system | grep -i "worker\|master"
master-default-kubelet-config 1 4d4h
worker-default-kubelet-config 1 4d4hBack up the original configmap before making changes. In this example, worker-default-kubelet-config is backed up.
Stop pf9-hostagent and pf9-nodeletd on worker or masters.
Warning
In order for this to happen safely without any intervention from other services which keeps track of the status of the pf9-kubelet service, first stop the pf9-hostagent & pf9-nodeletd services on ALL the worker or master nodes, depending on which configmap is being edited.
Example
Add the
nodeStatusUpdateFrequencyparameter to the worker configmap.
Once the change is made to the ConfigMap spec, the pf9-kubelet service will be restarted on ALL the worker nodes part of the cluster. The pf9-kubelet service will then start using the new configuration from the set ConfigMap on ALL the worker nodes part of the cluster.
Warning
The parameter name to be specified in the configuration spec may differ from its CLI counterpart. In this case, --node-status-update-frequency will have to be specified as nodeStatusUpdateFrequency.
Similar formatting style will have to be done for any other Kubelet parameter that needs to be modified using Dynamic Kubelet Configuration within PMK.
Start the pf9-hostagent service on all the worker/master nodes where the service was stopped (step #3). This will eventually start the pf9-nodeletd service.
To verify the change has taken effect, check the status of the pf9-kubelet service, and kubelet logs, on one of the cluster's worker nodes.
As expected, on restart of the service, first, the default value is loaded, i.e. --node-status-update-frequency="10s" and then the checkpoint referring to the latest configmap is sourced and loaded.
To check if the change got applied or not, you can opt to increase the logging verbosity level for the pf9-kubelet service. Reference: How To Enable Verbose Logging For Kubelet On a Node?
Now looking at the verbose logs, we see the node status is being updated every 4 seconds.
Additional Information
Info
If there is a need to make changes to the Kubelet configuration on a specific master/worker node, refer How To Change Configuration for Kubelet Service on a Single Worker or Master Node in a PMK Cluster
Last updated
