Exposing a Shared Filesystem as Static PVs with SeaweedFS CSI
S3-compatible APIs are sufficient for object artifacts, but Notebook shared data and some stateful workloads need a POSIX filesystem. Giving every application Pod FUSE privileges and a storage client spreads mount authority and host-boundary concerns into workloads. A safer boundary gives mount authority only to nodes and gives workloads ordinary PersistentVolumeClaim objects.
This article explains a model that registers an existing SeaweedFS Filer directory as a Static PersistentVolume (PV) and declares a PVC in a workload namespace that selects that PV. Dynamic provisioning is deliberately not used.
The boundary between object storage and filesystem consumers
Section titled “The boundary between object storage and filesystem consumers”S3-compatible object storage suits artifact upload and download. A filesystem contract is needed when several Pods read a directory tree, an existing application expects POSIX paths, or a stateful workload needs a file root per replica.
The design splits privileges into two layers.
- A workload Pod references only a PVC in its namespace. It does not need privileged access,
/dev/fuse, or kubelet hostPaths. - The CSI node driver and mount service perform FUSE mounting and kubelet plugin registration on worker nodes. Host-boundary privileges stay in these dedicated DaemonSets.
- A Static PV expresses an existing Filer
pathas a Kubernetes storage contract and passescollectionas a separate chunk-storage setting.
The Static PV/PVC contract
Section titled “The Static PV/PVC contract”A Static PV exposes one Filer directory as one filesystem root. The PVC selects a specific PV with volumeName, and both sides specify an empty storageClassName, so neither default StorageClass selection nor dynamic provisioning participates. But the PVC’s volumeName alone does not reserve the PV. To pre-reserve the PV for a PVC with a specific namespace and name, also declare claimRef on the PV.
Implementation and applicability of the example
Section titled “Implementation and applicability of the example”The inspected original vendors Helm chart 0.2.35 from seaweedfs/seaweedfs-csi-driver with appVersion: v1.4.29. Its chart values and templates match public v1.4.29, commit 7ad49d9a5c0f881e3e7ce02e73725af7962ddbce. With no tag override in the overlay, the declared images are chrislusf/seaweedfs-csi-driver:v1.4.29 and chrislusf/seaweedfs-mount:v1.4.29. Running image digests and the revision used for the original deployment remain unverified.[1]
The separate mount service is an upstream design in this version, not a custom-built proxy. The CSI node driver constructs mount arguments and sends them to the mount service through an HTTP/JSON API over a Unix socket; the mount service starts a weed mount process.[2][4][13] The kubelet CSI gRPC socket and this mount-service socket are different. The TCP gateway is deployment-specific networking in front of the Filer, not a required CSI driver component. This release’s mount-image Dockerfile declares a build of weed from SeaweedFS commit 8a532cc0cffd5d17ac586bd861878334e5de2b1f. The client-protocol explanation below uses that source, not a verified revision of the deployed binary.[11][12]
The YAML below generalizes the Static PV pattern in the original documentation. Do not copy it into another release or fork solely because the driver name matches. collection and path in volumeAttributes are strings interpreted by this implementation, not universal Kubernetes fields. path selects the mount root; collection selects the collection for new file chunks and the scope of mount-side capacity accounting. A collection does not select a directory or isolate access to a path. This version gives an absolute-path volumeHandle precedence as the mount root. For a non-absolute handle like the one below, it uses the explicit path, or /buckets/<volumeHandle> when path is absent. An empty collection defaults to the mount root’s basename, so default is an explicitly chosen example name, not a reserved keyword.[2]
Static binding does not allocate a backend directory. Dynamic CreateVolume, by contrast, resolves a path from path or parentDir, creates the directory under /buckets by default, and returns its full path as the volume ID. The node’s collection-selection rules then apply. This example does not add a StorageClass for dynamic allocation.[3]
apiVersion: v1kind: PersistentVolumemetadata: name: shared-datasetsspec: capacity: storage: 10Gi accessModes: - ReadWriteMany persistentVolumeReclaimPolicy: Retain volumeMode: Filesystem storageClassName: "" csi: driver: seaweedfs-csi-driver volumeHandle: shared-datasets volumeAttributes: collection: default path: /datasets/team-a---apiVersion: v1kind: PersistentVolumeClaimmetadata: name: shared-datasets namespace: <workload-namespace>spec: accessModes: - ReadWriteMany storageClassName: "" volumeName: shared-datasets resources: requests: storage: 10GiEach field has a distinct role.
| Field | Contract | Caution |
|---|---|---|
volumeHandle | Unique identity used by the CSI driver for mount identity and capacity lookup | It must not be duplicated in a cluster |
path / collection | path selects the filesystem root; collection selects new-chunk storage and capacity-accounting scope | A collection is not a directory or access-control boundary |
volumeName | Makes the PVC select its Static PV explicitly | Does not prevent another PVC from taking it first; the separate storageClassName: "" prevents default StorageClass selection |
PV claimRef | Reserves the PV for a PVC with the specified namespace/name | Unlike the PVC’s volumeName, prevents another PVC from taking it first |
storageClassName: "" | Declares that provisioning controllers are not involved | Put it on both the PV and PVC |
Retain | Preserves the backend directory after PVC deletion | The PV can remain Released with its old claimRef; inspect before reuse |
For example, to pre-reserve this PV for the PVC above, add the following under the PV’s spec when creating it. Match the namespace and name to the PVC you intend to create. Do not overwrite a PV already bound to another PVC with this reservation example.
claimRef: namespace: <workload-namespace> name: shared-datasetsSelection and reservation are different: a PVC’s volumeName names the desired PV but does not prevent another PVC from taking it first. The PV’s claimRef reserves it for the named PVC (Kubernetes PV reservation documentation). Binding still requires compatible StorageClass, access modes, and requested capacity. Reservation does not replace data-access permissions or Filer-side isolation; check namespace RBAC and backend access controls separately.
spec.capacity.storage does not automatically create a Filer-side quota. This driver version also reads PV capacity and passes it to a mount-side collection quota. That is not a server-side quota restricting writes through other clients.[8] If several PVs share one backend collection, this field alone does not create independent quotas.
Read-only checks and failure diagnosis
Section titled “Read-only checks and failure diagnosis”Without assuming a working cluster, substitute the namespace and names for your deployment and start with these read-only queries.
NS=workload-namespacePV=shared-datasetsPVC=shared-datasetskubectl get pv "$PV" -o yamlkubectl -n "$NS" get pvc "$PVC" -o yamlkubectl describe pv "$PV"kubectl -n "$NS" describe pvc "$PVC"Compare PV/PVC status.phase, the PV’s spec.claimRef (namespace/name/UID), and the PVC’s spec.volumeName. If the PVC is Pending, check both storageClassName values, access modes, capacity, volumeMode, reservation target, and Events from describe. If the PV is Released or retains an old PVC’s claimRef/UID, do not reassign it to a new PVC or clear binding metadata before reviewing the retained directory’s owner, data-retention, and backup policy. If the PVC is Bound but a Pod cannot mount it, identify the Pod with kubectl -n "$NS" get pods -o wide, set its name as POD=actual-pod-name, then inspect mount errors in kubectl -n "$NS" describe pod "$POD" Events. Also check the responsible CSI node driver/mount service and node-to-Filer path within your operational access. Bound does not prove a successful mount or read/write operation.
The privilege boundary created by CSI
Section titled “The privilege boundary created by CSI”In the following flow, the workload knows only its PVC; FUSE and the kubelet plugin socket are handled by node-only components.
The node driver and mount service can use powerful privileges such as hostPaths, mount propagation, /dev/fuse, and privileged capabilities. CSI needs them to pass a mount into the node filesystem. A workload Pod has no reason to hold those privileges. Narrowing the interface to a PVC keeps application manifests independent of the storage implementation.
Why dynamic provisioning is disabled
Section titled “Why dynamic provisioning is disabled”This configuration removes the StorageClass that the CSI chart could create and chooses a Static-only model where people declare directory lifecycle. That does not mean the CSI driver cannot support dynamic provisioning; it means this platform does not select that capability.
| Static PV fits when | Dynamic provisioning fits when |
|---|---|
| Connecting existing Filer directories to Kubernetes while retaining them | Automatically creating a new volume or directory with a PVC |
| Controlling tenant or workload directory lifecycle through a separate procedure | There are many self-service workloads and automated cleanup policy is ready |
| Separating data deletion from PVC lifecycle | A provisioning policy per storage class is clear |
The cost of Static PVs is operational procedure. Before scaling replicas, prepare directories, PVs, and PVCs by ordinal. ReadWriteMany means several Pods may mount a volume; it does not mean concurrent writes to the same directory are safe.
Endpoint and network boundary
Section titled “Endpoint and network boundary”In this version, Filer configuration lookup does not discover a gRPC address from an HTTP response. weed mount derives the gRPC address from the configured Filer address and calls gRPC GetFilerConfiguration. The table maps connection roles verified in the original declarations and public source. filer.example.com is a generalized example, not an actual address; 8888 and 18888 are backend ports specified by the original routes. Do not assume another deployment uses the same listener or Service ports.[5][6]
| Configuration key or input | Endpoint role | HTTP/gRPC and protocol | Verification location |
|---|---|---|---|
CSI_ENDPOINT → --endpoint | Kubelet to node CSI plugin: unix:///csi/csi.sock | CSI gRPC over Unix socket | Chart templates/daemonset.yaml; separate from the mount-service API [12] |
mountService.endpoint, node.mountEndpoint → --mountEndpoint | Node driver → mount service: unix:///var/lib/seaweedfs-mount/seaweedfs-mount.sock | HTTP/JSON over Unix socket, /mount and /unmount | Chart values and pkg/mountmanager/client.go; an empty node override uses mountService values [1][4] |
seaweedfsFiler → SEAWEEDFS_FILER → --filer | Filer address input: filer.example.com:8888 | HTTP-address-style host:port; this version derives gRPC 18888 on the same host | Original overlay and TCPRoute backend ports; ServerAddress.ToGrpcAddress and ServerToGrpcAddress [6][10] |
Filer input above → GetFilerConfiguration and metadata RPCs | Mount client → Filer configuration and metadata | gRPC over TCP; the default derivation for input 8888 yields 18888 | weed/command/mount_common.go, weed/pb/server_address.go [5][6] |
spec.csi.volumeAttributes.volumeServerAccess (omitted in the example) | Selects the chunk read/write target | Default direct: discovered Volume Server HTTP addresses. publicUrl: selects public addresses. filerProxy: chunk requests over Filer HTTP | Driver mount-argument forwarding and weed mount defaults and lookup implementation [2][7][9] |
volumeHandle, collection, path | Mount identity, chunk collection, and filesystem root | Mount configuration, not endpoints or ports | pkg/driver/mounter.go; separate from address configuration [2] |
Filer gRPC carries configuration, metadata, and volume-location lookup; it does not describe the entire file-chunk data path. With volumeServerAccess absent from this example, the source default is direct. Opening only the two Filer ports is therefore not guaranteed to be sufficient. Review the chunk HTTP path to discovered Volume Server addresses as well. Selecting filerProxy routes chunk requests through Filer HTTP, but that is a configuration change requiring separate verification, not an observed execution result from the original. The existing diagram stops at the Filer connection boundary and omits direct chunk access.[7][9][14]
A different cluster can mount the same Filer, but that cluster still needs its own CSI node driver and mount service. Rather than allowing every source broadly, allowlist only required TCP from worker-node subnets to verified Filer and chunk endpoints. A TCP route does not replace HTTP authentication, so TLS and the place where identity/authentication is enforced need a separate design.
Operations: a CSI DaemonSet replacement is a workload event
Section titled “Operations: a CSI DaemonSet replacement is a workload event”Restarting a CSI node driver or mount service can affect Pods using that filesystem on the same node. It should not be replaced casually like a general Deployment rollout.
- Identify Pods using CSI-backed volumes on the target node.
- Drain or move the workloads to a safe node.
- Replace the mount service and node driver.
- Confirm PVC mounting and application read/write health before returning workloads.
OnDelete lets an operator control replacement timing and suits active mounts, but security patches can lag. RollingUpdate makes it easier to keep the software current, but its disruption range for mounted workloads must be managed beforehand. Under either strategy, treat CSI component updates as an operational task separate from application rollout.
Closing
Section titled “Closing”SeaweedFS CSI is valuable because it carries a Filer directory into a Kubernetes filesystem contract. Workloads receive only PVCs, while node-level FUSE and kubelet integration stay isolated in CSI DaemonSets. Static PV/PVC binding, the Retain policy, per-directory lifecycle, and CSI update procedure must be designed together for a shared filesystem to become a predictable operational boundary rather than a convenience feature.
The overarching data-layer principles continue in Shared Data Services, while the separation of object artifacts and metadata stores is covered in Kubeflow Pipelines.
Sources
Section titled “Sources”[1] https://github.com/seaweedfs/seaweedfs-csi-driver/blob/7ad49d9a5c0f881e3e7ce02e73725af7962ddbce/deploy/helm/seaweedfs-csi-driver/values.yaml [2] https://github.com/seaweedfs/seaweedfs-csi-driver/blob/7ad49d9a5c0f881e3e7ce02e73725af7962ddbce/pkg/driver/mounter.go [3] https://github.com/seaweedfs/seaweedfs-csi-driver/blob/7ad49d9a5c0f881e3e7ce02e73725af7962ddbce/pkg/driver/controllerserver.go [4] https://github.com/seaweedfs/seaweedfs-csi-driver/blob/7ad49d9a5c0f881e3e7ce02e73725af7962ddbce/pkg/mountmanager/client.go [5] https://github.com/seaweedfs/seaweedfs/blob/8a532cc0cffd5d17ac586bd861878334e5de2b1f/weed/command/mount_common.go [6] https://github.com/seaweedfs/seaweedfs/blob/8a532cc0cffd5d17ac586bd861878334e5de2b1f/weed/pb/server_address.go [7] https://github.com/seaweedfs/seaweedfs/blob/8a532cc0cffd5d17ac586bd861878334e5de2b1f/weed/mount/weedfs.go [8] https://github.com/seaweedfs/seaweedfs-csi-driver/blob/7ad49d9a5c0f881e3e7ce02e73725af7962ddbce/README.md [9] https://github.com/seaweedfs/seaweedfs/blob/8a532cc0cffd5d17ac586bd861878334e5de2b1f/weed/command/mount.go [10] https://github.com/seaweedfs/seaweedfs/blob/8a532cc0cffd5d17ac586bd861878334e5de2b1f/weed/pb/grpc_client_server.go [11] https://github.com/seaweedfs/seaweedfs-csi-driver/blob/7ad49d9a5c0f881e3e7ce02e73725af7962ddbce/cmd/seaweedfs-mount/Dockerfile [12] https://github.com/seaweedfs/seaweedfs-csi-driver/blob/7ad49d9a5c0f881e3e7ce02e73725af7962ddbce/deploy/helm/seaweedfs-csi-driver/templates/daemonset.yaml [13] https://github.com/seaweedfs/seaweedfs-csi-driver/blob/7ad49d9a5c0f881e3e7ce02e73725af7962ddbce/pkg/mountmanager/manager.go [14] https://github.com/seaweedfs/seaweedfs/blob/8a532cc0cffd5d17ac586bd861878334e5de2b1f/weed/mount/weedfs_write.go