Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Bannister <[email protected]>
  • Loading branch information
SergeyKanzhelev and sftim authored Aug 13, 2024
1 parent a2952a1 commit 472dc7c
Showing 1 changed file with 31 additions and 15 deletions.
46 changes: 31 additions & 15 deletions content/en/docs/reference/node/kubelet-files.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
---
content_type: "reference"
title: Files written and read by the kubelet
title: Local Files And Paths Used By The Kubelet
weight: 42
---

The {{< glossary_tooltip text="kubelet" term_id="kubelet" >}} is mostly a stateless
process running on a Kubernetes {{< glossary_tooltip text="node" term_id="node" >}}.
This document outlines files that kubelet reads and writes.

Kubelet uses the {{< glossary_tooltip text="control plane" term_id="control-plane" >}} as
The kubelet typically uses the {{< glossary_tooltip text="control plane" term_id="control-plane" >}} as
the source of truth on what needs to run on the Node, and the
{{<glossary_tooltip text="container runtime" term_id="container-runtime">}} to retrieve
the current state of containers. Kubelet also relies on reading
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 the kubelet also relies on reading
cgroups and various system files to collect metrics. However, there are still a few other files
that are used by the kubelet.

Expand Down Expand Up @@ -50,8 +52,9 @@ Location can be configured using the `staticPodPath` kubelet configuration optio
#### Checkpoint files

All resource managers keep the mapping of Pods to allocated resources in state files.
State files located in the kubelet's root directory,
typically `/var/lib/kubelet`. Kubelet root directory can be configured
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:
Expand All @@ -61,17 +64,19 @@ Names of files:
- `kubelet_internal_checkpoint` for Device Manager
- `dra_manager_state` for DRA

#### Pod Status checkpoint
#### Pod status checkpoint storage {#pod-status-manager-state}

{{< feature-state feature_gate_name="InPlacePodVerticalScaling" >}}

The pod status is being checkpointed to implement the Pod resize feature.
The file name is `pod_status_manager_state` in kubelet root directory
(`/var/lib/kubelet` or configure using `--root-dir`).
The file name is `pod_status_manager_state` within the kubelet base directory
(`/var/lib/kubelet` by default on Linux; configurable using `--root-dir`).

### Sockets

Kubelet opens a few sockets as well as reading some other sockets.
The 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.

#### Container runtime

Expand All @@ -85,24 +90,35 @@ The actual values of those endpoints depend on the container runtime being used.

#### Device plugins

Kubelet exposes socket `/var/lib/kubelet/device-plugins/kubelet.sock` for
The kubelet exposes a socket at the path `/var/lib/kubelet/device-plugins/kubelet.sock` for
various [Device Plugins to register](/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-implementation).

When a device plugin registers itself, it provides its socket path for the kubelet to connect.

The device plugin socket should be in the directory `/var/lib/kubelet/device-plugins`.
The device plugin socket should be in the directory `device-plugins` within the kubelet base
directory. On a typical Linux node, this means `/var/lib/kubelet/device-plugins`.

#### Pod Resources API
#### Pod resources API

[Pod Resources API](/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#monitoring-device-plugin-resources)
will be exposed at the address `/var/lib/kubelet/pod-resources`.
will be exposed at the path `/var/lib/kubelet/pod-resources`.

#### DRA and CSI plugins

DRA and CSI plugins are located in `plugins_registry` in kubelet's root directory
The kubelet looks for socket files created by device or storage plugins, and then attempts to connect
to these sockets. The directory that the kubelet looks in is `plugins_registry` within the kubelet base
directory, so on a typical Linux node this means `/var/lib/kubelet/plugins_registry`.

The types of plugins that can place socket files into that directory are:

- CSI plugins
- DRA plugins
(typically `/var/lib/kubelet/plugins_registry`).

### Utility
### Locking

{{< feature-state state="alpha" for_k8s_version="v1.2" >}}


Kubelet lock file, typically `/var/run/kubelet.lock`,
can be configured using the `--lock-file` kubelet command line argument.
Expand Down

0 comments on commit 472dc7c

Please sign in to comment.