book
  • README
  • cheatsheet
    • bash
      • builtin
      • syntactic sugar
      • cmd
      • havefun
    • text-processing
      • awk
      • sed
      • html
      • json
      • regex
      • unicode
    • osx
    • curl
    • tricky
    • widget
    • proxy
    • colors
    • math
    • media
    • ssl
      • keystore
      • verification
      • server
      • client
      • tricky
    • windows
      • powershell
      • choco
      • wsl
      • wt
      • shortcut
      • clsid
      • env
      • shell:folder
  • vim
    • nvim
    • install
    • color
    • plugins
      • usage
      • other plugins
      • deprecated
    • tricky
    • viml
    • windows
    • troubleshooting
  • devops
    • admin tools
    • ssh
    • git
      • config
      • alias
      • submodule
      • eol
      • example
      • gerrit
        • gerrit API
      • github
      • troubleshooting
      • tricky
      • statistics
    • pre-commit
    • release-tools
    • tmux
      • cheatsheet
    • ansible
    • vault
    • artifactory
      • api
      • cli
      • aql
      • nginx cert
    • klocwork
      • kwadmin
      • kwserver
      • api
      • q&a
    • elk
    • mongodb
    • android
    • mobile
  • jenkins
    • config
      • windows
    • appearance
    • troubleshooting
    • jenkinsfile
      • utility
      • parallel
      • build
      • envvar
      • properties
      • trigger
      • node
    • script
      • job
      • build
      • stage
      • agent
      • security & authorization
      • exception
      • monitor
      • tricky
    • api
      • blueocean
    • cli
    • plugins
      • kubernetes
      • docker
      • shared-libs
      • lockable-resource
      • ansicolor
      • badge
      • groovy-postbuild
      • simple-theme
      • customizable-header
      • artifactory
      • jira-steps
      • job-dsl
      • build-timeline
      • crumbIssuer
      • coverage
      • uno-choice
      • tricky
  • virtualization
    • kubernetes
      • init
        • kubespray
        • kubeadm
          • environment
          • crio v1.30.4
          • docker v1.15.3
          • HA
        • addons
        • etcd
      • kubectl
        • pod
        • deploy
        • replicasets
        • namespace
        • secrets
      • node
      • certificates
      • events
      • kubeconfig
      • kubelet
      • troubleshooting
      • cheatsheet
      • auth
      • api
      • tools
        • monitor
        • helm
        • network
        • minikube
    • docker
      • run & exec
      • voume
      • remove
      • show info
      • dockerfile
      • dockerd
      • tricky
      • troubleshooting
      • windows
    • crio
    • podman
  • ai
    • prompt
  • osx
    • apps
      • init
      • brew
    • defaults
    • system
    • network
    • script
    • tricky
  • linux
    • devenv
    • util
      • time & date
      • output formatting
      • params
      • tricky
    • nutshell
    • disk
    • network
    • troubleshooting
    • system
      • apt/yum/snap
      • authorization
      • apps
      • x11
    • ubuntu
      • systemctl
      • x
    • rpi
  • programming
    • groovy
    • python
      • config
      • basic
      • list
      • pip
      • q&a
    • others
    • archive
      • angular
      • maven
      • mysql
        • installation
        • logs
      • ruby
        • rubyInstallationQ&A
  • tools
    • fonts
    • html & css
    • Jira & Confluence
    • node & npm
      • gitbook
      • hexo
      • github.page
      • code themes
    • app
      • microsoft office
      • vscode
      • virtualbox
      • iterm2
      • browser
      • skype
      • teamviewer
      • others
  • quotes
  • english
Powered by GitBook
On this page
  • configuration files
  • kuabelet configration
  • config files

Was this helpful?

  1. virtualization
  2. kubernetes

kubelet

PreviouskubeconfigNexttroubleshooting

Last updated 1 year ago

Was this helpful?

references:

systemd

  • service configure :

    • v1.12.3: /etc/systemd/system/kubelet.service.d/10-kubeadm.conf

    • v1.9.16: /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf

    • check via:

      $ sudo systemctl status kubelet.service
      ● kubelet.service - kubelet: The Kubernetes Node Agent
         Loaded: loaded (/usr/local/lib/systemd/system/kubelet.service; enabled; vendor preset: disabled)
        Drop-In: /usr/lib/systemd/system/kubelet.service.d
                 └─10-kubeadm.conf
         Active: active (running) since Fri 2023-06-23 17:04:07 PDT; 7min ago
  • environment file : /etc/sysconfig/kubelet

