Files
seaweedfs/seaweed-block/examples/kubernetes/basic-app/README.md
T
Ping QiuandClaude Opus 5.5 a5686e7fa7 Sync seaweed-block v1.1.1 into seaweed-block/ (#13411)
Brings seaweed-block main (v1.1.1 plus the docs and a test fix after it)
into seaweed-block/ as one commit. Only files under seaweed-block/ change,
and the subtree equals seaweed-block main exactly. The module's full
history stays in the seaweed-block repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 19:04:53 -08:00

101 lines
2.5 KiB
Markdown

# Basic Kubernetes App Example
This example shows the smallest application-facing shape:
```text
StorageClass -> PVC -> writer pod -> reader pod
```
It assumes the seaweed-block alpha stack is already installed in the cluster.
For the full install-and-demo flow, run:
```bash
bash scripts/run-k8s-demo.sh "$PWD"
```
To install the alpha stack and keep it running for this example:
```bash
bash scripts/activate-k8s-alpha.sh "$PWD"
```
## Apply
On a Helm install (the [Kubernetes quick start](../../../docs/quickstart-kubernetes.md)), use the
PVC on the chart's StorageClass, which carries the CHAP Secret that nodes need to mount a volume
when the install has several nodes:
```bash
kubectl apply -f pvc.yaml
kubectl apply -f writer-pod.yaml
```
`storageclass-pvc.yaml` brings its own StorageClass without that Secret. The first-volume helper
(`scripts/run-basic-app-example.sh`) adds the Secret before applying it, and on a single-node
install (no CHAP) it applies as-is:
```bash
kubectl apply -f storageclass-pvc.yaml
kubectl apply -f writer-pod.yaml
```
Wait for the writer:
```bash
kubectl wait --for=jsonpath='{.status.phase}'=Succeeded pod/sw-block-example-writer --timeout=240s
kubectl logs sw-block-example-writer
```
Expected:
```text
/data/demo.bin: OK
```
Delete the writer pod but keep the PVC:
```bash
kubectl delete pod sw-block-example-writer
```
Start the reader pod against the same PVC:
```bash
kubectl apply -f reader-pod.yaml
kubectl wait --for=jsonpath='{.status.phase}'=Succeeded pod/sw-block-example-reader --timeout=240s
kubectl logs sw-block-example-reader
```
Expected:
```text
/data/demo.bin: OK
```
The second pod reading the checksum proves the data came from the PVC, not from
the first pod's container filesystem.
## Cleanup
```bash
kubectl delete pod sw-block-example-reader --ignore-not-found=true
kubectl delete pod sw-block-example-writer --ignore-not-found=true
kubectl delete pvc sw-block-example-pvc --ignore-not-found=true
kubectl delete storageclass sw-block-example --ignore-not-found=true
```
The product-owned launcher should remove PVC-owned generated blockvolume
Deployments after the PVC is deleted. If you are using this example manually,
inspect generated workloads before uninstall:
```bash
kubectl get deploy -A -l app=sw-blockvolume
```
## Alpha Notes
- `ReadWriteOnce` is the intended mode.
- The example uses a tiny `1Mi` PVC because this is a functional smoke, not a
capacity or performance benchmark.
- Current alpha storage is not production durable.