Local Path Provisioner

k3s ships a default storage class that creates volumes on the node's local disk automatically.

Kubernetes uses PersistentVolumes to give Pods durable storage. k3s bundles the local-path-provisioner, which is set as the default StorageClass. When you ask for storage, it carves out a folder on the node's disk and hands it to your Pod.

Good to know

  • Data lives under /var/lib/rancher/k3s/storage on the node.
  • It is node-local: a Pod using it is tied to the node that holds its data.
  • Perfect for single-node clusters, databases in dev, and edge devices.

Example

Example · bash
# The default storage class is already there
kubectl get storageclass

# NAME                   PROVISIONER             DEFAULT
# local-path (default)   rancher.io/local-path   true

When to use it

  • A developer deploys a single-node k3s cluster for testing and lets the local-path provisioner automatically create PV directories under /var/lib/rancher/k3s.
  • A small team runs a self-hosted GitLab on k3s and uses local-path storage for the PostgreSQL volume without configuring external storage.
  • An edge site uses the local-path provisioner to persist configuration data for a monitoring pod directly on the NVMe drive of the edge server.

More examples

Check the default storage class

Lists storage classes to confirm local-path is installed and set as the cluster default by k3s.

Example · bash
kubectl get storageclass
# local-path is the default (annotated storageclass.kubernetes.io/is-default-class=true)

Inspect provisioner configuration

Reads the local-path-config ConfigMap to see which host directory is used as the root for provisioned volumes.

Example · bash
kubectl get configmap local-path-config -n kube-system -o yaml
# Shows the base path where volumes are created on the node

Change the provisioner base path

Edits the ConfigMap to redirect new PV directories to a specific mount point such as an attached SSD.

Example · bash
kubectl edit configmap local-path-config -n kube-system
# Change: "nodePathMap": [{"node":"DEFAULT_PATH_FOR_NON_LISTED_NODES","paths":["/mnt/data"]}]

Discussion

  • Be the first to comment on this lesson.