DEV Community

疏影
疏影

Posted on

Kubernetes Persistent Volumes on a NAS: Why I Stopped Using NFS for Local Dev

For a long time, my Kubernetes dev cluster used NFS for persistent volumes. NFS works. NFS is also painful — root squash, UID mapping, the occasional "stale file handle" error that takes down a pod.

This week I switched to WebDAV via ScsDriver as the underlying storage. Same NAS, same workload, zero stale handles.

This post is what I learned.

The setup

  1. Synology DSM with WebDAV enabled (port 5006)
  2. ScsDriver mounts the NAS as Z: on Windows
  3. k3d / k3s running locally with a WebDAV-backed PV

The WebDAV pod is a sidecar that serves the WebDAV mount as a local filesystem to other pods.

apiVersion: v1
kind: PersistentVolume
metadata:
  name: webdav-pv
spec:
  capacity:
    storage: 500Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: webdav
  hostPath:
    path: /mnt/webdav-share  # maps to Z:\ in the host
    type: Directory
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: webdav-pvc
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 100Gi
  storageClassName: webdav
Enter fullscreen mode Exit fullscreen mode

Why not NFS

I've used NFS for years. The pain points that pushed me to WebDAV:

  1. Stale file handle errors — when the NFS server restarts, pods that had open files get ESTALE. The pod needs a restart. In a dev cluster, that's annoying. In production, that's an outage.
  2. Root squash — by default, NFS server maps root to nobody. To run a container as root and write to the mount, you have to disable root squash or change UIDs. Workable but fiddly.
  3. Windows compatibility — NFS client on Windows is fragile. WebDAV via ScsDriver just works on Windows, macOS, Linux.

Why WebDAV via ScsDriver

For my dev cluster (k3s on Windows), ScsDriver gives me a Windows-native mount that Linux pods can read via hostPath. The mount is:

  • Kernel-level: doesn't drop on idle (NFS client on Windows does)
  • Auto-reconnect: server reboot, mount back in 5 seconds
  • Multi-platform: same WebDAV URL works on Linux, macOS, Windows

The Linux side just needs a davfs2 mount:

sudo apt install davfs2
sudo mount -t davfs https://nas:5006/dav /mnt/webdav
Enter fullscreen mode Exit fullscreen mode

What I tested

Operation NFS WebDAV via ScsDriver
Pod restart (NFS server bounce) Stale handle error, pod needs restart Auto-reconnect, no error
1 GB file write 95 MB/s 90 MB/s
1000 × 1 MB file writes 3m 20s 3m 50s
Cross-platform mount (Linux + macOS + Windows) ❌ fragile on Windows ✅ same URL works
Persistent after sleep/hibernate ❌ drops ✅ survives

The WebDAV mount is slightly slower on bulk writes, but the operational benefits (no stale handles, multi-platform, survives sleep) win.

Cost

  • NFS: free (built into Linux)
  • ScsDriver: $9.99/yr
  • davfs2: free (Linux)

For a personal dev cluster, the $9.99 is a no-brainer trade for the operational wins.

What I'd change

The bulk write performance gap is real (~5%). For heavy write workloads (CI/CD artifact uploads), NFS is still faster. WebDAV via ScsDriver is best for dev + mixed read/write workloads.

Reference


If you're running K8s locally and tired of NFS's stale handles, WebDAV via ScsDriver is a 5-minute setup that solves it.

Top comments (0)