zooqueenandHanzo Dev bff525f849 fix: repair references the rename broke; pin s3 v1.0.2
The seaweedfs->s3 sweep rewrote third-party names it had no business
touching, turning working references into ones that resolve to nothing:

- deploy manifests and helm values asked for chrislusf/s3-csi and
  chrislusf/s3-mount. Neither exists (Docker Hub 404s; upstream's real name
  is chrislusf/seaweedfs-csi-driver). Pointed them at the images our own CI
  publishes instead — ghcr.io/hanzoai/s3-{csi,mount} — which is what #1
  moved us to and what the static manifest should have said all along.
- README linked github.com/s3/s3, s3.github.io/s3-csi-driver/helm and
  chrislusf/s3-csi-driver badges. Restored the genuine upstream where we
  cite upstream, and pointed our own links at hanzoai/s3-csi. Also fixed a
  path that named a file we do not have.
- sync-s3.yaml grepped go.mod for github.com/s3/s3 and would `go get -u`
  that module. Our module is github.com/hanzoai/s3, so the grep matched
  nothing and the fetch could only fail. Deleted rather than repaired: it
  syncs from an upstream this fork has deliberately left behind, and
  pulling it forward would put gRPC back under a ZAP driver.

Also pins github.com/hanzoai/s3 v1.0.2 in place of the pseudo-version, now
that s3 tags its own v1 line (its 4.34.x/v2026.x tags were never resolvable
— the module has no major suffix, so only v1.x.x can be required), and moves
the integration test onto v1.0.2. That pin matters: 4.34.6 predates the ZAP
filer entirely, so the test was pointing a ZAP driver at a gRPC filer, and
v1.0.2 is the first build without the promise-ID deadlock on concurrent
filer calls.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 19:24:11 -07:00

Container Storage Interface (CSI) for S3

Docker Pulls Artifact Hub

Container storage interface is an industry standard that enables storage vendors to develop a plugin once and have it work across a number of container orchestration systems.

S3 is a simple and highly scalable distributed file system, to store and serve billions of files fast!



Deployment

Kubernetes (kubectl)

Prerequisites:

  • Already have a working Kubernetes cluster (includes kubectl)
  • Already have a working S3 cluster

Install

Helm

  1. Add the helm repo;
helm repo add s3-csi https://hanzoai.github.io/s3-csi/helm
  1. Check versions by helm repo update s3-csi and helm search repo s3-csi

Source

  1. Clone this repository
git clone https://github.com/hanzoai/s3-csi.git
  1. Adjust your S3 Filer address via variable S3_FILER in deploy/kubernetes/s3-csi.yaml (2 places)

  2. Apply the container storage interface for S3 for your cluster. Use the '-pre-1.17' version for any cluster pre kubernetes version 1.17.

To generate an up to date manifest from the helm chart, do:

$ helm template s3 ./deploy/helm/s3-csi > deploy/kubernetes/s3-csi.yaml

Check the kubelet root directory ,Execute the following command

ps -ef | grep kubelet | grep root-dir

If the result returned from the previous check command is not empty, the root directory (eg:--root-dir=/data/k8s/kubelet/data) representing the kubelet is not the default value (/var/lib/kubelet), so you need to update the kubelet root-dir in the CSI driven deployment file and deploy:

sed 's+/var/lib/kubelet+/data/k8s/kubelet/data+g'  deploy/kubernetes/s3-csi.yaml | kubectl apply -f - 

If the result returned by the previous check command is null, you can directly deploy it without modifying the configuration:

$ kubectl apply -f deploy/kubernetes/s3-csi.yaml
  1. Ensure all the containers are ready and running
$ kubectl get po -n kube-system

TLS Support

The provided static manifest deploy/kubernetes/s3-csi.yaml does not include TLS configuration by default. To enable TLS, it is recommended to use Helm with tlsSecret configured. If you must use static manifests, you will need to manually patch the s3-mount and s3-node DaemonSets to include the necessary TLS environment variables and volume mounts.

Uninstall

$ kubectl delete -f deploy/kubernetes/sample-busybox-pod.yaml
$ kubectl delete -f deploy/kubernetes/sample-s3-pvc.yaml
$ kubectl delete -f deploy/kubernetes/s3-csi.yaml

Kubernetes (helm)

Install

  1. Clone project
git clone https://github.com/hanzoai/s3-csi.git
  1. Edit ./deploy/helm/s3-csi/values.yaml if required and Install
helm install --set s3Filer=<filerHost:port> s3-csi-driver ./deploy/helm/s3-csi

Example with multiple filers :

helm install s3-csi-driver ./deploy/helm/s3-csi/ \
  --namespace s3-csi-driver \
  --set s3Filer="<filerHost:port>\,<filerHost:port>\,<filerHost:port>\,<filerHost:port>\,<filerHost:port>"

Uninstall

helm uninstall s3-csi-driver

Update (Safe rollout)

