### Install SeaweedFS CSI Driver with Override File Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/deploy/helm/seaweedfs-csi-driver/README.md Install the SeaweedFS CSI driver Helm chart using a configuration file (e.g., seaweedfs-overrides.yaml) to specify the SeaweedFS filer host. ```yaml # For a SeaweedFS instance running locally under the "seaweed" namespace - adjust for your configuration seaweedfsFiler: "seaweedfs-filer.seaweed.svc.cluster.local:8888" ``` ```bash helm install my-seaweedfs-csi-driver seaweedfs-csi-driver/seaweedfs-csi-driver -f seaweedfs-overrides.yaml ``` -------------------------------- ### Install and Configure SeaweedFS CSI Docker Plugin Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/cmd/seaweedfs-csi-driver/swarm/README.md Commands to install, configure environment variables, and enable the SeaweedFS CSI Docker plugin. Use `docker plugin set` to configure FILER and CACHE_SIZE. ```bash docker plugin install --disable --alias seaweedfs-csi:swarm --grant-all-permissions gradlon/swarm-csi-swaweedfs:v1.2.0 docker plugin set seaweedfs-csi:swarm FILER=:8888,:8888 docker plugin set seaweedfs-csi:swarm CACHE_SIZE=512 docker plugin enable seaweedfs-csi:swarm ``` -------------------------------- ### Install SeaweedFS CSI Driver with Filer Host Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/deploy/helm/seaweedfs-csi-driver/README.md Install the SeaweedFS CSI driver Helm chart, specifying the SeaweedFS filer host and port using the --set flag. ```bash helm install --set seaweedfsFiler= my-seaweedfs-csi-driver seaweedfs-csi-driver/seaweedfs-csi-driver ``` -------------------------------- ### Install SeaweedFS CSI Driver using Helm Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Installs the SeaweedFS CSI driver using Helm, specifying the SeaweedFS Filer host and port. Replace `` with your actual Filer address. ```bash helm install --set seaweedfsFiler= seaweedfs-csi-driver ./deploy/helm/seaweedfs-csi-driver ``` -------------------------------- ### Deploy SeaweedFS CSI Driver with Nomad Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/deploy/nomad/README.md Commands to start the SeaweedFS CSI plugin, create a volume, and launch a sample application using Nomad. Assumes NOMAD_ADDR is configured. ```shell export NOMAD_ADDR=http://nomad.service.consul:4646 # Start CSI plugin nomad run seaweedfs-csi.hcl # Create volume nomad volume create example-seaweedfs-volume.hcl # Start sample app nomad run example-seaweedfs-app.hcl ``` -------------------------------- ### Install SeaweedFS CSI Driver with Helm Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt Install the CSI driver using the Helm chart. Supports configuration options like TLS, DataLocality, caching, and multiple filers. Uninstall using 'helm uninstall'. ```bash # Add the Helm repository helm repo add seaweedfs-csi-driver \ https://seaweedfs.github.io/seaweedfs-csi-driver/helm helm repo update seaweedfs-csi-driver helm search repo seaweedfs-csi-driver # Install with a single filer helm install seaweedfs-csi-driver \ ./deploy/helm/seaweedfs-csi-driver \ --set seaweedfsFiler=seaweedfs-filer.default.svc:8888 # Install with multiple filers (HA setup) helm install seaweedfs-csi-driver \ ./deploy/helm/seaweedfs-csi-driver \ --namespace seaweedfs-csi-driver \ --create-namespace \ --set "seaweedfsFiler=filer1:8888\,filer2:8888\,filer3:8888" # Install with caching and DataLocality helm install seaweedfs-csi-driver \ ./deploy/helm/seaweedfs-csi-driver \ --set seaweedfsFiler=filer1:8888 \ --set cacheCapacityMB=1024 \ --set cacheMetaTtlSec=120 \ --set dataLocality=write_preferLocalDc \ --set node.injectTopologyInfoFromNodeLabel.enabled=true # Uninstall helm uninstall seaweedfs-csi-driver ``` -------------------------------- ### Install SeaweedFS CSI Driver with Multiple Filers using Helm Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Installs the SeaweedFS CSI driver using Helm, configured for multiple SeaweedFS filers. Ensure the filer addresses are correctly formatted and comma-separated. ```bash helm install seaweedfs-csi-driver ./deploy/helm/seaweedfs-csi-driver/ \ --namespace seaweedfs-csi-driver \ --set seaweedfsFiler="\,\,\,\," ``` -------------------------------- ### Deploy Busybox Pod with SeaweedFS Volume Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt This example shows how to deploy a simple Busybox pod that mounts a SeaweedFS PersistentVolumeClaim. Ensure the PVC is bound before applying the pod. ```yaml kind: Pod apiVersion: v1 metadata: name: my-csi-app spec: containers: - name: my-frontend image: busybox volumeMounts: - mountPath: "/data" name: seaweedfs-volume command: ["sleep", "1000000"] volumes: - name: seaweedfs-volume persistentVolumeClaim: claimName: seaweedfs-csi-pvc ``` -------------------------------- ### Create SeaweedFS Docker Volumes Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/cmd/seaweedfs-csi-driver/swarm/README.md Examples of creating Docker volumes using the SeaweedFS CSI driver with different configurations for scope and sharing. The `path` option specifies the storage location on the SeaweedFS server. ```bash docker volume create --driver seaweedfs-csi:swarm --availability active --scope single --sharing none --type mount --opt path="/docker/volumes/teste1" test-volume docker volume create \ --driver seaweedfs-csi:swarm \ --availability active \ --scope multi \ --sharing all \ --type mount \ testVolume ``` -------------------------------- ### Map Container UIDs/GIDs to SeaweedFS Filer Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt This command starts the driver with UID and GID mappings. It allows containers to use different UIDs/GIDs than those on the SeaweedFS Filer, which is essential for multi-tenant environments to ensure correct file ownership. ```bash # Start the driver with UID/GID mappings: # --map.uid=":,:" # --map.gid=":" seaweedfs-csi-driver \ --filer=filer:8888 \ --nodeid=node1 \ --map.uid="0:1000,1001:2000" \ --map.gid="0:1000" ``` -------------------------------- ### Add SeaweedFS Helm Repository Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Adds the SeaweedFS CSI driver Helm repository to your local Helm configuration. Ensure you have Helm installed and configured. ```bash helm repo add seaweedfs-csi-driver https://seaweedfs.github.io/seaweedfs-csi-driver/helm ``` -------------------------------- ### Deploy Service with SeaweedFS Volume Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/cmd/seaweedfs-csi-driver/swarm/README.md Command to create a Docker service that uses a SeaweedFS volume for its storage. This example deploys an Nginx service using the `testVolume` created previously. ```bash docker service create --name testService --mount type=cluster,src=testVolume,dst=/usr/share/nginx/html --publish 2080:80 nginx ``` -------------------------------- ### Clone SeaweedFS CSI Driver Repository Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Clones the SeaweedFS CSI driver source code from GitHub. This is necessary for building or modifying the driver, or for using source-based installation. ```bash git clone https://github.com/seaweedfs/seaweedfs-csi-driver.git ``` -------------------------------- ### Get Persistent Volume Claims Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Verify the status of Persistent Volume Claims. Wait until the STATUS is 'Bound'. ```bash $ kubectl get pvc ``` -------------------------------- ### Generate Kubernetes Manifest from Helm Chart Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Generates a Kubernetes manifest file (YAML) from the SeaweedFS CSI driver Helm chart. This allows for manual application of the CSI driver if Helm installation is not preferred. ```bash helm template seaweedfs ./deploy/helm/seaweedfs-csi-driver > deploy/kubernetes/seaweedfs-csi.yaml ``` -------------------------------- ### Apply Sample Busybox Pod Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Create a sample workload mounting the bound Persistent Volume Claim. This deploys a busybox pod that utilizes the provisioned storage. ```bash $ kubectl apply -f deploy/kubernetes/sample-busybox-pod.yaml ``` -------------------------------- ### Apply SeaweedFS PVC Sample Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Apply a sample Persistent Volume Claim for SeaweedFS. Ensure the storage class 'seaweedfs-storage' is pre-configured. ```bash $ kubectl apply -f deploy/kubernetes/sample-seaweedfs-pvc.yaml ``` -------------------------------- ### Driver Startup Flags for SeaweedFS CSI Driver Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt This section indicates that the CSI driver binary can be launched directly with specific flags for fine-grained control over its components and SeaweedFS connection. ```bash # Driver Startup Flags (`seaweedfs-csi-driver` binary) Launch the CSI driver binary directly with fine-grained control over which components run and how the driver connects to SeaweedFS. ``` -------------------------------- ### Print SeaweedFS CSI Driver Version Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt Use this command to display the driver's version information, including build details. ```bash seaweedfs-csi-driver --version ``` -------------------------------- ### Deploy SeaweedFS CSI Driver with kubectl Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt Apply the pre-generated manifest to deploy all CSI components. Ensure your SeaweedFS filer address is correctly set in the manifest. Uninstall by deleting the manifest. ```bash # Clone the repository git clone https://github.com/seaweedfs/seaweedfs-csi-driver.git cd seaweedfs-csi-driver # Set your SeaweedFS filer address (replace in 2 places) sed -i 's/SEAWEEDFS_FILER:8888/seaweedfs-filer.default.svc:8888/g' \ deploy/kubernetes/seaweedfs-csi.yaml # If using a non-default kubelet root dir, remap it: # ps -ef | grep kubelet | grep root-dir # sed 's+/var/lib/kubelet+/data/k8s/kubelet/data+g' \ # deploy/kubernetes/seaweedfs-csi.yaml | kubectl apply -f - kubectl apply -f deploy/kubernetes/seaweedfs-csi.yaml # Verify all pods are Running kubectl get po -n kube-system | grep seaweed # Expected output: # seaweedfs-controller- 5/5 Running 0 2m # seaweedfs-mount- 1/1 Running 0 2m # seaweedfs-node- 3/3 Running 0 2m # Uninstall kubectl delete -f deploy/kubernetes/seaweedfs-csi.yaml ``` -------------------------------- ### Dynamic Volume Provisioning with PVC Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt Create a PersistentVolumeClaim against the default 'seaweedfs-storage' StorageClass to dynamically provision a SeaweedFS-backed PersistentVolume. The driver creates a directory on the Filer. ```yaml # File: deploy/kubernetes/sample-seaweedfs-pvc.yaml apiVersion: v1 kind: PersistentVolumeClaim metadata: name: seaweedfs-csi-pvc spec: accessModes: - ReadWriteOnce resources: requests: storage: 5Gi # Value is advisory; SeaweedFS mounts the full FS storageClassName: seaweedfs-storage --- ``` -------------------------------- ### Apply Kubernetes Manifest (Default Kubelet Root) Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Applies the SeaweedFS CSI driver Kubernetes manifest directly to your cluster. Use this command if your cluster uses the default kubelet root directory. ```bash kubectl apply -f deploy/kubernetes/seaweedfs-csi.yaml ``` -------------------------------- ### Apply Kubernetes Manifest with Kubelet Root Directory Modification Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Applies the SeaweedFS CSI driver Kubernetes manifest, with a modification to the kubelet root directory if it's not the default. This command uses 'sed' to replace the default path and then applies the manifest. ```bash sed 's+/var/lib/kubelet+/data/k8s/kubelet/data+g' deploy/kubernetes/seaweedfs-csi.yaml | kubectl apply -f - ``` -------------------------------- ### Run SeaweedFS CSI Driver with Default Components Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt This command runs both the controller and node components of the SeaweedFS CSI driver. Configure filer address, CSI endpoint, node ID, and cache settings as needed. ```bash seaweedfs-csi-driver \ --filer=seaweedfs-filer.default.svc:8888 \ --endpoint=unix:///csi/csi.sock \ --mountEndpoint=unix:///var/lib/seaweedfs-mount/seaweedfs-mount.sock \ --nodeid=$(NODE_NAME) \ --components=controller,node \ --cacheCapacityMB=512 \ --cacheMetaTtlSec=60 \ --cacheDir=/var/cache/seaweedfs \ --concurrentWriters=128 \ --concurrentReaders=128 \ --map.uid="0:1000" \ --map.gid="0:1000" \ --dataCenter=us-east-1a \ --dataLocality=write_preferLocalDc \ --driverName=seaweedfs-csi-driver \ --attacher=true ``` -------------------------------- ### Run SeaweedFS Cluster with Nomad Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/deploy/nomad/README.md Execute this command to deploy the SeaweedFS cluster using a Nomad job file. Ensure NOMAD_ADDR is set correctly. ```shell export NOMAD_ADDR=http://nomad.service.consul:4646 nomad run seaweedfs.hcl ``` -------------------------------- ### Build SeaweedFS CSI-Driver Docker Plugin Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/cmd/seaweedfs-csi-driver/swarm/README.md A bash script to build the SeaweedFS CSI-Driver Docker plugin. It handles versioning, architecture, and plugin creation/pushing. Ensure you have `config.json` in the current directory. ```bash #!/bin/bash USAGE="Usage: ./build.sh [PREFIX] [VERSION] [TAG] [PLUGIN_NAME] [ARCH]" if [[ "$1" == "-h" ]]; then echo "$USAGE" exit 0 fi VERSION=${2:-latest} ARCH=${5:-linux/amd64} PLUGIN_NAME=${4:-swarm-csi-swaweedfs} PLUGIN_TAG=${3:-v1.2.0} PREFIX=${1:-gradlon} docker build --platform ${ARCH} --build-arg BASE_IMAGE=chrislusf/seaweedfs-csi-driver:${VERSION} --build-arg ARCH=$ARCH -t seawadd-csi_tmp_img . mkdir -p ./plugin/rootfs cp config.json ./plugin/ docker container create --name seawadd-csi_tmp seawadd-csi_tmp_img docker container export seawadd-csi_tmp | tar -x -C ./plugin/rootfs docker container rm -vf seawadd-csi_tmp docker image rm seawadd-csi_tmp_img docker plugin disable ${PREFIX}/swarm-csi-swaweedfs:v1.2.0 docker plugin rm ${PREFIX}/${PLUGIN_NAME}:${PLUGIN_TAG} 2> /dev/null || true docker plugin create ${PREFIX}/${PLUGIN_NAME}:${PLUGIN_TAG} ./plugin docker plugin push ${PREFIX}/${PLUGIN_NAME}:${PLUGIN_TAG} rm -rf ./plugin/ ``` -------------------------------- ### Static Volume Provisioning with SeaweedFS Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt Configure a PersistentVolume to reference an existing SeaweedFS filer path. The corresponding PersistentVolumeClaim must have an empty storageClassName and match the PV name. ```yaml # PersistentVolume referencing an explicit filer path apiVersion: v1 kind: PersistentVolume metadata: name: seaweedfs-static spec: accessModes: - ReadWriteMany capacity: storage: 1Gi csi: driver: seaweedfs-csi-driver volumeHandle: dfs-test # Unique identifier for this PV volumeAttributes: collection: default replication: "011" path: /path/to/files # Exact path on the SeaweedFS Filer diskType: "ssd" readOnly: false persistentVolumeReclaimPolicy: Retain volumeMode: Filesystem --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: seaweedfs-static spec: storageClassName: "" # Must be empty for static provisioning volumeName: seaweedfs-static # Must match PV name above accessModes: - ReadWriteMany resources: requests: storage: 1Gi ``` -------------------------------- ### Kubectl Commands for PVC and Pod Deployment Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt These commands are used to apply the SeaweedFS PVC, check its status, deploy the application pod, and verify the volume mount. ```bash kubectl apply -f deploy/kubernetes/sample-seaweedfs-pvc.yaml kubectl get pvc seaweedfs-csi-pvc # Wait for STATUS=Bound kubectl apply -f deploy/kubernetes/sample-busybox-pod.yaml kubectl exec my-csi-app -- df -h /data # Filesystem Size Used Avail Use% Mounted on # weedfs ... ... ... ... /data ``` -------------------------------- ### Verify Storage Mount in Busybox Pod Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Execute a command within the busybox pod to verify the storage mount. This checks if the volume is correctly mounted and accessible. ```bash $ kubectl exec my-csi-app -- df -h ``` -------------------------------- ### Add SeaweedFS CSI Driver Helm Repository Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/deploy/helm/seaweedfs-csi-driver/README.md Add the SeaweedFS CSI driver Helm repository to your local configuration and update it to fetch the latest chart information. ```bash helm repo add seaweedfs-csi-driver https://seaweedfs.github.io/seaweedfs-csi-driver/helm helm repo update ``` -------------------------------- ### StorageClass for Custom Provisioning Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Define a StorageClass with custom parameters for SeaweedFS provisioning. Use this to specify collection, replication, and disk type for dynamic provisioning. ```yaml kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: seaweedfs-special provisioner: seaweedfs-csi-driver parameters: collection: mycollection replication: "011" diskType: "ssd" ``` -------------------------------- ### Check CSI Driver Pod Status Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Verifies that all SeaweedFS CSI driver pods in the 'kube-system' namespace are running and ready. This is a crucial step after deployment. ```bash kubectl get po -n kube-system ``` -------------------------------- ### Helm values.yaml Configuration for SeaweedFS CSI Driver Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt Key configuration options for the SeaweedFS CSI driver when deployed via Helm. This includes filer address, TLS settings, performance tuning, and node-specific configurations. ```yaml # deploy/helm/seaweedfs-csi-driver/values.yaml (key options) # SeaweedFS filer address (required) seaweedfsFiler: "seaweedfs-filer.default.svc:8888" storageClassName: seaweedfs-storage isDefaultStorageClass: false # TLS: reference an existing Secret containing security.toml tlsSecret: "seaweedfs-tls-secret" # Or let the chart manage security.toml inline: security: enabled: true create: true type: secret content: | [jwt.signing.read] key = "my-jwt-read-key" [grpc.client] cert = "/usr/local/share/ca-certificates/tls.crt" key = "/usr/local/share/ca-certificates/tls.key" # Performance tuning cacheCapacityMB: 1024 # Local FUSE chunk cache size (0 = disabled) cacheMetaTtlSec: 60 # Metadata cache TTL in seconds concurrentWriters: 128 # Max concurrent write goroutines concurrentReaders: 128 # Max concurrent chunk fetch goroutines # DataLocality: make writes prefer local datacenter volume servers dataLocality: "write_preferLocalDc" node: hostPID: true # Required for container-side FUSE recovery updateStrategy: type: OnDelete # Recommended for nodes with active SeaweedFS PVs # Auto-inject topology from Kubernetes node labels (requires KubeMod) injectTopologyInfoFromNodeLabel: enabled: true labels: dataCenter: "topology.kubernetes.io/zone" # Non-standard kubelet root directories (e.g. k0s) volumes: registration_dir: /var/lib/kubelet/plugins_registry plugins_dir: /var/lib/kubelet/plugins pods_mount_dir: /var/lib/kubelet/pods mountService: enabled: true endpoint: unix:///var/lib/seaweedfs-mount/seaweedfs-mount.sock updateStrategy: type: OnDelete # Recommended to avoid disrupting active FUSE mounts ``` -------------------------------- ### Run SeaweedFS CSI Driver Controller Only Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt This command runs only the controller component, suitable for High Availability (HA) controller deployments. Specify multiple filer addresses if necessary. ```bash seaweedfs-csi-driver \ --filer=filer1:8888,filer2:8888 \ --endpoint=unix:///var/lib/csi/sockets/pluginproxy/csi.sock \ --components=controller \ --attacher=true ``` -------------------------------- ### Manual Node Draining for Safe Rolling Update Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt This sequence of kubectl commands outlines the manual process for updating nodes when using the `OnDelete` strategy. It involves cordoning, draining, deleting the old pod, and uncordoning the node to ensure a smooth transition. ```bash # 2. For each node (repeat until all nodes are updated): # Identify nodes with no active SeaweedFS PVs — delete their DS pods first kubectl get pod -n kube-system -o wide | grep seaweedfs-node # Cordon the node to prevent new workloads kubectl cordon # Evict or delete pods using SeaweedFS PVs on this node kubectl drain --ignore-daemonsets --delete-emptydir-data # Delete the DaemonSet pod to trigger recreation with the new image kubectl delete pod -n kube-system seaweedfs-node- # Uncordon the node kubectl uncordon # Verify the new pod is Running before moving to the next node kubectl get pod -n kube-system -l app=seaweedfs-node -o wide ``` -------------------------------- ### Enable DataLocality via Helm Chart Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt This Helm command upgrades the SeaweedFS CSI driver, enabling automatic data center label injection and setting the data locality preference. This simplifies configuration by leveraging Kubernetes topology information. ```bash # Helm: enable KubeMod-based automatic datacenter label injection helm upgrade seaweedfs-csi-driver ./deploy/helm/seaweedfs-csi-driver \ --set dataLocality=write_preferLocalDc \ --set node.injectTopologyInfoFromNodeLabel.enabled=true \ --set node.injectTopologyInfoFromNodeLabel.labels.dataCenter=topology.kubernetes.io/zone ``` -------------------------------- ### Set OnDelete Update Strategy for DaemonSet Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt This Helm command configures the `seaweedfs-node` DaemonSet to use the `OnDelete` update strategy. This is crucial for safe rolling updates, preventing disruption to pods with active SeaweedFS FUSE mounts. ```bash # 1. Set update strategy to OnDelete in values.yaml before upgrading: # node.updateStrategy.type: OnDelete helm upgrade seaweedfs-csi-driver ./deploy/helm/seaweedfs-csi-driver \ --set node.updateStrategy.type=OnDelete \ --set seaweedfsFiler=seaweedfs-filer.default.svc:8888 ``` -------------------------------- ### SeaweedFS CSI Driver Internal Health Monitor Logic Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt This Go code outlines the internal health monitor logic for the SeaweedFS CSI Driver's Node server. It details the sequence for recovering dead FUSE mounts, including detection, unmounting, cleanup, re-staging, and re-binding publish paths. It also mentions the independent recovery of dropped publish bind mounts and configuration options for health check intervals and timeouts. ```go // Internal: health monitor is started automatically by NewNodeServer. // The recovery sequence for a failed FUSE mount is: // 1. Detect unhealthy staging path via isHealthyFn (os.ReadDir with 5s timeout) // 2. Manager-level unmount (SIGTERM → SIGKILL weed mount process) // 3. Clean up stale staging path (os.RemoveAll) // 4. Re-stage: launch a fresh weed mount FUSE process // 5. Tear down stale publish bind mounts (host-side) // 6. Re-bind publish paths to the new staging path // 7. Remount inside pod containers via Linux namespace traversal (requires hostPID: true) // The health monitor also recovers dropped publish bind mounts independently // of staging health, re-binding without tearing down the FUSE process: // staging healthy + publish path dead → retryPublishPaths() // staging dead → recoverVolume() (full recovery) // Configure health check interval in Helm (default constants shown): // defaultHealthCheckInterval = 30 * time.Second // defaultHealthCheckTimeout = 5 * time.Second // To enable container-side FUSE remount, ensure hostPID=true (Helm default): // node.hostPID: true ``` -------------------------------- ### Map UID/GID via StorageClass Parameters Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt This YAML defines a StorageClass that overrides the driver's UID and GID mapping settings on a per-volume basis. It maps the container's root user (UID 0) to UID 1000 on the SeaweedFS Filer. ```yaml # Or via StorageClass parameters (per-volume override): kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: seaweedfs-mapped provisioner: seaweedfs-csi-driver parameters: uidMap: "0:1000" # Maps container root (uid=0) → filer uid 1000 gidMap: "0:1000" # Maps container root (gid=0) → filer gid 1000 ``` -------------------------------- ### PersistentVolume for Static Provisioning Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Define a PersistentVolume for static provisioning. This allows binding multiple PersistentVolumeClaims to a pre-defined volume with specific attributes like collection, replication, path, and disk type. ```yaml apiVersion: v1 kind: PersistentVolume metadata: name: seaweedfs-static spec: accessModes: - ReadWriteMany capacity: storage: 1Gi csi: driver: seaweedfs-csi-driver volumeHandle: dfs-test volumeAttributes: collection: default replication: "011" path: /path/to/files diskType: "ssd" readOnly: true persistentVolumeReclaimPolicy: Retain volumeMode: Filesystem ``` -------------------------------- ### Custom StorageClass for SeaweedFS Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt Define a custom StorageClass to control SeaweedFS collection name, replication factor, and disk type for provisioned volumes. The PVC must reference this StorageClass. ```yaml kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: seaweedfs-special provisioner: seaweedfs-csi-driver allowVolumeExpansion: true parameters: collection: mycollection # SeaweedFS collection name replication: "011" # Replication policy: 0 copies in same DC, 1 in another rack, 1 in another node diskType: "ssd" # Storage tier: "ssd", "hdd", or "" --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: my-special-pvc spec: accessModes: - ReadWriteMany resources: requests: storage: 10Gi storageClassName: seaweedfs-special ``` -------------------------------- ### PersistentVolumeClaim for Static Binding Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Define a PersistentVolumeClaim to bind to a pre-existing PersistentVolume. Ensure 'storageClassName' is empty and 'volumeName' matches the PersistentVolume. ```yaml apiVersion: v1 kind: PersistentVolumeClaim metadata: name: seaweedfs-static spec: storageClassName: "" volumeName: seaweedfs-static accessModes: - ReadWriteMany resources: requests: storage: 1Gi ``` -------------------------------- ### Uninstall SeaweedFS CSI Driver Resources Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Removes the SeaweedFS CSI driver and associated resources from your Kubernetes cluster. Ensure you have backed up any critical data before uninstalling. ```bash kubectl delete -f deploy/kubernetes/sample-busybox-pod.yaml kubectl delete -f deploy/kubernetes/sample-seaweedfs-pvc.yaml kubectl delete -f deploy/kubernetes/seaweedfs-csi.yaml ``` -------------------------------- ### Configure DataLocality in StorageClass Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt This YAML defines a StorageClass that overrides the driver's default data locality setting. It ensures that volumes provisioned with this class prefer writes to the local data center. ```yaml kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: seaweedfs-local-write provisioner: seaweedfs-csi-driver parameters: dataLocality: "write_preferLocalDc" collection: myapp ``` -------------------------------- ### Uninstall SeaweedFS CSI Driver using Helm Source: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/README.md Uninstalls the SeaweedFS CSI driver deployed via Helm. This command removes all associated resources managed by the Helm release. ```bash helm uninstall seaweedfs-csi-driver ``` -------------------------------- ### Configure DataLocality in PersistentVolume Source: https://context7.com/seaweedfs/seaweedfs-csi-driver/llms.txt This YAML defines a PersistentVolume with a data locality override. This setting has the highest precedence and applies specifically to this PV, ensuring writes are localized. ```yaml apiVersion: v1 kind: PersistentVolume metadata: name: seaweedfs-local-pv spec: accessModes: [ReadWriteMany] capacity: storage: 50Gi csi: driver: seaweedfs-csi-driver volumeHandle: /buckets/myapp-data volumeAttributes: dataLocality: "write_preferLocalDc" # Overrides StorageClass and Driver settings collection: myapp persistentVolumeReclaimPolicy: Retain ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.