Files
seaweedfs/seaweed-block/deploy/k8s/alpha
..

Seaweed Block Kubernetes Alpha

This directory contains the current alpha Kubernetes deployment path for seaweed-block.

It is intentionally small:

  • one blockmaster
  • one CSI controller Deployment
  • one CSI node DaemonSet
  • dynamic PVC provisioning through CSI CreateVolume
  • launcher-generated blockvolume Deployment
  • iSCSI mount into a pod
  • CSI DeleteVolume cleanup path exercised by the alpha smoke harness

The verified lab path is M02 single-node k3s. Treat this as an alpha MVP for evaluation and contributor onboarding, not production storage.

Current Storage Path

Pod -> PVC -> CSI controller/node -> iscsiadm -> blockvolume -> walstore

Current defaults:

  • frontend protocol: iSCSI
  • durable implementation: walstore
  • launcher-generated blockvolume state: emptyDir
  • replication factor in demo StorageClass: 1
  • Kubernetes topology: single-node lab

Prerequisites

  • Linux Kubernetes node
  • privileged CSI node plugin is allowed
  • iscsi_tcp kernel module is loadable
  • kubectl can reach the cluster
  • container images are available to the cluster:
    • sw-block:local
    • sw-block-csi:local

For a default k3s install:

export KUBECONFIG="${KUBECONFIG:-/etc/rancher/k3s/k3s.yaml}"

For the fastest path, use the published alpha images:

bash scripts/run-k8s-demo-ghcr.sh "$PWD"

This uses ghcr.io/seaweedfs/seaweed-block:alpha and ghcr.io/seaweedfs/seaweed-block-csi:alpha.

For local k3s/kind-style testing, build images with:

bash scripts/build-alpha-images.sh "$PWD"

For k3s, prefer the pinned build/import form:

SW_BLOCK_IMPORT_K3S=1 \
SW_BLOCK_ARTIFACT_DIR=/tmp/sw-block-alpha-build \
  bash scripts/build-alpha-images.sh "$PWD"

The artifact directory records image IDs and component --version output, so a later smoke failure can distinguish product behavior from a stale runtime image.

For a cluster that pulls from a registry, set the image names before running the scripted demo:

export SW_BLOCK_IMAGE=registry.example.com/storage/sw-block:alpha
export SW_BLOCK_CSI_IMAGE=registry.example.com/storage/sw-block-csi:alpha

bash scripts/build-alpha-images.sh "$PWD"
docker push "$SW_BLOCK_IMAGE"
docker push "$SW_BLOCK_CSI_IMAGE"

The scripted runners render manifests with these image names. If you apply the YAML files manually, replace sw-block:local and sw-block-csi:local yourself.

Deploy

blockmaster runs with mutual TLS: scripts/install-k8s-alpha.sh applies the Secrets with scripts/k8s-alpha-certs.sh (development CA, keys under $SW_BLOCK_TLS_DIR, default ~/.local/state/sw-block-alpha-tls). By hand, run bash scripts/k8s-alpha-certs.sh kube-system <dir> <node name> first.

The blockmaster manifest contains a __NODE_NAME__ placeholder for the lab node. Render it first:

NODE_NAME="$(kubectl get nodes -o jsonpath='{.items[0].metadata.name}')"
sed "s/__NODE_NAME__/${NODE_NAME}/g" \
  deploy/k8s/alpha/block-stack.yaml > /tmp/sw-block-stack.yaml

Apply the service stack:

kubectl apply -f /tmp/sw-block-stack.yaml
kubectl apply -f deploy/k8s/alpha/rbac.yaml
kubectl apply -f deploy/k8s/alpha/csi-driver.yaml
kubectl apply -f deploy/k8s/alpha/csi-controller.yaml
kubectl apply -f deploy/k8s/alpha/csi-node.yaml

Wait for readiness:

kubectl -n kube-system wait --for=condition=available deploy/sw-blockmaster --timeout=120s
kubectl -n kube-system wait --for=condition=available deploy/sw-block-csi-controller --timeout=120s
kubectl -n kube-system rollout status ds/sw-block-csi-node --timeout=120s

Run The Demo PVC

kubectl apply -f deploy/k8s/alpha/demo-dynamic-pvc-pod.yaml

The first dynamic PVC causes the CSI controller to ask blockmaster to create a lifecycle volume. Blockmaster writes a generated blockvolume Deployment manifest under /manifests; until a real operator exists, apply that generated manifest manually:

kubectl -n kube-system exec deploy/sw-blockmaster -c blockmaster -- \
  sh -c 'cat /manifests/*.yaml' > /tmp/sw-block-generated-blockvolume.yaml
kubectl apply -f /tmp/sw-block-generated-blockvolume.yaml
kubectl -n kube-system wait --for=condition=available deploy -l app=sw-blockvolume --timeout=120s

Wait for the demo pod:

kubectl wait --for=jsonpath='{.status.phase}'=Succeeded pod/sw-block-dynamic-smoke --timeout=240s
kubectl logs sw-block-dynamic-smoke

Expected log:

/data/payload.bin: OK

Cleanup

The current alpha harness performs an explicit cleanup sweep for the generated blockvolume Deployment. A future operator should own that reconciliation instead of the smoke script.

kubectl delete pod sw-block-dynamic-smoke --ignore-not-found=true
kubectl delete pvc sw-block-dynamic-v1 --ignore-not-found=true
kubectl -n kube-system delete deploy -l app=sw-blockvolume --ignore-not-found=true
kubectl delete -f deploy/k8s/alpha/demo-dynamic-pvc-pod.yaml --ignore-not-found=true
kubectl delete -f deploy/k8s/alpha/csi-node.yaml --ignore-not-found=true
kubectl delete -f deploy/k8s/alpha/csi-controller.yaml --ignore-not-found=true
kubectl delete -f deploy/k8s/alpha/csi-driver.yaml --ignore-not-found=true
kubectl delete -f deploy/k8s/alpha/rbac.yaml --ignore-not-found=true
kubectl delete -f /tmp/sw-block-stack.yaml --ignore-not-found=true

Check iSCSI cleanup:

sudo iscsiadm -m session || true

Verified Evidence

The scripted version of this flow is:

bash scripts/run-k8s-alpha.sh "$PWD"

For a larger storage-path check that keeps the same stack but uses a 256 MiB PVC and writes a 32 MiB checksum payload:

bash scripts/run-k8s-alpha-large.sh "$PWD"

For a presentation-friendly app demo that uses the same storage stack but shows two ordinary app pods sharing one PVC over time:

bash scripts/run-k8s-demo.sh "$PWD"

Known green:

  • create/write/read: a3d1e6a
  • create/write/read/delete cleanup: ddec28c

Non-Claims

This alpha MVP does not yet claim:

  • production-ready durability
  • multi-node Kubernetes operation
  • failover while a pod remains mounted
  • automatic failover when the primary node or pod is lost: blockmaster does not reassign on a primary it cannot read; failover is a manual admin action (a SwBlockReplicaFailback with the expected current line, applied for the failback executor, which calls blockmaster's admin ExecuteFailback); when the primary is unreachable that failover runs the fencing round first and moves only to a ready replica holding the highest fenced end (a best_effort volume, and a reachable RF3 sync_quorum primary, are refused; the round stops the old primary's writes, not its reads, so confirm the old node is off or cut from its clients first)
  • real operator reconciliation
  • backend data shredding on delete
  • snapshots, clone, resize, block mode, topology spread, or NVMe-oF
  • performance or soak readiness