kubelet

  • kubeconfig, kubelet configuration file :

    • /etc/kubernetes/kubelet.conf

  • kubeConfig file to use for the TLS Bootstrap, (it is only used if /etc/kubernetes/kubelet.conf does not exist):

    • /etc/kubernetes/bootstrap-kubelet.conf

  • file containing the kubelet's ComponentConfig, workflow in kubelet init :

    • /var/lib/kubelet/config.yaml

  • dynamic environment file that contains KUBELET_KUBEADM_ARGS :

    • /var/lib/kubelet/kubeadm-flags.env

  • user-specified flag overrides with KUBELET_EXTRA_ARGS :

    • /etc/default/kubelet (for DEBs)

    • /etc/sysconfig/kubelet (for RPMs)

modfiy /var/lib/kubelet

  • $ sudo systemctl stop kubelet
    $ sudo echo 'KUBELET_EXTRA_ARGS=--root-dir=/mnt/kubelet' > /etc/sysconfig/kubelet
    $ sudo systemctl daemon-reload
    $ sudo systemctl start kubelet

kuabelet configration

[!TIP] references:

    • --root-dir string Default: /var/lib/kubelet

$ cat /etc/sysconfig/kubelet
KUBELET_EXTRA_ARGS=--root-dir=/path/to/extra/folder

$ grep EnvironmentFile /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
EnvironmentFile=-/etc/sysconfig/kubelet

$ systemctl daemon-reload
$ systemctl enable kubelet --now
$ systemctl start kubelet
  • because of

    $ grep '/etc/sysconfig/kubelet' /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
    EnvironmentFile=-/etc/sysconfig/kubele
    
    $ ps auxfww | grep kubelet
    root        2262  2.5  0.0 6830176 143332 ?      Ssl  13:01   2:26 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --cgroup-driver=cgroupfs --network-plugin=cni --root-dir=/home/kubelet
  • $ sudo systemctl stop kubelet
    $ mkdir -p /mnt/kubelet
    $ sudo cp -r /var/lib/kubelet/* /mnt/kubelet/
    $ sudo mv /var/lib/kubelet{,.backup}
    $ sudo ln -sf /mnt/kueblet /var/lib/kubelet
    $ sudo systemctl daemon-reload
    $ sudo systemctl start kubelet
  • $ cat /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
    ...
    Environment="KUBELET_EXTRA_ARGS=$KUBELET_EXTRA_ARGS --root-dir=/path/to/extra/folder"
    ...

config files

/etc/systemd/system/kubelet.service.d/10-kubeadm.conf

[!TIP] This file specifies the default locations for all of the files managed by kubeadm for the kubelet.

  • The KubeConfig file to use for the TLS Bootstrap is /etc/kubernetes/bootstrap-kubelet.conf, but it is only used if /etc/kubernetes/kubelet.conf does not exist.

  • The KubeConfig file with the unique kubelet identity is /etc/kubernetes/kubelet.conf.

  • The file containing the kubelet's ComponentConfig is /var/lib/kubelet/config.yaml.

  • The dynamic environment file that contains KUBELET_KUBEADM_ARGS is sourced from /var/lib/kubelet/kubeadm-flags.env.

  • The file that can contain user-specified flag overrides with KUBELET_EXTRA_ARGS is sourced from /etc/default/kubelet (for DEBs), or /etc/sysconfig/kubelet (for RPMs). KUBELET_EXTRA_ARGS is last in the flag chain and has the highest priority in the event of conflicting settings.

$ cat /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
# Note: This dropin only works with kubeadm and kubelet v1.11+
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/sysconfig/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS

or

:

KUBELET_EXTRA_ARGS
kubelet flag
change kubelet root dir
symolic link
or add KUBELET_EXTRA_ARGS
The kubelet drop-in file for systemd
Kubelet Configuration (v1beta1)
* Install and Set Up kubectl on Linux
how to change kubelet working dir to somewhere else
Reconfiguring Kubelet in a live cluster
configuration files
configuration files
systemd
kubelet
modfiy /var/lib/kubelet
kuabelet configration
change kubelet root dir
config files
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf