Skip to content

Synology NAS Setup — Storage for K8s (10.2.10.19)

Prerequisites

  • Synology DSM 7.x
  • BTRFS filesystem
  • Two available disk groups / storage pools for volume3 (1TB) and volume4 (2TB)

Part A — Synology CSI Driver (iSCSI — Cluster-Managed Storage)

The Synology CSI driver lets the k8s cluster dynamically create, resize, and snapshot block volumes (iSCSI LUNs) on the NAS. Existing NFS shares and volumes are not affected — LUNs are stored under /volumeN/@iSCSI/ (hidden dir).

A1. Create DSM User k8s-csi

  1. Control Panel → User & Group → Create
  2. Username: k8s-csi
  3. Password: strong random (store in vault/sealed-secret)
  4. User group: users only — NOT administrators
  5. Application Permissions → set everything to Deny except:
  6. DSM → Allow (required for API login)
  7. iSCSI Manager (or "SAN Manager" on newer DSM) → Allow
  8. Shared Folder PermissionsNo Access on ALL shared folders (k8s-apps, k8s-backups, homes, etc.)
  9. Speed Limit / Quota → optionally set a storage quota

A2. Enable iSCSI Service

  1. SAN Manager (install from Package Center if missing)
  2. iSCSI tab → Ensure iSCSI service is Enabled
  3. No need to create targets/LUNs manually — the CSI driver handles this

A3. Firewall — Restrict API Access

  1. Control Panel → Security → Firewall → Edit Rules
  2. Add rule: Allow ports 5000-5001 (DSM) + 3260 (iSCSI) from:
  3. 10.2.20.200 (k8s-cp-office-1)
  4. 10.2.20.100 (k8s-worker-office-1)
  5. 10.2.20.101 (k8s-worker-office-2)
  6. Deny all other sources for these ports

A4. Seal the DSM Credentials

# On k8s-cp-office-1:
cat <<'EOF' | kubeseal \
  --controller-name sealed-secrets \
  --controller-namespace sealed-secrets \
  -o yaml > synology-csi-client-info.sealed.yaml
apiVersion: v1
kind: Secret
metadata:
  name: synology-csi-client-info
  namespace: synology-csi
type: Opaque
stringData:
  client-info.yml: |
    clients:
      - host: 10.2.10.19
        port: 5001
        https: true
        username: k8s-csi
        password: YOUR_PASSWORD_HERE
EOF

A5. Security Summary

Layer Protection
DSM user k8s-csi No admin rights, no shared-folder access
DSM firewall Only k8s nodes can reach DSM API + iSCSI
iSCSI isolation LUNs stored in @iSCSI/ hidden dir, separate from NFS
StorageClass location Locks LUN creation to specific volume path
K8s RBAC CSI controller uses dedicated ServiceAccount
Sealed Secrets DSM password encrypted at rest in git

volume3 and volume4 themselves CANNOT be deleted, resized, or structurally modified by the CSI driver. It only creates/deletes iSCSI LUN files within them.


Part B — NFS Setup (Static Shares — Manual DSM Config)

Part B1. Create Storage Pools & Volumes

  1. Open Storage ManagerStorage Pool
  2. Create Storage Pool 3 (for app data):
  3. Select disk(s) → RAID type as appropriate (SHR/RAID1 for redundancy or Basic for max space)
  4. Filesystem: Btrfs
  5. Create Volume 3 on Pool 3:
  6. Size: 1 TB
  7. Name: volume3
  8. Create Storage Pool 4 (for backups):
  9. Select disk(s)
  10. Filesystem: Btrfs
  11. Create Volume 4 on Pool 4:
  12. Size: 2 TB
  13. Name: volume4

If the volumes already exist as volume3/volume4, skip to the next step.

2. Create Shared Folders

  1. Open Control PanelShared Folder
  2. Create shared folder k8s-apps:
  3. Location: Volume 3
  4. Enable data checksum: Yes (Btrfs)
  5. Enable data compression: Yes (Btrfs, optional — saves space for text-heavy data)
  6. Do NOT encrypt
  7. Create shared folder k8s-backups:
  8. Location: Volume 4
  9. Enable data checksum: Yes
  10. Enable data compression: No (backups are often already compressed)

