⎈ k8s knowledge compiler

Local Files And Paths Used By The Kubelet [page]deterministic

reference

The [kubelet](#gloss:kubelet) is mostly a stateless process running on a Kubernetes [node](#gloss:node). This document outlines files that kubelet reads and writes.

> Note: This document is for informational purpose and not describing any guaranteed behaviors or APIs. It lists resources used by the kubelet, which is an implementation detail and a subject to change at any release.

The kubelet typically uses the [control plane](#gloss:control-plane) as the source of truth on what needs to run on the Node, and the [container runtime](#gloss:container-runtime) to retrieve the current state of containers. So long as you provide a _kubeconfig_ (API client configuration) to the kubelet, the kubelet does connect to your control plane; otherwise the node operates in _standalone mode_.

On Linux nodes, the kubelet also relies on reading cgroups and various system files to collect metrics.

On Windows nodes, the kubelet collects metrics via a different mechanism that does not rely on paths.

There are also a few other files that are used by the kubelet as well, as kubelet communicates using local Unix-domain sockets. Some are sockets that the kubelet listens on, and for other sockets the kubelet discovers them and then connects as a client.

> Note: This page lists paths as Linux paths, which map to the Windows paths by adding a root disk `C:\` in place of `/` (unless specified otherwise). For example, `/var/lib/kubelet/device-plugins` maps to `C:\var\lib\kubelet\device-plugins`.

## Configuration

### Kubelet configuration files

The path to the kubelet configuration file can be configured using the command line argument `--config`. The kubelet also supports [drop-in configuration files](/docs/tasks/administer-cluster/kubelet-config-file/#kubelet-conf-d) to enhance configuration.

### Certificates

Certificates and private keys are typically located at `/var/lib/kubelet/pki`, but can be configured using the `--cert-dir` kubelet command line argument. Names of certificate files are also configurable.

### Manifests

Manifests for static pods are typically located in `/etc/kubernetes/manifests`. Location can be configured using the `staticPodPath` kubelet configuration option.

### Systemd unit settings

When kubelet is running as a systemd unit, some kubelet configuration may be declared in systemd unit settings file. Typically it includes:

  • command line arguments to [run kubelet](/docs/reference/command-line-tools-reference/kubelet/)
  • environment variables, used by kubelet or [configuring golang runtime](https://pkg.go.dev/runtime#hdr-Environment_Variables)

## State

### Checkpoint files for resource managers {#resource-managers-state}

All resource managers keep the mapping of Pods to allocated resources in state files. State files are located in the kubelet's base directory, also termed the _root directory_ (but not the same as `/`, the node root directory). You can configure the base directory for the kubelet using the kubelet command line argument `--root-dir`.

Names of files:

  • `memory_manager_state` for the [Memory Manager](/docs/tasks/administer-cluster/memory-manager/)
  • `cpu_manager_state` for the [CPU Manager](/docs/tasks/administer-cluster/cpu-management-policies/)
  • `dra_manager_state` for [DRA](/docs/concepts/scheduling-eviction/dynamic-resource-allocation/)

### Checkpoint file for device manager {#device-manager-state}

Device manager creates checkpoints in the same directory with socket files: `/var/lib/kubelet/device-plugins/`. This path is hardcoded and is not relative to the kubelet root directory. The name of a checkpoint file is `kubelet_internal_checkpoint` for [Device Manager](/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-integration-with-the-topology-manager)

### Pod resource checkpoints

If a node has enabled the `InPlacePodVerticalScaling`[feature gate](/docs/reference/command-line-tools-reference/feature-gates/), the kubelet stores a local record of _ …(trimmed)

Sources

reference/node/kubelet-files.md · docLocal Files And Paths Used By The Kubelet

Related (24)

references Kubeletkubelet conf=1
references Nodenode conf=1
references Control Planecontrol plane conf=1
references Container Runtimecontainer runtime conf=1
part_of Configurationdescribes conf=1
part_of Statedescribes conf=1
part_of Security profiles & configurationdescribes conf=1
part_of Lockingdescribes conf=1
part_of {{% heading "whatsnext" %}}describes conf=1
part_of Kubelet configuration filesdescribes conf=1
part_of Certificatesdescribes conf=1
part_of Manifestsdescribes conf=1
part_of Systemd unit settingsdescribes conf=1
part_of Pod resource checkpointsdescribes conf=1
part_of Container runtimedescribes conf=1
part_of Device Pluginsdescribes conf=1
part_of Pod resources APIdescribes conf=1
part_of DRA, CSI, and Device pluginsdescribes conf=1
part_of Graceful node shutdowndescribes conf=1
part_of Image Pull Recordsdescribes conf=1
part_of seccompdescribes conf=1
part_of AppArmordescribes conf=1

← all Docs