r/TalosLinux • u/j-o-s-h-99 • 3d ago
I built a Kubernetes terminal backend for Hermes: every session gets its own gVisor sandbox
As the original post on r/hermesagent was removed I will just post it here with full text 😄
I run Hermes inside my Talos Kuberentes single node cluster and wanted to keep the Hermes separate from the terminal for security reasons. That turned out to be a path that is not well supported at this point so I started to look for ways to do it and came up with this plugin that uses Kuberentes SIG Agent Sandbox CRDs to provide secure sandboxes using gVisor.
What is does:
- One sandbox per session: each Hermes session gets its own gVisor pod, claimed from a warm pool, so the first command doesn't wait for a pod to start.
- No external service: everything is included, Hermes only needs a ServiceAccount with the right permissions in the cluster and the plugin manages the rest, no external service or db. Information is stored as labels attached to the agent sandbox CRDs.
- Isolation: the same model as the docker or podman backend that separates secrets and keys from command execution.
- Sleeping when idle: after terminal.lifetime_seconds with nothing running, the sandbox is suspended (pod deleted, volume kept). It wakes in a few seconds on the next command. An orphan sweep catches sandboxes left behind by a crashed Hermes process.
- Persistence: /workspace and /root are on a volume per session. Resume a session and its sandbox and files come back.
- Feature parity with the Docker backend: output streams live, and interrupts and timeouts kill the whole process tree. Long-lived processes, Bot Desktop, computer_use and the browser all work over sandboxd's gRPC API, with no kubectl and no pods/exec needed.
- Your skills and credentials go with you: they're copied into the sandbox one way and never written to the volume.
- Cleanup: deleting a session in Hermes deletes its sandbox and volume.
