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

circle-exclamation

Procedure

In this example, we will edit node-status-update-frequency value on the Worker Nodes.

  1. 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 4d4h
  1. Back up the original configmap before making changes. In this example, worker-default-kubelet-config is backed up.

  1. Stop pf9-hostagent and pf9-nodeletd on worker or masters.

circle-exclamation

Example

  1. Add the nodeStatusUpdateFrequency parameter 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.

circle-exclamation
  1. 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.

  1. 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?arrow-up-right

Now looking at the verbose logs, we see the node status is being updated every 4 seconds.

Additional Information

circle-info

Info

Kubelet Optionsarrow-up-right

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 Clusterarrow-up-right

Last updated