# Kubernetes Quick Start **Use this when:** you install the Kubernetes alpha with Helm on a supported test cluster and want to create, verify and clean up a first PVC-backed volume. It shows the user loop: ```text generate Helm values -> helm install -> create a PVC-backed volume -> write data from one app pod -> read the same data from a replacement app pod -> inspect read-only report/dashboard evidence -> clean up ``` The current quickstart is for supported test clusters, not production. For the release boundary and exact QA evidence, see [`docs/releases/README.md`](releases/README.md). [`user-capabilities.md`](user-capabilities.md) contains the current operations command matrix. ## What This Proves The quickstart proves: - Helm can install the alpha blockmaster and CSI components. - A PVC can dynamically provision a Seaweed Block-backed PV. - A writer pod can mount the PVC and write `/data/demo.bin`. - A replacement reader pod can mount the same PVC and verify the same data. - Product-owned status evidence, a local read-only report, and a local read-only dashboard are available. - The report/dashboard include `operator-snapshot.json`, a read-only operator-facing status projection. It is not a mutating operator. - The gated operator-status path can publish the same read-only vocabulary into `SwBlockCluster` / `SwBlockVolume` `.status` and Kubernetes Events. It is status/events only and does not create CR objects or mutate storage. - The example resources and host-side residue are cleaned up. It does not prove production HA, backup/restore, broad upgrade safety, broad platform compatibility, a mutating operator, or a production UI; see [what you should not expect yet](kubernetes-status.md#what-you-should-not-expect-yet). ## Prerequisites Run from a Linux host with access to your Kubernetes cluster: - `kubectl` configured for the target cluster. - `helm` installed. - `sudo` access for iSCSI checks and cleanup. - `iscsiadm` available on nodes that will stage volumes. - the `sw-block` CLI and a checkout of the release tag (Step 0). **kubectl access.** On k3s, `/etc/rancher/k3s/k3s.yaml` is readable only by root unless k3s was installed with `--write-kubeconfig-mode 0644`. Give your user its own copy: ```bash mkdir -p ~/.kube && sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config sudo chown "$(id -u):$(id -g)" ~/.kube/config && chmod 600 ~/.kube/config export KUBECONFIG=$HOME/.kube/config kubectl get nodes ``` On other distributions, keep your existing `KUBECONFIG`. Then check the cluster: ```bash kubectl get nodes -o wide sudo iscsiadm -m session || true ``` Expected before starting: ```text at least one Ready node iscsiadm: No active sessions. ``` ## Step 0 - Get The Repository And The CLI > **v1.1.0 is affected: do not use it for this procedure.** Its generated > blockvolume pod cannot start: it cannot create `/run/sw-block` as uid 65532, > and its node TLS Secret must also be found in the app's namespace. Use the > first release that contains both fixes; its release notes name them. This > procedure is validated only on that release. Run everything from a checkout of the **release tag** you install, so the chart, the scripts and the images match. Set `TAG` to that release: ```bash TAG=v1.1.1 # not v1.1.0, see above git clone --depth 1 --branch $TAG https://github.com/seaweedfs/seaweed-block && cd seaweed-block ``` **The `sw-block` CLI.** Take it from the release tarball (see [operations manual, section 1](operations-manual.md#1-install-the-binaries-and-units) for the checksum step): ```bash curl -fsSLO https://github.com/seaweedfs/seaweed-block/releases/download/$TAG/sw-block-$TAG-linux-amd64.tar.gz curl -fsSLO https://github.com/seaweedfs/seaweed-block/releases/download/$TAG/SHA256SUMS sha256sum -c --ignore-missing SHA256SUMS && tar -xzf sw-block-$TAG-linux-amd64.tar.gz export PATH="$PWD:$PATH" sw-block --version ``` From v1.1.1 the archive holds `blockmaster`, `blockvolume` and `sw-block` at its top level, so it is extracted without `--strip-components`; only v1.1.0's archive kept them in a directory, and this quick start does not use v1.1.0. To build it instead, install the Go version that `go.mod` names, as in [appendix A of the operations manual](operations-manual.md#appendix-a-build-from-source), then run `go build -o sw-block ./cmd/sw-block`. ## Step 1 — Generate Helm Values From the repository root: ```bash sw-block ops generate-helm-values \ --out values.day1.yaml \ --image ghcr.io/seaweedfs/seaweed-block:$TAG \ --csi-image ghcr.io/seaweedfs/seaweed-block-csi:$TAG ``` Use the images of the same release as the checkout: the chart passes flags (for example `--tls-cert` and `--master-tls-cert`) that older images do not know, and such a pod restarts in a loop until `helm install --wait` times out. What this command does: - reads Kubernetes nodes through `kubectl get nodes -o wide`, - selects Ready schedulable nodes with non-loopback InternalIP, - writes `values.day1.yaml` for the Helm chart. Single-node behavior: - one selected node, - loopback iSCSI/status mode, - CHAP disabled. Multi-node behavior: - multiple selected nodes, - non-loopback iSCSI addresses (volume status stays on loopback), - CHAP enabled, - loopback publish-target rejection recorded in values. Inspect the generated values: ```bash grep -E "externalISCSI|externalStatus|replicationFactor|ackProfile|enabled:|internalIP" values.day1.yaml ``` To check what you pulled, compare the image index digests with the ones on the release page of `$TAG`. Use release tags (`vX.Y.Z`). A `sha-` tag exists only for some commits, and an old one does not match a newer chart. Mutable `:alpha` is a smoke/demo tag only. Do not use it as release evidence. ## Step 2 — Install Seaweed Block With Helm blockmaster listens on the pod network only with mutual TLS, so create its Secrets first. For a trial, the helper issues a development CA and one node certificate per server id. The server ids must be exactly the `blockNodes[].name` values in `values.day1.yaml` (or their `serverID`, where set). Read them from the file instead of typing them; `generate-helm-values` prints `node-a node-b node-c` as placeholders: ```bash NODES=$(awk '/^blockNodes:/{f=1; next} f && /^[^ -]/{f=0} f && /^ *- name:/{print $3}' values.day1.yaml) echo $NODES # your node names, for example node-a node-b node-c bash scripts/k8s-alpha-certs.sh kube-system ~/.sw-block-alpha-tls $NODES ``` It applies `sw-block-master-tls`, `sw-block-roles`, one Secret per in-cluster client (`sw-block-csi-controller-tls`, `sw-block-csi-node-tls`, `sw-block-operator-status-tls`, `sw-block-failback-executor-tls`, each with the least role it needs) and `sw-block-node-tls-`. Keep the directory private: a node key controls that host's volumes. For production, issue them from your own CA ([operator guide](operator-guide.md#authenticate-the-control-api)). ```bash helm install sw-block charts/seaweed-block \ --namespace kube-system \ --create-namespace \ -f values.day1.yaml \ --wait \ --timeout 10m ``` Check readiness: ```bash kubectl -n kube-system get deploy,ds,pods -l app.kubernetes.io/instance=sw-block -o wide kubectl get storageclass ``` Expected: ```text sw-blockmaster ready sw-block-csi-controller ready sw-block-csi-node ready on selected nodes StorageClass present ``` ## Step 3 — Create And Verify The First Volume Run the first-volume helper in Helm mode: ```bash SW_BLOCK_INSTALL_MODE=helm \ SW_BLOCK_HELM_RELEASE=sw-block \ SW_BLOCK_HELM_NAMESPACE=kube-system \ SW_BLOCK_HELM_VALUES_FILE=values.day1.yaml \ bash scripts/run-basic-app-example.sh "$PWD" ``` The `"$PWD"` argument is the repository root. The helper uses it to locate the example manifests and chart metadata. The helper applies the example StorageClass/PVC, waits for the PVC to bind, runs a writer pod, deletes it, runs a reader pod, collects status evidence, generates a local report, and cleans the example resources by default. Its status calls reach blockmaster with mutual TLS, using the `operator-status` viewer certificate that Step 2 wrote to `~/.sw-block-alpha-tls`; the helper logs `status_tls_cert=` with the file it uses. To use other files, set `SW_BLOCK_TLS_DIR`, or `SW_BLOCK_TLS_CERT`, `SW_BLOCK_TLS_KEY` and `SW_BLOCK_TLS_CA`. Current helper scope: the example app resources use the `default` namespace. Use the documented example as-is for the v0.3 alpha gate. Cross-namespace helpers are a later usability enhancement; Kubernetes can still consume the installed CSI driver from other namespaces through normal PVC manifests. Expected final line: ```text [basic-app] PASS: basic app PVC writer/reader loop complete ``` Read the first-volume summary: ```bash APP_DIR="$(ls -td /tmp/sw-block-basic-app-* | head -1)" cat "$APP_DIR/first-volume-summary.txt" ``` Expected fields: ```text first_volume_status=ok pvc=sw-block-example-pvc pvc_phase=Bound writer_verified=true reader_verified=true inventory_status=unhealthy status_evidence=status/cluster-evidence.json,status/inventory cluster_evidence=status/cluster-evidence.json inventory_bundle=status/inventory status_report=status/report/index.html operator_snapshot=status/report/operator-snapshot.json cleanup_status=ok ``` `cleanup_status=ok` means the helper deleted the example pods, PVC and StorageClass. The volume itself may stay: in v1.1.x, deleting a provisioned volume's PVC can answer `delete pending`, and the PV then stays `Released` (a known limitation; see [Cleanup](#cleanup)). `inventory_status=unhealthy` is expected in Helm mode, also on the first run: the helper runs `sw-block ops inventory --namespace default` (the app's namespace), while a Helm install runs the generated blockvolume Deployments in the release namespace (`kube-system`). The inventory then lists, for a volume that is serving, `generated_deployment_missing` and `observed_replicas=0` in `$APP_DIR/status/inventory/volume-inventory-summary.txt`. The inventory takes one namespace, so no flag shows both today. The proof of this step is `writer_verified=true` and `reader_verified=true`, and `kubectl -n kube-system get pods -o wide | grep sw-blockvolume` shows the volume's generated pod `Running`. The writer and reader are ordinary app pods. The reader is a replacement pod, so this proves the data is on the PVC-backed volume, not only in the writer container. ## Step 4 — Inspect Report Or Dashboard The first-volume helper writes a status report: ```bash ls "$APP_DIR/status/report" cat "$APP_DIR/status/report/summary.txt" ``` Expected files: ```text index.html cluster-evidence.json timeline.jsonl operator-snapshot.json summary.txt ``` `sw-block ops report` writes static artifacts. `sw-block ops dashboard` serves the same evidence locally over HTTP. `operator-snapshot.json` uses the same ManagedVolume status vocabulary as the report/dashboard and is the status-only foundation for future Kubernetes operator work. Important status vocabulary: - `Ready=True reason=first_volume_verified` means the report has positive writer/reader evidence for the volume. - `Blocked=True reason=` means the product found a known blocker, such as `csi_node_image_pull_failed`. - `EvidenceStale=True` or `Ready=Unknown` means the evidence is missing, stale, or still reconverging. The alpha status surface should not claim `Ready=True` without current evidence. Serve the collected bundle: ```bash sw-block ops dashboard --from-bundle "$APP_DIR" --listen 127.0.0.1:9334 ``` `$APP_DIR` is the basic-app artifact root. The dashboard/report loader finds the nested `status/report/`, `status/cluster-evidence.json`, and inventory artifacts under that root. Open: ```text http://127.0.0.1:9334/ ``` The dashboard is read-only. It has no promote, repair, rebuild, delete, failback, backup, restore, or cleanup controls. To generate live evidence from blockmaster: ```bash kubectl -n kube-system port-forward deploy/sw-blockmaster 9333:9333 ``` In another terminal: ```bash MASTER_TLS=(--master-tls-cert "$HOME/.sw-block-alpha-tls/operator-status.crt" --master-tls-key "$HOME/.sw-block-alpha-tls/operator-status.key" --master-ca "$HOME/.sw-block-alpha-tls/ca.crt") sw-block ops cluster --master-api 127.0.0.1:9333 "${MASTER_TLS[@]}" sw-block ops report --master-api 127.0.0.1:9333 "${MASTER_TLS[@]}" --out /tmp/sw-block-report sw-block ops dashboard --master-api 127.0.0.1:9333 "${MASTER_TLS[@]}" --listen 127.0.0.1:9334 ``` These read-only commands use the viewer certificate issued for `operator-status` in Step 2. Keep its private key local. The flags default to `SW_BLOCK_TLS_CERT`, `SW_BLOCK_TLS_KEY`, and `SW_BLOCK_TLS_CA` when set. Supply all three TLS files; the client verifies the master certificate against the CA. ## Use Your Own PVC The standard volume creation path is Kubernetes PVC creation. Start from the example, which is written for the `default` namespace and uses the StorageClass the chart installed (`sw-block-dynamic`, which carries the CHAP Secret that nodes need to mount a volume when the install has several nodes): ```bash kubectl apply -f examples/kubernetes/basic-app/pvc.yaml kubectl get pvc sw-block-example-pvc ``` `storageclass-pvc.yaml` in the same directory is the Step 3 helper's input: the helper adds the CHAP Secret to its StorageClass before applying it. Applied as-is on an install with several nodes, its volumes cannot be mounted (`iSCSI login failed due to authorization failure`). Then mount the PVC from your own pod, or use the example writer and reader: ```bash 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 WRITER_NODE=$(kubectl get pod sw-block-example-writer -o jsonpath='{.spec.nodeName}') kubectl delete pod sw-block-example-writer ``` **Several nodes: read on another node.** To show that the data follows the volume, run the reader on a node other than the writer's. The node must be Ready and run a CSI node plugin pod: setting `spec.nodeName` bypasses the scheduler, so pick it from the plugin pods: ```bash READER_NODE=$(kubectl -n kube-system get pods -l app=sw-block-csi-node --field-selector=status.phase=Running \ -o jsonpath='{range .items[*]}{.spec.nodeName}{"\n"}{end}' | grep -vx "$WRITER_NODE" | while read -r n; do test "$(kubectl get node "$n" -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}')" = True && echo "$n" done | head -1) echo "reader node: ${READER_NODE:-none eligible}" test -n "$READER_NODE" && kubectl patch --local -f examples/kubernetes/basic-app/reader-pod.yaml --type merge \ -p "{\"spec\":{\"nodeName\":\"$READER_NODE\"}}" -o yaml | kubectl apply -f - kubectl wait --for=jsonpath='{.status.phase}'=Succeeded pod/sw-block-example-reader --timeout=240s kubectl logs sw-block-example-reader echo "writer ran on $WRITER_NODE, reader on $(kubectl get pod sw-block-example-reader -o jsonpath='{.spec.nodeName}')" ``` If it prints `none eligible`, no other node qualifies, and the cross-node read is not shown; use the single-node path below. **One node:** apply `examples/kubernetes/basic-app/reader-pod.yaml` unchanged. The reader then runs on the writer's node. The helper in Step 3 does not choose nodes either. When you are done with the example, delete its pods and its PVC before you uninstall (see [Cleanup](#cleanup); in v1.1.x the volume itself may stay): ```bash kubectl delete -f examples/kubernetes/basic-app/writer-pod.yaml -f examples/kubernetes/basic-app/reader-pod.yaml --ignore-not-found kubectl delete -f examples/kubernetes/basic-app/pvc.yaml --ignore-not-found ``` The generated `blockvolume` workload is reconciled by blockmaster. You should not manually apply generated blockvolume YAML on the supported alpha path. ## Script Fallback Path The script path remains available for development, local images, and fallback diagnostics: ```bash bash scripts/activate-k8s-alpha.sh "$PWD" bash scripts/run-basic-app-example.sh "$PWD" ``` The `"$PWD"` argument is the repository root for both helper scripts. Use Helm unless you are specifically testing local script activation. ## Troubleshooting Start with the latest basic-app artifact directory: ```bash APP_DIR="$(ls -td /tmp/sw-block-basic-app-* | head -1)" cat "$APP_DIR/first-volume-summary.txt" 2>/dev/null || true find "$APP_DIR" -maxdepth 3 -type f | sort ``` Common evidence: ```bash cat "$APP_DIR/status/cluster-evidence.json" 2>/dev/null || true cat "$APP_DIR/status/inventory/volume-inventory-summary.txt" 2>/dev/null || true cat "$APP_DIR/diagnostics/writer/writer-describe.txt" 2>/dev/null || true cat "$APP_DIR/diagnostics/reader/reader-describe.txt" 2>/dev/null || true ``` If a pod cannot mount the PVC, `writer-describe.txt` or `reader-describe.txt` should include the Kubernetes event explaining why, such as image pull failure, iSCSI connection failure, missing CHAP secret, or scheduling mismatch. Attach the artifact directory and any `/tmp/sw-block-report` output when filing an issue. **After a failed helper run**, the example resources stay (StorageClass, PVC and PV, the writer or reader pod, the generated blockvolume Deployment). Remove them before running the helper again or uninstalling: ```bash kubectl delete pod sw-block-example-writer sw-block-example-reader --ignore-not-found kubectl delete -f examples/kubernetes/basic-app/storageclass-pvc.yaml --ignore-not-found kubectl get pv,deploy -A | grep sw-block-example || echo "example resources gone" ``` The PV and the generated Deployment may stay: in v1.1.x a provisioned volume's PVC delete can answer `delete pending` (its generated blockvolume pod has claimed the volume, which can happen before any app pod mounts it), and the PV then stays `Released`. See [Cleanup](#cleanup). ## Cleanup Delete your own PVCs first, for example the [own-PVC example](#use-your-own-pvc)'s `kubectl delete -f examples/kubernetes/basic-app/pvc.yaml`: a PV whose PVC still exists stays `Bound` and cannot be removed below. The first-volume helper cleans the example resources by default (after a failed run, see Troubleshooting first). To uninstall the alpha stack: ```bash helm uninstall sw-block --namespace kube-system bash scripts/uninstall-k8s-alpha.sh "$PWD" # the Step 2 TLS Secrets: the uninstall leaves them kubectl -n kube-system delete secret sw-block-master-tls sw-block-roles sw-block-csi-controller-tls \ sw-block-csi-node-tls sw-block-operator-status-tls sw-block-failback-executor-tls --ignore-not-found kubectl -n kube-system get secret -o name | grep '^secret/sw-block-node-tls-' | xargs -r kubectl -n kube-system delete bash scripts/verify-helm-cleanup.sh ``` **Volumes that stay (v1.1.x).** A provisioned volume may outlive its PVC: the PVC delete answers `delete pending` and the PV stays `Released`. After `helm uninstall` its generated blockvolume Deployment keeps running with no blockmaster left, and the verifier reports `k8s_residue_count` and `process_residue_count` above 0. v1.1.x has no command that removes such a volume. Removing one by hand discards its data: do it one volume at a time, and only after each check below passes. 1. The release is uninstalled: `kubectl -n kube-system get deploy sw-blockmaster` answers `NotFound`. 2. The PV is this install's and `Released`: `kubectl get pv -o jsonpath='{.spec.csi.driver} {.status.phase} {.spec.claimRef.namespace}/{.spec.claimRef.name} {.spec.claimRef.uid}'` shows `block.csi.seaweedfs.com Released`, a PVC you deleted, and that PVC's UID. 3. Its generated Deployment was made for that PVC: `kubectl -n kube-system get deploy -l sw-block.seaweedfs.com/volume= -o yaml` shows the annotation `sw-block.seaweedfs.com/pvc-uid` with the same UID. Before deleting it, note its node and its state path, which the node steps below need: `kubectl -n kube-system get deploy -l sw-block.seaweedfs.com/volume= -o jsonpath='{.items[0].spec.template.spec.nodeSelector.kubernetes\.io/hostname} {.items[0].spec.template.spec.volumes[?(@.name=="state")].hostPath.path}'` (the path is `/var/lib/sw-block/k8s/volumes` with the default values). Delete that Deployment, and wait until `kubectl -n kube-system get pods -l sw-block.seaweedfs.com/volume=` lists nothing. 4. Only then delete the PV. No driver is left to finish the delete, so remove its finalizers: `kubectl delete pv --wait=false`, then `kubectl patch pv --type merge -p '{"metadata":{"finalizers":null}}'`. Never remove the finalizers of a PV that fails a check above. **On each node** that ran the volume's generated blockvolume pod or mounted the volume, and on blockmaster's node (its `blockmaster.nodeSelector`), as root: 1. No `blockvolume` or `blockmaster` process runs (`pgrep -x blockvolume` and `pgrep -x blockmaster` print nothing), and the volume's lock is not held (`flock -n /run/sw-block/locks/.lock true` succeeds, or the file does not exist). 2. Nothing mounts the volume's device. While `iscsiadm -m session` lists the volume's target, find the device: `readlink -f /dev/disk/by-path/*-lun-*` (for example `/dev/sdc`). `findmnt -S ` must print nothing: it lists the staging mount and every published or bind mount of that device. If it lists any, unmount each listed target (`umount `) and check again. If a session exists but its device cannot be found, stop. The mount paths do not contain the PV name, so a name search is no proof. 3. For each record of the volume's target (`iscsiadm -m node | grep ':$'` prints `, `): if `iscsiadm -m session` lists the target, log it out first (`iscsiadm -m node -T -p --logout`), then delete the record (`iscsiadm -m node -T -p -o delete`). Both must succeed, and the target must no longer appear in `iscsiadm -m session` or `iscsiadm -m node`. The uninstall script does this only on the host it runs on. 4. Then remove the volume's own state and lock, on the node you noted: `//-/`, with the state path read from the Deployment above (not `restartPersistence.stateHostPath`, which is empty by default), and `/run/sw-block/locks/.lock`. On blockmaster's node, once every volume is removed, remove blockmaster's stores: the `blockmaster.stateHostPath` directory (it holds `authority/` and `lifecycle/`). Use the paths from your values, and never remove a directory another install uses. Two things stay on purpose: - **The custom resource definitions.** Helm never deletes CRDs, and the uninstall script removes only `swblockreplicafailbacks`. The other five (`swblockclusters`, `swblockfrontendpublications`, `swblockreplicaeligibilities`, `swblockreplicarebuilds`, `swblockvolumes`, all `.block.seaweedfs.com`) stay, and a later install reuses them. To remove them, and every object of those kinds: `kubectl delete -f charts/seaweed-block/crds/ --ignore-not-found`. - **An empty kubelet plugin directory** on each node, `/var/lib/kubelet/plugins/block.csi.seaweedfs.com`. It holds nothing; remove it on each node with `sudo rmdir /var/lib/kubelet/plugins/block.csi.seaweedfs.com` if you want. The verifier's `hostpath_residue_count` does not look at it. The uninstall script removes Kubernetes resources and scrubs Seaweed Block iSCSI sessions and iSCSI node DB records on the host it runs on. The verifier checks the same residue classes used by release QA, on that host; its `hostpath_residue_count` does not look at the state paths. Manual spot checks, on every node: ```bash kubectl get sc | grep sw-block || echo "no sw-block StorageClass" kubectl get deploy -A | grep sw-block || echo "no sw-block deployments" sudo iscsiadm -m session || true sudo iscsiadm -m node | grep io.seaweedfs || echo "no Seaweed Block iSCSI node records" ``` Expected clean state: ```text cleanup_status=ok k8s_residue_count=0 iscsi_residue_count=0 multipath_residue_count=0 process_residue_count=0 hostpath_residue_count=0 no sw-block StorageClass no sw-block deployments iscsiadm: No active sessions. no Seaweed Block iSCSI node records ``` and on every node, the removed volumes' state directories and lock files are gone. Do not run broad cluster cleanup commands in a shared cluster unless you know no other run owns the resources. ## Current Alpha Limitations This is an alpha Helm path, not a production installer or operator. The dashboard is local and read-only. Broad upgrade and rollback safety are not claimed beyond the gated alpha smoke path, and performance, RTO and SLO numbers are not claimed. The full list is in [what you should not expect yet](kubernetes-status.md#what-you-should-not-expect-yet).