3. Enable NFS

  1. Open Control PanelFile ServicesNFS
  2. Enable NFS Service
  3. Maximum NFS protocol: NFSv4.1
  4. Click Apply

4. Set NFS Permissions

For each shared folder:

  1. Open Control PanelShared Folder
  2. Select k8s-appsEditNFS Permissions tab
  3. Click Create:
  4. Hostname or IP: 10.2.0.0/16
  5. Privilege: Read/Write
  6. Squash: Map all users to admin (ensures k8s pods can write)
  7. Security: sys
  8. Enable asynchronous: Yes (better performance)
  9. Allow connections from non-privileged ports: Yes
  10. Allow users to access mounted subfolders: Yes
  11. Repeat for k8s-backups

5. Create Subdirectories

SSH into the NAS or use File Station to create the directory structure:

# SSH to Synology (enable SSH in Control Panel → Terminal & SNMP)
ssh [email protected]

# App data directories
sudo mkdir -p /volume3/k8s-apps

# Backup directories
sudo mkdir -p /volume4/k8s-backups/longhorn
sudo mkdir -p /volume4/k8s-backups/cnpg

# Set permissions (wide open for NFS — squash handles the mapping)
sudo chmod -R 777 /volume3/k8s-apps
sudo chmod -R 777 /volume4/k8s-backups
  1. Open Snapshot Replication (install from Package Center if missing)
  2. Create snapshot schedule for k8s-backups:
  3. Frequency: Daily at 03:00 (after CNPG nightly backup at 02:00)
  4. Retention: Keep 30 snapshots (rolling 30-day history)
  5. Optionally create snapshot schedule for k8s-apps:
  6. Frequency: Daily at 04:00
  7. Retention: Keep 7 snapshots

This gives you a layered backup strategy: - Layer 1: CNPG → MinIO (in-cluster, point-in-time recovery) - Layer 2: Longhorn volume backups → NFS on NAS - Layer 3: Synology BTRFS snapshots of the NFS shares (immutable point-in-time)

Verification

After DSM setup is complete, test from any cluster node:

# From k8s-cp-office-1 (10.2.20.200):
sudo apt install -y nfs-common   # if not already installed
sudo mount -t nfs4 10.2.10.19:/volume3/k8s-apps /mnt
ls /mnt
sudo umount /mnt

sudo mount -t nfs4 10.2.10.19:/volume4/k8s-backups /mnt
ls /mnt
sudo umount /mnt

Then apply the Kubernetes manifests:

# Sealed secret for CNPG backup creds (via ArgoCD — just push to git)
git push  # ArgoCD picks up sealed-secrets/sealed/pg-backup-minio-creds.sealed.yaml

# NFS provisioner (via ArgoCD — just push to git)
git push  # ArgoCD picks up argocd-apps/infra/nfs-provisioner.yaml

# Longhorn backup target is set via Helm values in argocd-apps/infra/longhorn.yaml
# ArgoCD will sync the setting automatically.

What Gets Stored Where

Path Purpose Size Protocol
/volume3/k8s-apps/ NFS PVCs for office apps (Paperless, Nextcloud, media) 1 TB NFS
/volume3/@iSCSI/ Synology CSI dynamic block volumes shared w/ volume3 iSCSI
/volume4/k8s-backups/longhorn/ Longhorn volume backup snapshots 2 TB shared NFS
/volume4/k8s-backups/cnpg/ Reserved for future direct CNPG WAL shipping 2 TB shared NFS
/volume4/@iSCSI/ Synology CSI backup LUNs shared w/ volume4 iSCSI

Cluster Permissions — What the K8s Cluster CAN and CANNOT Do

CAN (via Synology CSI + NFS provisioner)

  • Create new iSCSI LUNs (dynamic PV provisioning)
  • Resize iSCSI LUNs (PVC expansion)
  • Take CSI snapshots of iSCSI LUNs
  • Delete iSCSI LUNs (when PV reclaim policy is Delete)
  • Create/delete subdirectories under NFS shares

CANNOT

  • Delete or resize volume3 / volume4
  • Create or delete storage pools
  • Modify NFS share settings or permissions
  • Access shared folders via DSM API (k8s-csi user has no access)
  • Reach DSM API from outside the k8s subnet (firewall)
  • See or modify any data outside its own iSCSI LUNs