Repository navigation
Description
Epic: P6 on Kubernetes, with only P4 on a VM or bare metal
The scenario
The P6 demo (#370) runs everything on one KVM VM under systemd and podman. This epic runs every part of P6 as an ordinary Kubernetes workload: the supervisor with its forked worker pool, the relay, Redis, the MU1 control plane, and container sandboxes. Only the P4 Firecracker microvm-worker stays on a KVM host (a VM or bare metal) outside the cluster, dialing the in-cluster relay.
Relation to RA1's "deprecate K8s"
RA1 (docs/specs/2026-09-24-ra1-density-cutover-and-repo-rearchitecture-design.md §4) deprecates the Knative/KEDA path: the Knative Service, KEDA, KubectlTransport and pod-exec sandboxes. This epic uses none of them. It runs the P6 process model and GrpcRelayTransport, which do not depend on the substrate, with Kubernetes as the substrate. Record that distinction in an ADR before slice 1 merges, so the later deprecation does not sweep this up. Done: ADR-0037, merged with slice 1.
Precedent
deploy/compose/ already runs these exact processes in containers, from the same image and with the same env vars. deploy/vm/ carries the hardening and secret handling to translate. So the work is mostly deployment work: two small relay/supervisor code changes and one real harness change (slice 3).
Where things stand (2026-10-05)
- Slice 1 is merged (feat(deploy/k8s): P6 on Kubernetes, slice 1 — container tier on Kind and OpenShift (#423) #427):
deploy/k8s/(base, pluskind,kind-ciandocpoverlays),setup.sh,smoke.sh, thek8s-e2eCI job, the README runbook, ADR-0037, and spec v1.1.- It also carries Redis-resilience fixes that the substrate exposed: the control plane reconnects forever and its
/readyzfails fast; the relay retries presence writes;RedisRecordStorere-arms after an outage; and worker Redis clients no longer crash on a Redis restart.
- It also carries Redis-resilience fixes that the substrate exposed: the control plane reconnects forever and its
- Kind: smoke PASS=11 FAIL=0, locally twice and on GitHub's Linux runners (
k8s-kind-e2e). - OpenShift 4.20.8 acceptance, Epic: VM demo slice — P6 + P4 on one VM, multi-user mocactl login, sandbox research turns #370 demo parity on the container tier:
- smoke PASS=11 with a real model;
- two GitHub users, each spending their own credential;
- disjoint sessions, and a cross-user refusal identical to "does not exist";
- research turns that match the live internet;
- kube API, kubelet and machine-config ports BLOCKED from sandboxes;
- passthrough connections 1:1 for two concurrent clients;
- no fallbacks needed.
- Slice 2 is implemented (PR feat: P6 on Kubernetes, slice 2 — external P4 hosts over TLS (#424) #437, open):
- Relay: reads per-host tokens from a mounted Secret directory on each attach, so adding a host restarts nothing.
- Workers:
RELAY_CA_FILEin both. - OpenShift
p4-relaycomponent: ghostunnel sidecar with--alpn h2, passthrough Routemoca-relay, router-only NetworkPolicy. setup.sh: P4 IDs, tokens with revocation, relay certificate, per-host bundles.setup-microvm.sh --remote: InvocationID-scoped attach check with a settle window.smoke.sh --tier p4.
- Slice 2, OpenShift 4.20.8 plus the shared KVM rig:
- P4 smoke PASS=8. The guest kernel was
6.18.44+vs the nodes'5.14, and the workspace persisted across turns. - The Route probe gave
attach=0 exec=12. - Adding a host put its token into the relay's directory in 42 s, with the relay pod unchanged.
- ALPN
h2was negotiated live. - The host stayed attached through 11 idle minutes, with one attach.
- Two
mocactlusers each ran turns. - Both sides were restored: the rig binary byte-identical, and the container smoke PASS=11 afterwards.
- P4 smoke PASS=8. The guest kernel was
-
k8s-e2ebecomes a required check after ten consecutive green runs onmain. - Slice 1 follow-ups (none blocking): RedisRecordStore re-arm: a failed attempt's .catch can clear a newer memo (microtask race) #428, deploy/k8s: kind and kind-ci share moca-settings, so kind keeps the kind-ci placeholder client id #429 (bugs) and supervisor /metrics: per-connection hand-off counter, to make the OCP L4 (passthrough 1:1) check direct #430–deploy/k8s: polish follow-ups from the slice 1 reviews #435 (enhancements).
- Slice 2 follow-ups (none blocking): setup-microvm.test.sh: make the attach-bound check deterministic (journal-call count, not elapsed time) #438 (deterministic attach-bound test), sandbox-relay: server keepalive, so a P4 host whose network drops is detected before the router's 5 m timeout #439 (relay server keepalive), CI: run the deploy bash suites under bash 3.2 (macOS /bin/bash), and make the harnesses use the bash they were launched with #440 (bash suites under bash 3.2 in CI), P4 relay Route: client certificates (mTLS) at the ghostunnel sidecar, so a token alone cannot attach #441 (mTLS at the relay sidecar).
Children (dependency order)
- P6 on Kubernetes, slice 1: supervisor, relay, Redis, control plane and container sandboxes as K8s workloads #423 — Slice 1: P6 on K8s, container tier only. Done: merged in feat(deploy/k8s): P6 on Kubernetes, slice 1 — container tier on Kind and OpenShift (#423) #427 (
0573a82), accepted on OpenShift 4.20.8 (results). Workloads, Secrets, and NetworkPolicy replacing nftables/isolate=strict. Plus the code fix: a bind address and readiness endpoint for the supervisor's loopback-only admin listener. Kind-testable. Everything else builds on this. - P6 on Kubernetes, slice 2: external P4 microVM hosts attached to an in-cluster relay over TLS #424 — Slice 2: external P4 hosts over TLS. Done: PR feat: P6 on Kubernetes, slice 2 — external P4 hosts over TLS (#424) #437 (open, awaiting review/merge), accepted live on OpenShift 4.20.8 + the shared KVM rig (results). Expose the relay's attach port, add a remote-relay mode to
setup-microvm.sh, and reload per-sandbox tokens without restarting the relay. A P4-only stack with one P4 host; it needs slice 1. - Sandbox tier selection and session-to-sandbox affinity in selectPoolSandbox (P6-on-K8s slice 3) #425 — Slice 3: tier selection plus session-to-sandbox affinity in
selectPoolSandbox. Needed to mix container and P4 tiers behind one relay, or to run more than one P4 host. Not specific to K8s: the VM path has the same limit. It can be designed in parallel with slices 1–2.
Each child is written so a planner can start it in a fresh session.
Constraints that shape the design
- The supervisor's front door must be L4. Hand-off, routing and 429 admission happen once per connection. An L7 proxy that pools connections (Ingress, an edge-terminated Route, a mesh sidecar, Knative's queue-proxy) silently defeats them.
- The relay is single-replica (presence-only), so it is a
RecreateDeployment, and a restart drops every attached sandbox. - Until slice 3: one sandbox tier per stack, and one P4 host per stack.
Not in scope
Autoscaling (HPA/KEDA), Vault, P4 guest networking (#277), MI1 owner binding (S5).
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
docs(specs): P6 on Kubernetes, slice 1 design (#423)
docs(specs): P6 on Kubernetes, slice 2 design — external P4 hosts ove…
Merge pull request #436 from pdettori/fix/426-slice1-robustness
docs: P6.3 spec, sandbox tiers and session-to-sandbox affinity (#425)
feat(deploy/k8s): add ocp-single — single-namespace, no-SCC dev/test …