feat: embed k3s to run soul-demo as self-healing k8s pods #13
Reference in New Issue
Block a user
Delete Branch "feat/k3s-embedded-soul"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
• Embeds k3s (v1.32.4) in the neuron-web Docker image so soul-demo runs as a managed Kubernetes Deployment instead of a bare background process
• k3s starts first in entrypoint.sh, imports the pre-bundled soul-demo:local OCI tar (no registry needed), and auto-applies the Deployment + NodePort Service + HPA from the server/manifests dir
• neuron-web only starts after the soul-demo pod reports Running — clean startup sequencing
Architecture changes
• soul-demo — now a k3s Deployment (1–8 replicas, HPA at 60% CPU), restarts automatically on crash, liveness/readiness probes on /healthz:7772
• neuron-web — unchanged, still calls localhost:7772 via the k3s NodePort service
• Build pipeline — build-stage.sh gains a post-build step: extracts the soul-demo binary from the just-built image, builds soul-demo:local via dist/Dockerfile.soul-demo, saves it as dist/soul-demo-image.tar, which is then COPY'd into the final image
• Cloud Run — all deploys (stage + prod) now use --execution-environment gen2; required for k3s (/dev/kmsg + Linux capabilities not available on gen1/gVisor)
New files
• dist/Dockerfile.soul-demo — minimal image for soul-demo (debian:bookworm-slim + binary + snapshot)
• dist/k3s-soul-demo.yaml — Deployment, NodePort Service (nodePort 7772), and HPA manifests
Test plan
dafa27c30ctoc6ee45a374