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

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.

  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.
Set ConfigMap Output
Copy
  1. Back up the original configmap before making changes. In this example, worker-default-kubelet-config is backed up.
Backup Current ConfigMap
Copy
  1. Stop pf9-hostagent and pf9-nodeletd on worker or masters.

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.

Command
Copy

Example

  1. Add the nodeStatusUpdateFrequency parameter to the worker configmap.
ConfigMap Edit
Copy
ConfigMap Output Post Modification
Copy

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.

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.

  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.
Command
Copy
  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.
Example Kubelet Service Status
Copy
Example Kubelet Log
Copy

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.

Example: /var/log/pf9/kubelet/kubelet.INFO
Copy

Additional Information

Kubelet Options

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

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard