Deckhouse Kubernetes Platform provides the ability to configure local storage using Local Path Provisioner. This is a simple solution without support for snapshots or volume size limits, best suited for development, testing, and small clusters. It uses local disk space on Kubernetes nodes to create PersistentVolumes without relying on external storage systems.

How it works

For each LocalPathProvisioner resource, a corresponding StorageClass object is created. The list of nodes allowed to use the StorageClass is defined by the nodeGroups field and is used when scheduling pods.

When a pod requests a disk, the following occurs:

  • A PersistentVolume of type HostPath is created;
  • A directory is created on the appropriate node, with the path generated from the path parameter, the PV name, and the PVC name.

Example path:

/opt/local-path-provisioner/pvc-d9bd3878-f710-417b-a4b3-38811aa8aac1_d8-monitoring_prometheus-main-db-prometheus-main-0

Limitations

  • It is not possible to set a size limit for created volumes.

Example LocalPathProvisioner resources

ReclaimPolicy: Retain (default)

apiVersion: deckhouse.io/v1alpha1
kind: LocalPathProvisioner
metadata:
  name: localpath-system
spec:
  nodeGroups:
  - system
  path: "/opt/local-path-provisioner"

ReclaimPolicy: Delete

apiVersion: deckhouse.io/v1alpha1
kind: LocalPathProvisioner
metadata:
  name: localpath-system
spec:
  nodeGroups:
  - system
  path: "/opt/local-path-provisioner"
  reclaimPolicy: "Delete"

Configuring Prometheus to use local storage

  1. Apply the LocalPathProvisioner resource:

    apiVersion: deckhouse.io/v1alpha1
    kind: LocalPathProvisioner
    metadata:
      name: localpath-system
    spec:
      nodeGroups:
      - system
      path: "/opt/local-path-provisioner"
    
  2. Ensure that spec.nodeGroups matches the NodeGroup where Prometheus will be running.

  3. Specify the name of the created StorageClass in the Prometheus configuration:

    longtermStorageClass: localpath-system
    storageClass: localpath-system
    
  4. Wait for Prometheus pods to restart.