Files
raea/sdk/cloud/deploy/k8s.gpu.yaml
shinyobjectz 3725537f35 sdk/cloud: renders on a GPU or a CPU from one image, render jobs, and a CPU box that hands its renders to a GPU worker (docs/cloud.feature CL13-CL15)
- The image is Node 24 on Debian trixie with glvnd and X11's libraries (libxext6 libx11-6 libgl1 libegl1), without
  which NVIDIA's Vulkan driver (mounted by the container runtime) doesn't load or gives no vkCreateInstance (driver
  610.57 on Modal's T4, A10G and A10). The entrypoint opens NVIDIA's driver when the host passed a GPU in, else Mesa's;
  WGPU_BACKEND=vulkan, and on the CPU EGL's vendors are hidden, since NVIDIA's EGL would hand wgpu an OpenGL adapter
  over llvmpipe. RAEA_CLOUD_DEVICE=gpu fails at start on no GPU; /v1/health says the device.
- /v1/jobs takes a project as a tar and gives back what the render made (CL14); deploy/modal/raea_cloud.py runs it on
  a Modal GPU list (L4, else A10G, else T4), one container that sleeps after five idle minutes.
- RAEA_CLOUD_GPU_URL on a CPU box sends raea render to the worker and lands its files back (CL15, image/raea.sh and
  server/offload.ts); deploy/k8s.gpu.yaml is such a worker.
- test/smoke.sh: worker and box, ten checks, all pass on 0.1.1-rc3. On Modal, test/gpu/edit.tsx (576 lit blocks,
  1080p, 90 frames): T4 156 s against llvmpipe on the same machine's 8 cores 203 s; a box on a Mac handed it to an A10
  (119 s) and the MP4 came back.
2026-11-10 21:52:21 -08:00

52 lines
2.0 KiB
YAML

# A GPU render worker for raea cloud on Kubernetes (docs/cloud.feature CL13, CL15): the same image on a node with an
# NVIDIA GPU, no agent and no volume, that k8s.yaml's server hands its renders to. The node needs NVIDIA's driver and
# its device plugin (or the GPU Operator); the image asks for the graphics capability, so Vulkan sees the card.
#
# kubectl create secret generic raea-cloud-gpu --from-literal=RAEA_CLOUD_TOKEN=$(openssl rand -hex 32)
# kubectl apply -f deploy/k8s.gpu.yaml
#
# then uncomment RAEA_CLOUD_GPU_URL and RAEA_CLOUD_GPU_TOKEN in k8s.yaml and apply it again. RAEA_CLOUD_DEVICE=gpu
# makes a pod whose GPU doesn't open fail to start, so it never renders on its CPU unnoticed. Scale it to 0 replicas
# between batches of renders (kubectl scale deploy/raea-cloud-gpu --replicas=0); the server then fails its renders
# with a line saying the worker didn't answer, unless it sets RAEA_CLOUD_GPU_FALLBACK=cpu.
apiVersion: apps/v1
kind: Deployment
metadata:
name: raea-cloud-gpu
spec:
# one replica: a render job is followed on the pod that runs it
replicas: 1
strategy: { type: Recreate }
selector:
matchLabels: { app: raea-cloud-gpu }
template:
metadata:
labels: { app: raea-cloud-gpu }
spec:
securityContext: { runAsUser: 1000, runAsGroup: 1000, fsGroup: 1000 }
containers:
- name: raea
image: ghcr.io/YOUR-ORG/raea-cloud:0.1.1
ports:
- containerPort: 8080
envFrom:
- secretRef: { name: raea-cloud-gpu }
env:
- { name: RAEA_CLOUD_DEVICE, value: gpu }
readinessProbe:
httpGet: { path: /healthz, port: 8080 }
periodSeconds: 10
resources:
requests: { cpu: "4", memory: 8Gi }
limits: { memory: 16Gi, nvidia.com/gpu: 1 }
terminationGracePeriodSeconds: 60
---
apiVersion: v1
kind: Service
metadata:
name: raea-cloud-gpu
spec:
selector: { app: raea-cloud-gpu }
ports:
- { port: 8080, targetPort: 8080 }