5.8 KiB
Kubernetes Quick Start
This guide is for Kubernetes users who already have a test cluster and want to see what the current alpha can do.
The current demo path is intentionally small:
app pod -> PVC -> CSI -> iSCSI -> blockvolume -> WAL-backed storage
It proves that a normal application pod can mount a seaweed-block PVC, write
data, exit, and then a second pod can mount the same PVC and read the data back.
It does not claim production durability or failover-under-mount yet.
What Runs
The demo deploys:
blockmaster: the control-plane service that tracks desired volumes and publishes assignments.block-csicontroller: the CSI controller plugin plus Kubernetes CSI sidecars.block-csinode: the privileged CSI node plugin that runsiscsiadmand mounts the device for kubelet.- one launcher-generated
blockvolumeDeployment for the PVC. - two ordinary BusyBox app pods: writer first, reader second.
The writer and reader are not simultaneous. The PVC is ReadWriteOnce; the demo
uses pod replacement to show that data is on the volume, not just inside the
first pod.
Option A: Published Alpha Images
Use this when your cluster can pull public images from GHCR.
export KUBECONFIG="${KUBECONFIG:-/etc/rancher/k3s/k3s.yaml}"
bash scripts/run-k8s-demo-ghcr.sh "$PWD"
The script uses these images by default:
ghcr.io/seaweedfs/seaweed-block:alpha
ghcr.io/seaweedfs/seaweed-block-csi:alpha
If the GHCR packages are not public yet, use the local build path below.
Expected final line:
[app-demo] PASS: app pod wrote data, replacement app pod read it back through the same PVC, cleanup complete
Option B: Local k3s
Use this when your test node can build Docker images locally.
export KUBECONFIG="${KUBECONFIG:-/etc/rancher/k3s/k3s.yaml}"
bash scripts/build-alpha-images.sh "$PWD"
docker save sw-block:local | sudo k3s ctr images import -
docker save sw-block-csi:local | sudo k3s ctr images import -
bash scripts/run-k8s-demo.sh "$PWD"
Expected final line:
[app-demo] PASS: app pod wrote data, replacement app pod read it back through the same PVC, cleanup complete
Option C: Existing Cluster With Your Registry
Use this when your cluster pulls images from a registry.
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"
bash scripts/run-k8s-demo.sh "$PWD"
The runner renders the Kubernetes manifests with those image names before
applying them. The source manifests stay simple and still default to
sw-block:local for local labs.
What To Show In A Demo
The most understandable demo is:
bash scripts/run-k8s-demo.sh "$PWD"
Then show these artifacts:
cat /tmp/sw-block-app-demo-*/writer.log
cat /tmp/sw-block-app-demo-*/reader.log
sudo iscsiadm -m session || true
kubectl get all -A | grep sw-block || true
The proof is that both app logs contain:
/data/demo.bin: OK
The first pod wrote the file. The second pod mounted the same PVC later and verified it.
Use Your Own App
Install the alpha stack:
bash scripts/install-k8s-alpha.sh "$PWD"
Create a StorageClass and PVC:
kubectl apply -f examples/kubernetes/basic-app/storageclass-pvc.yaml
Until the operator exists, apply the blockvolume workload generated by blockmaster:
bash scripts/apply-k8s-alpha-blockvolumes.sh
Then start an app pod that mounts the PVC:
kubectl apply -f examples/kubernetes/basic-app/writer-pod.yaml
kubectl wait --for=jsonpath='{.status.phase}'=Succeeded pod/sw-block-example-writer --timeout=240s
kubectl logs sw-block-example-writer
To prove a replacement pod can read the same PVC:
kubectl delete pod sw-block-example-writer
kubectl apply -f examples/kubernetes/basic-app/reader-pod.yaml
kubectl wait --for=jsonpath='{.status.phase}'=Succeeded pod/sw-block-example-reader --timeout=240s
kubectl logs sw-block-example-reader
For the copyable YAML, see
examples/kubernetes/basic-app.
Current Alpha Limitations
- The generated
blockvolumeworkload is applied by the demo runner. A real operator should own this reconciliation. - By default, generated
blockvolumeDeployments carry a PVC owner reference, so Kubernetes garbage collection removes them after the PVC is deleted. - The demo uses single-node Kubernetes.
- The alpha manifest uses non-durable pod-local state for the generated
blockvolume. - Failover while a PVC remains mounted is not claimed.
- NVMe-oF is not part of this alpha path.
- Performance numbers from this demo are not a product SLO.
Cleanup
The runner performs cleanup automatically and records artifacts under
/tmp/sw-block-app-demo-*.
If you need to clean up manually:
kubectl delete pod sw-block-demo-writer sw-block-demo-reader --ignore-not-found=true
kubectl delete pvc sw-block-demo-pvc --ignore-not-found=true
kubectl delete deploy -A -l app=sw-blockvolume --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
sudo iscsiadm -m session || true
For a full alpha stack uninstall:
bash scripts/uninstall-k8s-alpha.sh "$PWD"
The scripted demo applies rendered manifests under its artifact directory. If you used custom image names, delete those rendered files instead of the source YAML:
kubectl delete -f "$ARTIFACT_DIR/csi-controller.rendered.yaml" --ignore-not-found=true
kubectl delete -f "$ARTIFACT_DIR/csi-node.rendered.yaml" --ignore-not-found=true