All iSCSI persistent volumes provisioned by democratic-csi on TrueNAS are tagged with custom ZFS user properties to identify their Kubernetes namespace and PVC claim name. This eliminates the need to reverse-engineer volume ownership via strings or other forensic methods during cluster rebuilds or migrations.
| Property | Description | Example |
|---|---|---|
k8s:namespace |
Kubernetes namespace the PVC belongs to | plex |
k8s:claim |
PVC claim name | plex-config |
sudo /usr/sbin/zfs set k8s:namespace=<namespace> k8s:claim=<claim-name> primary/kubernetes/volumes/<pvc-uuid>sudo /usr/sbin/zfs list -t volume -r primary/kubernetes/volumes -o name,k8s:namespace,k8s:claimsudo /usr/sbin/zfs list -t volume -r primary/kubernetes/volumes -o name,k8s:namespace,k8s:claim | grep <namespace>To generate tagging commands for all iSCSI PVs in the current cluster:
kubectl get pv -o jsonpath='{range .items[?(@.spec.storageClassName=="iscsi-persistent-fs6712x")]}{.metadata.name}{"\t"}{.spec.claimRef.namespace}{"\t"}{.spec.claimRef.name}{"\n"}{end}' | while IFS=$'\t' read -r pv ns claim; do
echo "sudo /usr/sbin/zfs set k8s:namespace=${ns} k8s:claim=${claim} primary/kubernetes/volumes/${pv}"
doneCross-reference TrueNAS zvols against Kubernetes PVs to find orphans:
# On TrueNAS: list all zvol names
sudo /usr/sbin/zfs list -t volume -r primary/kubernetes/volumes -o name -H | awk -F/ '{print $NF}'
# On workstation: list all iSCSI PV names
kubectl get pv -o jsonpath='{range .items[?(@.spec.storageClassName=="iscsi-persistent-fs6712x")]}{.metadata.name}{"\n"}{end}'Any zvol present on TrueNAS but absent from Kubernetes is an orphan.
- Tags are not automatically set by
democratic-csi. They must be applied manually after PVC creation or during migration. - Tags survive ZFS snapshots, clones, and promotions.
- NFS-based PVs (media shares, downloads) are static and not stored on ZFS zvols — they don't need tagging.