Skip to main content
Using local storage for Kubernetes workloads implies that the pod will be bound to the node where the local storage is available. Local storage is not replicated, so in case of a machine failure contents of the local storage will be lost.

User volumes

The simplest way to use local storage is to use user volume. Once the user volume is created, it is automatically mounted under /var/mnt/u-<user-volume-name> path on the node. For example, create a configuration patch for a user volume named local-storage:
local-storage.yaml
Apply the patch to the machine configuration:
If there is enough space available on a non-system disk (see diskSelector), the user volume will be created and mounted under /var/mnt/u-local-storage path on the node.
Now you can use the /var/mnt/local-storage path in your Kubernetes manifests to refer to the local storage:

Local path provisioner

Local Path Provisioner can be used to dynamically provision local storage. First, we will create a separate user volume for the Local Path Provisioner to use. Apply the following machine configuration patch:
Ensure that you have enough space available to provision the user volume.
Make sure to update Local Path Provisioner configuration to use the user volume path /var/mnt/local-path-provisioner as the root path for the local storage. For example, Local Path Provisioner can be installed using kustomize with the following configuration:
kustomization.yaml
Put kustomization.yaml into a new directory, and run kustomize build | kubectl apply -f - to install Local Path Provisioner to a Talos Linux cluster. There are three patches applied:
  • change default /opt/local-path-provisioner path to /var/mnt/local-path-provisioner
  • make local-path storage class the default storage class (optional)
  • label the local-path-storage namespace as privileged to allow privileged pods to be scheduled there
To test the Local Path Provisioner, you can refer to the Usage section of the official guide. You can check that directories for PVCs are created on the node’s filesystem with the talosctl ls /var/mnt/local-path-provisioner command.