Set Kubelet Parameters Via A Configuration File For RKE/RKE2/K3s Clusters

This document (000021322) is provided subject to the disclaimer at the end of this document.

Environment

RKE, RKE2, K3s 

Situation

A subset of the kubelet's configuration parameters may be set via an on-disk config file, as a substitute for command-line flags. Providing parameters via a config file is the recommended approach because it simplifies node deployment and configuration management. The examples below cover adding the shutdownGracePeriod and the shutdownGracePeriodCriticalPods via the kubelet configuration file to RKE/RKE2/K3s clusters.

Resolution

Create the Kubelet configuration file with the parameters on all the nodes of the cluster. For example, create the file at /etc/kubernetes/kubeletconfig.yml

apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
shutdownGracePeriod: 30s
shutdownGracePeriodCriticalPods: 10s

 

RKE Clusters
For RKE, in the cluster.yml file, add the extra_bind to mount the file in the Kubelet and then provide the path to the configuration file as an extra_arg like the snippet below.

services:
  kubelet:
    extra_args: 
      config: /etc/kubernetes/kubeletconfig.yml
    extra_binds:
      - "/etc/kubernetes/kubeletconfig.yml:/etc/kubernetes/kubeletconfig.yml"
Run rke up for the configuration to be applied to the cluster.

RKE2/K3s Clusters
Add the configuration parameter under the Kubelet args in the config file located at /etc/rancher/{rke2|k3s}/config.yaml 
kubelet-arg:
  - "--config=/etc/kubernetes/kubeletconfig.yml"
Restart the rke2/k3s service for the configuration to be applied. 

NOTE
The Kubelet configuration file needs to be created on all the nodes of the cluster. 

 

Additional Information

https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/
https://kubernetes.io/docs/reference/config-api/kubelet-config.v1beta1/

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000021322
  • Creation Date: 14-Jan-2024
  • Modified Date:30-Jan-2024
    • SUSE Rancher

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center