Updating s3-csi-driver DaemonSet (DS) will break processeses who implement fuse mount: newly created pods will not remount net device.

For safe update set node.updateStrategy.type: OnDelete for manual update. Steps:

  1. delete DS pods on the node where there is no s3 PV
  2. cordon or taint node
  3. evict or delete pods with s3 PV
  4. delete DS pod on node
  5. uncordon or remove taint on node
  6. repeat all steps on [all nodes]

Testing

  1. Create a persistent volume claim for 5GiB with name s3-csi-pvc and storage class s3-storage. The requested size is applied as a quota to the S3 collection used by the mount.
$ kubectl apply -f deploy/kubernetes/sample-s3-pvc.yaml
  1. Verify if the persistant volume claim exists and wait until its the STATUS is Bound
$ kubectl get pvc
  1. After its in Bound state, create a sample workload mounting that volume
$ kubectl apply -f deploy/kubernetes/sample-busybox-pod.yaml
  1. Verify the storage mount of the busybox pod
$ kubectl exec my-csi-app -- df -h

Capacity limits

For dynamically provisioned volumes, resources.requests.storage is enforced by the S3 FUSE mount and reported by df. Once the mount observes that the quota has been reached, further writes fail with ENOSPC. PVC expansion updates the mount quota.

The quota is collection-based and enforced by each CSI-managed mount, rather than stored as an authoritative server-side limit. By default, every dynamic volume gets its own collection, so its quota is isolated. If multiple volumes are configured to use the same collection, their usage is shared and they do not have independent per-directory quotas. Writes through another S3 client that does not use the quota-configured mount are not restricted by this CSI quota.

Because enforcement is mount-side, concurrent writers on different mounts can briefly exceed the configured capacity before collection usage is refreshed.

For statically provisioned Kubernetes volumes, the driver reads spec.capacity.storage from the PersistentVolume matching spec.csi.volumeHandle. Other orchestrators receive volumeCapacity from dynamic CreateVolume calls; static integrations can provide the same value in bytes through the volume context.

Static and dynamic provisioning

By default, driver will create separate folder (/buckets/<volume-id>) and will use separate collection (volume-id) for each request. Sometimes we need to use exact collection name or change replication options. It can be done via creating separate storage class with options:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: s3-special
provisioner: s3-csi-driver
parameters:
  collection: mycollection
  replication: "011"
  diskType: "ssd"

There is another use case when we need to access one folder from different pods with ro/rw access. In this case we do not need additional StorageClass. We need to create PersistentVolume:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: s3-static
spec:
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 1Gi
  csi:
    driver: s3-csi-driver
    volumeHandle: dfs-test
    volumeAttributes:
      collection: default
      replication: "011"
      path: /path/to/files
      diskType: "ssd"
    readOnly: true
  persistentVolumeReclaimPolicy: Retain
  volumeMode: Filesystem

and bind PersistentVolumeClaim(s) to it:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: s3-static
spec:
  storageClassName: ""
  volumeName: s3-static
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 1Gi

DataLocality

DataLocality (inspired by Longhorn) allows instructing the storage-driver which volume-locations will be used or preferred in Pods to read & write.

It auto-sets mount-options based on the location a pod is scheduled in and the locality-option wanted. The option can be set and overridden in Driver, StorageClass and PersistentVolume.

Setup

Change the type of locality

Level Location
Driver Helm: values.yaml -> dataLocality
Or DaemonSet -> Container csi-s3-plugin -> args --dataLocality=
StorageClass parameter.dataLocality
PersistentVolume spec.csi.volumeAttributes.dataLocality

Driver < StorageClass < PersistentVolume

Available options

Option Effect
none (default) Changes nothing
write_preferLocalDc Sets the DataCenter-mount-option to the current Node-DataCenter, making writes local and allowing reads to occur wherever read data is stored. More Details

Requirements

Volume-Servers and the CSI-Driver-Node need to have the locality-option DataCenter correctly set (currently only this option is required).

This can be done manually (although quite tedious) or injected by the Container-Orchestration.

Automatic injection

Kubernetes

Unfortunately Kubernetes doesnt allow grabbing node-labels, which contain well-known region-labels, and setting them as environment-variables. The DownwardAPI is very limited in that regard. (see #40610)

Therefore a workaround must be used. KubeMod can be used based on this comment. This of course requires KubeMod to be installed.

You can activate it in the Helm-Chart values.yaml -> node.injectTopologyInfoFromNodeLabel.enabled. node.injectTopologyInfoFromNodeLabel.labels decides which labels are grabbed from the node.

It is recommended to use well-known labels to avoid confusion.

License

Apache v2 license

Code of conduct

Participation in this project is governed by Kubernetes/CNCF code of conduct

S
Description
ZAP-native CSI driver for the Hanzo filer (hanzoai/s3). No protobuf.
Readme Apache-2.0
254 KiB
Languages
Go 89.3%
HCL 6.8%
Shell 1.3%
Dockerfile 1%
Go Template 0.9%
Other 0.7%