{"slug": "show-hn-cubepod-e2b-compatible-sandboxes-with-persistent-rootfs-on-k8s", "title": "Show HN: CubePod – E2B-compatible sandboxes with persistent rootfs on K8s", "summary": "CubePlex AI released CubePod, an open-source, Kubernetes-native sandbox platform for long-lived AI agents that is natively compatible with E2B and keeps a persistent root filesystem across hibernation. CubePod uses dual CSI raw-block PVCs, Kata Containers MicroVM isolation, zero-export suspend via fsfreeze, a pre-attached PodWarmPool that claims blank MicroVMs in under 50ms, and copy-on-write forking in under 1s, addressing what the project calls four architectural limits of standard container sandboxes: ephemeral rootfs, gigabyte-scale VM snapshots, network-filesystem I/O latency, and plaintext secret exposure.", "body_md": "[Documentation](https://cubepod.dev) · [Interactive API Reference](https://cubepod.dev/api/) · [中文 README](https://github.com/cubeplexai/cubepod/blob/main/README_zh.md) · [中文文档](https://cubepod.dev/zh/) · `llms.txt`\n\nCubePod is an open-source, cloud-native execution platform designed for long-lived, high-autonomy AI Agents, featuring **native E2B compatibility** and **native Kubernetes Runtime scheduling**. **Part of the Open-Source CubePlex Agent Stack**, CubePod provides the persistent hardware-isolated execution layer powering [** CubePlex**](https://github.com/cubeplexai/cubeplex) (Team Agent Workspace) and [** CubeLoop**](https://github.com/cubeplexai/cubeloop) (Async Agent Runtime), delivering MicroVM execution with instant hibernation/resume and full system-level persistence.\n\nModern AI agents (DevOps agents, software engineering assistants, interactive data analysts) operate with broad shell privileges: they dynamically install system packages (`apt`, `pip`, `npm`, Rust/C++ compilers), launch headless or interactive GUI browsers, and interact with external APIs using privileged credentials.\n\nExisting sandbox solutions suffer from four fundamental architectural limitations:\n\n1. **Ephemeral RootFS (Only `/workspace` Persists)** : Standard container sandboxes discard modifications to`/usr` ,`/etc` , and`/var` whenever a sandbox sleeps or restarts. Agents are forced to repeatedly reinstall toolchains and libraries, wasting minutes on every wakeup.\n2. **Heavyweight Snapshot Overhead** : VM memory snapshotting (CRIU / VM dumps) produces gigabyte-scale state files sensitive to host CPU architecture, while OCI commit/export approaches require tens of seconds to push layers to registries. Modern agents follow a**\"Decoupled Brain & Hand\"** model—reasoning context resides in the agent framework, meaning the sandbox only needs**100% persistent disk state with zero CPU/RAM allocation during sleep** .\n3. **Network Filesystem I/O Bottleneck** : Mounting NFS or CephFS across sandboxes causes catastrophic latency during`npm install` ,`pip install` , or`git status` due to millions of small-file RPC round-trips.\n4. **Plaintext Secret Exposure** : Injecting real API keys into container environment variables exposes credentials to untrusted LLM-generated code or host memory leaks.\n\nCubePod solves these challenges with **Dual-Volume CSI Raw Block persistence**, **Kata Containers MicroVM isolation**, **Zero-Export instant hibernation**, and an **in-guest Zero-Trust egress vault**.\n\n| Capability / Dimension | Upstream E2B Cloud / Standard Sandboxes | CubePod Open-Source Platform | \n|---|---|---|\n| **Persistence Model** | **VM pause snapshots** (E2B) or**ephemeral overlay** (containers;`/workspace` only) | **Block-Backed Persistent RootFS + Independent `/workspace` Volume** | \n| **Storage Architecture** | Snapshot-coupled rootfs/state (optional E2B Volumes) or slow shared NFS | **Dual CSI Raw Block PVCs** (`volumeMode: Block`` virtio-blk``ext4` ) with native NVMe-oF speed | \n| **RootFS & Workspace Lifecycle** | Coupled in VM snapshots or full reset on container rebuild | **Fully Decoupled** : increment`rootfsGeneration` to re-image OS while preserving`/workspace` intact | \n| **Hibernation & Resumption** | Export/restore VM memory & disk snapshots or cold VM restart | **Zero-Export Suspend** (`fsfreeze` , delete Pod**~1s Cross-Node Mount Resume** | \n| **MicroVM Cold Start** | Standard VM boot latency (several seconds) | **Pre-Attached WarmPool (`PodWarmPool`)** : blank pre-formatted ext4 MicroVMs claimed in**< 50ms** | \n| **Sandbox Forking** | Not supported / full volume copy | **< 1s Copy-on-Write Fork** : instantaneous sub-agent cloning via CSI block snapshots | \n| **Isolation Boundary** | Shared-kernel containers or cloud black-box | **Hardware-Isolated Kata MicroVM** (dedicated Guest Linux Kernel per sandbox) | \n| **Secret & Egress Security** | Plaintext API keys injected into environment variables | **Zero-Trust Egress Vault** : transparent`cpodref_` placeholder substitution via per-pod mTLS | \n| **Interactive GUI & Browser** | Port mapping with port collision risks | **Signed Panel Reverse Proxy** : path/token-authenticated HTTP, WebSocket, & WebRTC (Chromium/Neko/ttyd) | \n| **API & Ecosystem** | Proprietary API & SaaS vendor lock-in | **100% Wire-Compatible E2B Superset** : drop-in support for official E2B SDKs + MCP | \n| **Deployment Model** | Proprietary cloud only | **100% Open Source** : Self-host on Kubernetes (Kata + CSI) or single-node Docker Compose | \n\n```\n+---------------------------------------------------------------------------------------+\n|                       1. Access Layer: Agent Platforms & SDKs                         |\n|   CubePlex Platform  |  Official E2B SDKs (Python / JS)  |  CubePod SDK  |  MCP Clients |\n+---------------------------------------------------------------------------------------+\n                                           |\n                                           v\n+---------------------------------------------------------------------------------------+\n|              2. Control & Gateway Plane (Stateless High-Availability)                 |\n|  cubepod-gateway (Go)               |  cubepod-controller (Go K8s Operator)           |\n|  • E2B-compatible REST/SSE router   |  • Dual Block PVC & WarmPool lifecycle          |\n|  • Auto-Resume traffic interceptor  |  • In-memory per-pod mTLS certificate minting   |\n|  • Signed Panel reverse proxy       |  • Zero-Trust Egress sidecar injection          |\n+---------------------------------------------------------------------------------------+\n                                           |\n                                           v\n+---------------------------------------------------------------------------------------+\n|                  3. Data Plane: Hardware-Isolated Kata MicroVM Pod                    |\n|   +-------------------------------------------------------------------------------+   |\n|   | Kata Guest Linux Kernel (virtio-blk direct attachment)                        |   |\n|   |                                                                               |   |\n|   |  podd-init (PID 1 Rust Mounter):                                              |   |\n|   |  1. Auto e2fsck -p / mkfs.ext4 on raw block devices                           |   |\n|   |  2. Assemble OverlayFS (lowerdir=Base Image, upperdir=/dev/cubepod-rootfs)    |   |\n|   |  3. Mount /workspace (/dev/cubepod-workspace) & pivot_root                   |   |\n|   |                                                                               |   |\n|   |  Container Merged RootFS (/)                                                  |   |\n|   |  • podd (Rust Daemon :49983): Execution, background logs cursor, archive sync |   |\n|   |  • Desktop Stack (Lazy-loaded): Xorg + Chromium CDP + Neko WebRTC + ttyd      |   |\n|   |  • Egress Sidecar: nftables transparent redirection + mTLS secret vault swap  |   |\n|   +-------------------------------------------------------------------------------+   |\n+---------------------------------------------------------------------------------------+\n                                           |\n                                           v\n+---------------------------------------------------------------------------------------+\n|                    4. Persistent Storage Plane (CSI Raw Block)                        |\n|  Base OCI Image (RO)    |  RootFS Upper Block PVC (Thin)  |  Workspace Block PVC      |\n|  (virtio-fs / EROFS)    |  (/dev/cubepod-rootfs -> ext4)  |  (/dev/cubepod-workspace) |\n|  Storage Backends: Longhorn V2 (SPDK NVMe-oF) / OpenEBS Mayastor / Local Loopback     |\n+---------------------------------------------------------------------------------------+\n```\n\nCubePod decouples system dependencies from user files by provisioning two independent CSI Raw Block PVCs (`volumeMode: Block`):\n\n- **`rootfs-pvc`** : Carries the OverlayFS` upperdir` and`workdir` . Stores all delta modifications to`/usr` ,`/etc` , and`/var` created by`apt-get` ,`pip` , or`npm` .\n- **`workspace-pvc`** : Mounted directly at`/workspace` (with`1000:1000` ownership). Preserves source code, artifacts, and skills.\n\nThis decoupling enables **RootFS Re-imaging without Data Loss**: developers or agent frameworks can increment `rootfsGeneration` to purge a corrupted OS environment or upgrade the base image while keeping all `/workspace` project files intact.\n\n- **Suspend** : When an agent sandbox is paused or hits its idle timeout,`podd` executes`sync` +`fsfreeze` to flush kernel page caches and quiesce filesystem transactions. The Kata MicroVM Pod is immediately deleted, reducing CPU and memory consumption to**absolute zero** .\n- **Resume** : Any incoming request (HTTP, command execution, or panel access) triggers`cubepod-gateway` to schedule a fresh MicroVM Pod on**any cluster node** . The CSI driver re-attaches the existing Raw Block PVCs, and`podd-init` mounts the ext4 filesystems in**~1 second** without transporting multi-gigabyte memory state over the network.\n\nStandard Kubernetes cannot mount Raw Block devices as the container rootfs without custom host-level Kubelet or containerd patches. CubePod bypasses this via **In-Guest RootFS Pivot**:\n\n- MicroVM binaries (`podd-init` and`podd` ) are injected at Pod startup via a shared`emptyDir` volume populated by an init container (`cubepod-podd` ,`< 1MB` ).\n- `podd-init` runs as PID 1 in the Kata Guest kernel, mounts`/dev/cubepod-rootfs` and`/dev/cubepod-workspace` , builds the OverlayFS, calls`pivot_root(2)` , and hands execution over to`podd` .\n- User container images remain standard OCI images without baking in infrastructure binaries.\n\nTo achieve sub-50ms cold starts without violating Kubernetes Pod volume immutability:\n\n- Standby MicroVMs run in `PodWarmPool` with pre-created, pre-formatted, thin-provisioned block devices already pivoted into ext4.\n- When a new sandbox is requested, `cubepod-controller` re-labels and transfers ownership of the standby Pod and volumes in**< 50ms** , completely bypassing container scheduling and image pull delays.\n\n- Sensitive external credentials (e.g., GitHub tokens, payment keys) **never enter the sandbox filesystem, environment variables, or process memory** .\n- The sandbox receives only opaque `cpodref_` references.\n- All outbound traffic is intercepted by an in-guest Egress Sidecar via `nftables` . The sidecar inspects TLS SNI, enforces domain allowlists, and dynamically exchanges`cpodref_` tokens with the egress vault over dedicated per-sandbox mTLS.\n\nCubePod provides **100% wire-compatible drop-in interoperability with official E2B SDKs** ([CEP-0018](https://github.com/cubeplexai/cubepod/blob/main/docs/enhancements/0018-e2b-protocol-compatibility/README.md)). Existing AI Agent pipelines (LangChain, LlamaIndex, AutoGen, OpenHands, Smolagents) connect to CubePod without changing code—simply point `E2B_DOMAIN` to `cubepod-gateway`.\n\n```\n# Point upstream E2B SDK to your CubePod Gateway\nexport E2B_DOMAIN=\"localhost:8080\"\nexport E2B_API_KEY=\"cpod_live_secret\"\npython\n# Synchronous execution\nfrom e2b import Sandbox\n\nwith Sandbox.create(\"base\", timeout=300) as sandbox:\n    # Run command\n    cmd = sandbox.commands.run(\"echo 'Hello from CubePod Kata MicroVM!'\")\n    print(cmd.stdout)  # \"Hello from CubePod Kata MicroVM!\"\n\n    # Read and write files with persistent state\n    sandbox.files.write(\"/workspace/agent_data.txt\", \"persistent state\")\n    content = sandbox.files.read(\"/workspace/agent_data.txt\")\npython\n# Asynchronous execution (AsyncSandbox)\nimport asyncio\nfrom e2b import AsyncSandbox\n\nasync def main():\n    sandbox = await AsyncSandbox.create(\"base\")\n    try:\n        cmd = await sandbox.commands.run(\"uname -a\")\n        print(cmd.stdout)\n    finally:\n        await sandbox.kill()\n\nasyncio.run(main())\n```\n\nCubePod provides native newline-delimited JSON (NDJSON) streaming and rich display formatters (`png`, `svg`, `html`, `json`) compatible with Jupyter protocols:\n\n``` python\nfrom e2b_code_interpreter import Sandbox\n\nwith Sandbox.create() as sandbox:\n    code = \"\"\"\nimport matplotlib.pyplot as plt\nimport pandas as pd\nimport numpy as np\n\n# 1. Rich tabular DataFrame representation (_repr_html_)\ndf = pd.DataFrame({\"A\": np.random.randn(5), \"B\": np.random.randn(5)})\n\n# 2. Rich graphical Matplotlib chart capture (base64 PNG)\nplt.figure()\nplt.plot([1, 2, 3], [4, 5, 6], label=\"Trajectory\")\nplt.title(\"Agent Convergence\")\nplt.show()\n\ndf\n\"\"\"\n    execution = sandbox.run_code(code)\n\n    # Access rich outputs\n    for result in execution.results:\n        if result.png:\n            print(\"Chart captured! Base64 PNG length:\", len(result.png))\n        if result.html:\n            print(\"HTML table captured:\\n\", result.html[:100], \"...\")\n```\n\n`e2b-code-interpreter` on CubePod supports 6 standard execution kernels out-of-the-box:\n\n| Language | `language` Parameter | Execution Kernel | Capabilities | \n|---|---|---|---|\n| **Python** | `\"python\"` (default) | `ipykernel` (IPython) | Matplotlib/Seaborn charts, Pandas HTML tables, LaTeX | \n| **JavaScript** | `\"javascript\"` | `ijavascript` (Node.js) | Node.js algorithms and Web data processing | \n| **TypeScript** | `\"typescript\"` | `tslab` /`ts-node` | Typed TypeScript script execution | \n| **R** | `\"r\"` | `IRkernel` | Statistical analysis, `ggplot2` plotting | \n| **Java** | `\"java\"` | `ijava` (JShell) | Java classes and JVM runtime execution | \n| **Bash** | `\"bash\"` | `bash_kernel` | Interactive shell commands and pipeline scripts | \n\nBeyond the standard E2B interface, CubePod exposes high-throughput enterprise extensions for mission-critical agent platforms:\n\n- **1-Second Copy-on-Write Sandbox Fork (`POST /sandboxes/{id}/fork`)** : Clones an active sandbox and its dual block volumes in`< 1s` using CSI snapshots. Enables sub-agents to branch off speculative code execution in complete isolation.\n- **Independent RootFS Reset** : Increment`rootfsGeneration` in the`PodBox` CRD or API to rebuild the system layer after a broken`apt` or compiler update while leaving user code in`/workspace` 100% untouched.\n- **Stateless Log Cursors (`GET /commands/{pid}/logs?cursor={byte_offset}`)** : Process logs are persisted to ring buffers on disk. Any gateway replica or agent worker can reconnect and resume streaming logs from arbitrary offsets after network interruptions.\n- **Atomic Skill Archive Sync (`POST /files/archive-sync`)** : Streams a` tar.gz` payload unpacked in-memory directly to`/workspace/.skills` with exact`uid:gid` ownership and atomic cleanup of removed tools in a single`< 50ms` HTTP call.\n- **Signed Panel & GUI Proxy (`/panel/{jwt_token}/{path}`)** : Path- and JWT-authenticated reverse proxy supporting HTTP, WebSocket, and WebRTC streaming for Chromium CDP (`:9222` ), Neko browser sharing (`:8080` ), and ttyd web terminal (`:7681` ).\n\n| Path | Responsibility | Tech Stack | \n|---|---|---|\n| [`docs/architecture.md`](https://github.com/cubeplexai/cubepod/blob/main/docs/architecture.md) ·[`中文`](https://github.com/cubeplexai/cubepod/blob/main/docs/architecture_zh.md) | Platform architecture specification & CubePlex integration blueprint | Markdown / Mermaid | \n| [`docs/enhancements/`](https://github.com/cubeplexai/cubepod/blob/main/docs/enhancements/README.md) | CubePod Enhancement Proposals (CEPs) | CEP Specification | \n| [`api/v1alpha1/`](https://github.com/cubeplexai/cubepod/blob/main/api/v1alpha1/types.go) | Kubernetes CRD schemas ( `PodBox` ,`PodTemplate` ,`PodWarmPool` ) | Go ( `controller-gen` ) | \n| [`api/openapi/`](https://github.com/cubeplexai/cubepod/blob/main/api/openapi/cubepod-v1.yaml) | Canonical E2B-compatible superset OpenAPI 3.1 specification | OpenAPI 3.1 | \n| [`crates/podd-init/`](https://github.com/cubeplexai/cubepod/blob/main/crates/podd-init/src/main.rs) | In-guest PID 1 raw block `ext4` healer/formatter &`OverlayFS`` pivot_root` mounter | Rust (single-threaded, zero-GC) | \n| [`crates/podd/`](https://github.com/cubeplexai/cubepod/blob/main/crates/podd/src/main.rs) | In-guest execution, background process ( `cursor` logs), and`tar.gz` file sync daemon | Rust ( `tokio` ,`axum` ) | \n| [`cmd/cubepod-controller/`](https://github.com/cubeplexai/cubepod/blob/main/cmd/cubepod-controller/main.go) &[`pkg/controller/`](https://github.com/cubeplexai/cubepod/blob/main/pkg/controller) | Kubernetes Operator reconciling dual Block PVCs, WarmPools, and Kata Pods | Go ( `kubebuilder` ,`client-go` ) | \n| [`cmd/cubepod-gateway/`](https://github.com/cubeplexai/cubepod/blob/main/cmd/cubepod-gateway/main.go) &[`pkg/gateway/`](https://github.com/cubeplexai/cubepod/blob/main/pkg/gateway) | Control Plane Gateway, E2B router, Auto-Resume, and Panel HTTP/WS/WebRTC Proxy | Go | \n| [`cmd/cubepod-egress/`](https://github.com/cubeplexai/cubepod/blob/main/cmd/cubepod-egress/main.go) &[`pkg/egress/`](https://github.com/cubeplexai/cubepod/blob/main/pkg/egress) | Zero-Trust mTLS `cpodref_` secret vault and egress forward proxy sidecar | Go | \n| [`cmd/cubepod/`](https://github.com/cubeplexai/cubepod/blob/main/cmd/cubepod/main.go) &[` pkg/client/`](https://github.com/cubeplexai/cubepod/blob/main/pkg/client) | Official Go Client SDK and `cubepod` CLI | Go | \n| [`sdks/python/`](https://github.com/cubeplexai/cubepod/blob/main/sdks/python) | Sync & Async Python SDK ( `cubepod` ) | Python 3.11+ ( `httpx` ) | \n| [`deploy/`](https://github.com/cubeplexai/cubepod/blob/main/deploy) | Helm chart ( `deploy/helm/cubepod` ), K8s manifests, and local Docker Compose | Helm / K8s / Docker | \n\n- Go 1.22+\n- Rust 1.78+ (cargo)\n- Docker / Podman (optional for container image verification)\n\n```\n# Build all components (podd-init, podd, controller, gateway, egress, cubepod CLI)\nmake build\n# Format and lint Go & Rust sources\nmake fmt\nmake vet\n\n# Run all unit and integration tests\nmake test\n\n# Run multi-process end-to-end integration suite (including E2B drop-in & stress tests)\nmake test-e2e\n\n# Run official E2B Python SDK & Code Interpreter compatibility test suite\nmake test-e2b-compat\n```\n\nBuilt on a **Brain-Hands Decoupling** architecture, CubePod provides the persistent hardware-isolated execution layer (**Hands**) powering [** CubePlex**](https://github.com/cubeplexai/cubeplex) (Team Agent Workspace) and [** CubeLoop**](https://github.com/cubeplexai/cubeloop) (Async Agent Runtime & Reasoning **Brain**):\n\n- [**CubePlex**](https://github.com/cubeplexai/cubeplex) —** Brain / Workspace** : Team Agent Workspace for collaborative multi-agent workflows, sessions, and governance.\n- [**CubeLoop**](https://github.com/cubeplexai/cubeloop) —** Brain / Runtime** : Async Agent Runtime orchestrating long-running, multi-model autonomous execution loops.\n- [**CubePod**](https://github.com/cubeplexai/cubepod) —** Hands / Execution** : Persistent Writable RootFS MicroVM execution substrate with Dual CSI Raw Block persistence,`<50ms` WarmPool claims,`~1s` CoW forks, and Zero-Trust`cpodref_` egress.\n\nCubePod is open-source software licensed under the [Apache License, Version 2.0](https://github.com/cubeplexai/cubepod/blob/main/LICENSE).\n\nRun `make test-kind-e2e` on a Linux Docker host to build and deploy this checkout\ninto an isolated kind cluster and exercise real sandboxes with both official E2B\nSDKs. See [requirements, coverage, diagnostics and local reuse](https://github.com/cubeplexai/cubepod/blob/main/test/kind-e2e/README.md).\nNo KVM or existing Kubernetes environment is needed.", "url": "https://wpnews.pro/news/show-hn-cubepod-e2b-compatible-sandboxes-with-persistent-rootfs-on-k8s", "canonical_source": "https://github.com/cubeplexai/cubepod", "published_at": "2026-11-23 04:27:34+00:00", "updated_at": "2026-11-23 04:43:40.767389+00:00", "lang": "en", "topics": ["ai-agents", "ai-infrastructure", "ai-tools", "developer-tools", "ai-safety"], "entities": ["CubePod", "CubePlex", "CubeLoop", "E2B", "Kubernetes", "Kata Containers", "CubePlex AI"], "also_reported_by": [], "takeaway": "CubePod keeps the full rootfs on dual CSI raw-block PVCs so agents retain /usr, /etc and /var across sleep, resumes cross-node in about 1s with zero-export fsfreeze suspend, and claims warm MicroVMs in under 50ms via PodWarmPool.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/show-hn-cubepod-e2b-compatible-sandboxes-with-persistent-rootfs-on-k8s", "markdown": "https://wpnews.pro/news/show-hn-cubepod-e2b-compatible-sandboxes-with-persistent-rootfs-on-k8s.md", "text": "https://wpnews.pro/news/show-hn-cubepod-e2b-compatible-sandboxes-with-persistent-rootfs-on-k8s.txt", "jsonld": "https://wpnews.pro/news/show-hn-cubepod-e2b-compatible-sandboxes-with-persistent-rootfs-on-k8s.jsonld"}}