Storage: Longhorn and local-path-provisioner

Give workloads persistent volumes with Longhorn or the local-path-provisioner, then prove it works with a PVC test.

  1. Choose a provisioner
  2. Install
  3. Verify
  4. Learn more

Choose a provisioner

utilities.storage.type What it installs StorageClass Good for
longhorn Longhorn (Helm) in longhorn-system, with optional iSCSI / NFS node setup longhorn Replicated block storage on K3s / RKE2 nodes
local-path Rancher local-path-provisioner (manifest) local-path Simple node-local volumes, Kind and single-node labs
utilities:
  storage:
    enable: true
    type: "longhorn"        # longhorn | local-path
    longhorn:
      setup:
        iscsi: true         # DaemonSet that prepares iSCSI on every node
        nfs: false          # DaemonSet that prepares NFS on every node
      replicaStorage: 1     # default replica count (3 for production-like clusters)
    test:
      enable: true          # nginx Pod + 2Gi RWO PVC
      namespace: "default"

[!NOTE]

Install Longhorn on K3s or RKE2 nodes. On Kind, prefer local-path: it applies Rancher’s upstream manifest, which creates the local-path StorageClass the PVC test asks for.

Install

./scripts/setup.sh k3s utils storage

Verify

With test.enable: true, the playbook applies an nginx Pod that mounts a 2Gi ReadWriteOnce PVC. The PVC asks for the StorageClass named after storage.type:

# STATUS: Bound
kubectl get pvc test-storage-pvc
# STATUS: Running
kubectl get pod volume-test
kubectl exec volume-test -- sh -c 'echo ok > /data/test && cat /data/test'

Clean up the test with kubectl delete pod volume-test && kubectl delete pvc test-storage-pvc.

Learn more


Back to top

Kubewekend is a learning and lab project: it is not hardened for production. Charts are served from this site: helm repo add kubewekend https://kubewekend.xeusnguyen.xyz