xiaods / k8e

목록에 있음

k8e.sh - OpenSource Agentic AI Sandbox Matrix

main샌드박스 소스 보기

설치

npx -y @deepseek-ai/dsh plugin --profile web add github:xiaods/k8e

이 설치 명령은 GitHub 저장소 주소에서 생성된 확인되지 않은 시작점입니다.

README

유지 관리자가 작성한 문서 스냅샷입니다.

GitHub에서 보기 ↗
커밋 6813043동기화 2026. 8. 17.

Typing SVG



Go Version Kubernetes License Stars Release Arch


k8e.sh — Open Source Agentic AI Sandbox Matrix. A CNCF-conformant Kubernetes distribution in a single binary under 100MB, purpose-built for secure, isolated AI agent execution at scale. Up and running in 60 seconds. Inspired by K3s.


curl -sfL https://k8e.sh/install.sh | sh -

That's it. Your agentic sandbox matrix is ready. 🤖


📖 Table of Contents

#Section
1🤖 What is K8E?
2🏗️ Architecture
3⚙️ Components
4🚀 Quick Start
5🔒 Sandbox Runtime Setup
6🤖 Sandbox CLI
7🖥️ Advanced Installation
8🆚 K8E vs Others
9🤝 Contributing
10🙏 Acknowledgments

🤖 What is K8E?

K8E is the Open Source Agentic AI Sandbox Matrix — a Kubernetes-native platform for running secure, isolated AI agent workloads at scale, packaged as a single binary under 100MB.

As autonomous AI agents increasingly generate and execute untrusted code, robust sandboxing infrastructure is no longer optional. K8E ships everything needed to spin up a production-grade cluster in under 60 seconds, with first-class primitives for agent isolation, resource governance, and ephemeral execution environments — purpose-built for the AI era.

🔒 One cluster. Many agents. Zero trust between them.

Sandbox Capabilities

CapabilityDescription
🔒 Hardware IsolationPluggable runtimes: gVisor (default), Kata Containers, Firecracker microVM
🌐 Network PoliciesCilium eBPF toFQDNs egress control — per-session, no proxy process needed; allowed_hosts enforced via --cilium-dns-proxy (KIP-16 M10)
⚖️ Resource QuotasCPU/memory caps per agent session to prevent runaway costs
🗑️ Ephemeral WorkspacesAuto-cleanup after agent session ends; per-session workspace isolation for sub-agents (KIP-16 M1)
🧠 Warm PoolPre-booted sandbox pods for sub-500ms session claim latency; application-layer readiness handshake, adaptive sizing, per-session background-run caps
📸 Content-Addressed SnapshotsSHA-256 CAS layerstore with zstd compression, chunked multi-layer manifests, incremental --base restore, server-side registry, autosquash (KIP-16 M2)
📜 Exec TranscriptsFile-backed, windowed, offset-resumable command transcripts — k8e-sandbox-cli log (KIP-16 M4)
📊 ObservabilityPrometheus metrics, disk-only NDJSON event stream, process topology — events / ps CLI (KIP-16 M5)
🔄 Sub-agent ReuseSub-agents share the parent pod + workspace; isolated reset (KIP-16 M1)
🧾 CLI CatalogMachine-readable command/flag surface for SDK generation — catalog (KIP-16 M9)
🤝 agent-sandbox compatibleWorks with kubernetes-sigs/agent-sandbox
🔄 SKILL + CLIAI agents (claude code, codex, pi) connect via k8e-sandbox-cli CLI commands

🏗️ Architecture

┌─────────────────────────────────────────────────────────────────┐
│                          K8E CLUSTER                            │
│                                                                 │
│   ┌─────────────────────────────────────────────────────────┐   │
│   │                CONTROL PLANE (Server Node)              │   │
│   │  ┌──────────────┐  ┌─────────────┐  ┌──────────┐       │   │
│   │  │  API Server  │  │  Scheduler  │  │   etcd   │       │   │
│   │  └──────────────┘  └─────────────┘  └──────────┘       │   │
│   │  ┌──────────────────┐  ┌──────────────────────────────┐ │   │
│   │  │  Controller Mgr  │  │  SandboxMatrix Controller    │ │   │
│   │  └──────────────────┘  └──────────────────────────────┘ │   │
│   └─────────────────────────────────────────────────────────┘   │
│                              │                                   │
│                 ┌────────────┴────────────┐                     │
│   ┌─────────────▼───────────┐  ┌──────────▼──────────────┐     │
│   │      WORKER NODE        │  │      WORKER NODE        │     │
│   │  ┌─────────────────┐    │  │  ┌─────────────────┐    │     │
│   │  │  sandbox-matrix │    │  │  │  sandbox-matrix │    │     │
│   │  │  grpc-gateway   │    │  │  │  grpc-gateway   │    │     │
│   │  │  :50051 (TLS)   │    │  │  │  :50051 (TLS)   │    │     │
│   │  └────────┬────────┘    │  │  └────────┬────────┘    │     │
│   │           │             │  │           │             │     │
│   │  ┌────────▼────────┐    │  │  ┌────────▼────────┐    │     │
│   │  │  Isolated Pods  │    │  │  │  Isolated Pods  │    │     │
│   │  │ gVisor/Kata/FC  │    │  │  │ gVisor/Kata/FC  │    │     │
│   │  └─────────────────┘    │  │  └─────────────────┘    │     │
│   │  Cilium CNI (eBPF)      │  │  Cilium CNI (eBPF)      │     │
│   └─────────────────────────┘  └─────────────────────────┘     │
└─────────────────────────────────────────────────────────────────┘
         ▲
         │  gRPC (TLS)
┌────────┴────────┐
│  k8e-sandbox-cli    │  ← CLI commands
└────────┬────────┘
         │  gRPC (TLS)
         ▼
│  AI Agent       │  (claude code / codex / pi)
└─────────────────┘

⚙️ Components

ComponentVersionPurpose
☸️ Kubernetesv1.35.xCore orchestration engine
🔷 CiliumLatesteBPF networking & per-session egress policy
📦 Containerdv1.7.xContainer runtime
🔑 etcdv3.5.xDistributed key-value store
🌐 CoreDNSv1.11.xCluster DNS
Helm Controllerv0.16.xGitOps & chart management
📈 Metrics Serverv0.7.xResource metrics
💾 Local Path Provisionerv0.0.30Persistent storage
🛡️ gVisor / Kata / FirecrackerPluggable sandbox isolation runtimes
🤖 Sandbox CLIstandalonek8e-sandbox-cli — agent tool commands

🚀 Quick Start

Install the runtime shim before K8E so it is auto-detected on first startup. gVisor is recommended — no KVM required.

# Download runsc + containerd-shim-runsc-v1 directly from the gVisor release bucket (requires wget)
ARCH=$(uname -m)   # x86_64 on most servers, aarch64 on ARM
URL=https://storage.googleapis.com/gvisor/releases/release/latest/${ARCH}

wget ${URL}/runsc ${URL}/runsc.sha512 \
     ${URL}/containerd-shim-runsc-v1 ${URL}/containerd-shim-runsc-v1.sha512

sha512sum -c runsc.sha512 -c containerd-shim-runsc-v1.sha512   # both must print OK
chmod +x runsc containerd-shim-runsc-v1
sudo mv runsc containerd-shim-runsc-v1 /usr/local/bin/
ls -l /usr/local/bin/runsc /usr/local/bin/containerd-shim-runsc-v1   # verify both installed

K8E detects runsc at startup and automatically injects the gVisor stanza into its containerd config (/var/lib/k8e/agent/etc/containerd/config.toml). Do not run runsc install — K8E manages its own containerd configuration.

Need stronger isolation? See Sandbox Runtime Setup for Kata Containers and Firecracker.

Step 2 — Install K8E

curl -sfL https://k8e.sh/install.sh | sh -

Step 3 — Verify Cluster

export KUBECONFIG=/etc/k8e/k8e.yaml
kubectl get nodes
kubectl get runtimeclass              # should show: gvisor
kubectl -n sandbox-matrix get pods   # Sandbox Matrix starts automatically

Step 4 — Download Sandbox CLI & Connect Your AI Agent

Download the standalone sandbox CLI, authenticate, and install the skill into your agent:

# Download sandbox CLI (~44MB) — pick your platform suffix
#   k8e-sandbox-cli-linux-amd64 / linux-arm64 / darwin-amd64 / darwin-arm64 / windows-amd64.exe
curl -sLO https://github.com/xiaods/k8e/releases/latest/download/k8e-sandbox-cli-linux-amd64
chmod +x k8e-sandbox-cli-linux-amd64

# Symlink the plain command name to the downloaded file (do not rename)
ln -s k8e-sandbox-cli-linux-amd64 k8e-sandbox-cli

# Create an API key on the server (default TTL 30 days; use --ttl never for non-expiring)
k8e sandbox-apikey create my-agent
# → {"name":"my-agent","key":"k8e-abc123...","ttl_days":30,"expires_at":"..."}

# Connect: authenticate (mTLS) + install /k8e-sandbox skill into agent harnesses
./k8e-sandbox-cli --endpoint <server-ip>:50051 --apikey k8e-abc123... connect

# Optional multi-cluster profiles (~/.k8e/sandbox/profiles.yaml — not server /etc/k8e/config.yaml)
# See docs/kip-17-sandbox-cli-profiles-and-apikey-ttl.md
# ./k8e-sandbox-cli --profile prod connect --apikey k8e-...

Local usage: If you're on the same machine as the K8E server, the CLI auto-discovers TLS certs — just run k8e-sandbox-cli connect.

Platform binaries: k8e-sandbox-cli-{darwin,linux,windows}-{amd64,arm64} (Windows: k8e-sandbox-cli-windows-amd64.exe, symlink via mklink k8e-sandbox-cli.exe k8e-sandbox-cli-windows-amd64.exe)

One binary, two names: the downloaded k8e-sandbox-cli-linux-amd64 file is the k8e-sandbox-cli command the skill uses. connect symlinks it to ~/.local/bin/k8e-sandbox-cli (on PATH) and installs the /k8e-sandbox skill into your agent harnesses, so every skill example (k8e-sandbox-cli run ...) is the same file you just downloaded.

Then ask your agent naturally:

"Run this Python snippet in a sandbox"

The agent executes k8e-sandbox-cli run automatically — no session management needed.

Supported agents: claude code, codex, pi.


🔒 Sandbox Runtime Setup

K8E auto-detects installed runtimes and registers the corresponding RuntimeClass. Choose based on your isolation requirements:

RuntimeIsolationRequirementBoot time
gVisorSyscall interception (userspace kernel)None~10ms
Kata ContainersVM-backed (QEMU)Nested virt or bare metal~500ms
FirecrackerHardware microVM (KVM)/dev/kvm~125ms
# Download runsc + containerd-shim-runsc-v1 directly from the gVisor release bucket (requires wget)
ARCH=$(uname -m)   # x86_64 on most servers, aarch64 on ARM
URL=https://storage.googleapis.com/gvisor/releases/release/latest/${ARCH}

wget ${URL}/runsc ${URL}/runsc.sha512 \
     ${URL}/containerd-shim-runsc-v1 ${URL}/containerd-shim-runsc-v1.sha512

sha512sum -c runsc.sha512 -c containerd-shim-runsc-v1.sha512   # both must print OK
chmod +x runsc containerd-shim-runsc-v1
sudo mv runsc containerd-shim-runsc-v1 /usr/local/bin/
ls -l /usr/local/bin/runsc /usr/local/bin/containerd-shim-runsc-v1   # verify both installed

Do not run runsc install — K8E manages its own containerd config at /var/lib/k8e/agent/etc/containerd/config.toml and auto-injects the gVisor stanza on startup.

Kata Containers

bash -c "$(curl -fsSL https://raw.githubusercontent.com/kata-containers/kata-containers/main/utils/kata-manager.sh) install-packages"
kata-runtime check

Firecracker (requires /dev/kvm)

ls /dev/kvm   # verify KVM is available

# Install firecracker-containerd shim + devmapper snapshotter
# See: https://github.com/firecracker-microvm/firecracker-containerd
mkdir -p /var/lib/firecracker-containerd/runtime
# Place hello-vmlinux.bin and default-rootfs.img here

Apply Changes

Install runtimes before starting K8E for zero-restart setup. If K8E is already running, restart it after installing a new runtime shim:

systemctl restart k8e
kubectl get runtimeclass
# NAME          HANDLER       AGE
# gvisor        runsc         10s
# kata          kata-qemu     10s
# firecracker   firecracker   10s   ← only if /dev/kvm present

🤖 Sandbox CLI

k8e-sandbox-cli is a standalone binary (~44MB) that gives AI agents direct access to K8E sandbox infrastructure — no server install needed.

AI Agent (claude code / codex / pi)
    │  shell command
    ▼
k8e-sandbox-cli run "print('hello')" --lang python
    │  gRPC (TLS)
    ▼
sandbox-grpc-gateway:50051
    │
    ▼
Isolated Pod (gVisor / Kata / Firecracker)

Install the Skill

On the server, create an API key for secure remote access:

k8e sandbox-apikey create my-agent
# → {"name":"my-agent","key":"k8e-abc123..."}

On the client, download the standalone CLI, log in, and install the skill:

# 1. Download the platform-specific binary (~44MB)
#    k8e-sandbox-cli-linux-amd64 / linux-arm64 / darwin-amd64 / darwin-arm64 / windows-amd64.exe
curl -sLO https://github.com/xiaods/k8e/releases/latest/download/k8e-sandbox-cli-linux-amd64
chmod +x k8e-sandbox-cli-linux-amd64

# 2. Symlink the plain command name to the downloaded file (do not rename)
ln -s k8e-sandbox-cli-linux-amd64 k8e-sandbox-cli

# 3. Connect: mTLS auth + install /k8e-sandbox skill into Claude/Codex/Pi
#    Note: --endpoint and --apikey are global flags, placed before the subcommand
./k8e-sandbox-cli --endpoint <server-ip>:50051 --apikey k8e-abc123... connect

Platform binaries: k8e-sandbox-cli-{darwin,linux,windows}-{amd64,arm64} (Windows: k8e-sandbox-cli-windows-amd64.exe, symlink via mklink k8e-sandbox-cli.exe k8e-sandbox-cli-windows-amd64.exe)

One binary, two names: the downloaded k8e-sandbox-cli-linux-amd64 file is the k8e-sandbox-cli command the skill uses — the symlink is just a plain-name alias to the same file. connect installs the /k8e-sandbox skill, so every skill example (k8e-sandbox-cli run ...) is the same file you just downloaded.

Then in your agent harness:

/k8e-sandbox <goal>

Or ask naturally: "Run this Python snippet in a sandbox" — the skill drives k8e-sandbox-cli run.

Available Commands

CommandDescription
k8e-sandbox-cli --profile <name> …Use named profile from ~/.k8e/sandbox/profiles.yaml (KIP-17; not /etc/k8e/config.yaml)
k8e-sandbox-cli connectConnect local/remote gateway and install /k8e-sandbox agent skill
k8e-sandbox-cli connect --skill-onlyRe-install agent skill only (no gateway dial)
k8e-sandbox-cli loginAuthenticate only (mTLS cert; no skill install)
k8e-sandbox-cli run <code>Run code or shell command (auto-creates/manages session)
k8e-sandbox-cli statusCheck sandbox service availability and current session
k8e-sandbox-cli createCreate a new session (custom runtime, egress, manifest, git-repo)
k8e-sandbox-cli destroy <sid>Destroy a session and free resources
k8e-sandbox-cli write <sid> <path>Write file to /workspace (content via stdin)
k8e-sandbox-cli read <sid> <path>Read file from /workspace
k8e-sandbox-cli list <sid>List files in /workspace (filter by --since timestamp)
k8e-sandbox-cli subagent <parent-sid>Spawn child sandbox under parent session (max depth 1)
k8e-sandbox-cli confirm <sid> <action>Gate irreversible action on human approval
k8e-sandbox-cli approve <approval-id>Approve a pending confirm request
k8e sandbox-apikey create <name> [--ttl 30d|never]Create API key (default TTL 30 days)
k8e sandbox-apikey listList API key names + expiry (secrets not shown)
k8e sandbox-apikey delete <name>Delete an API key (server-side)

See pkg/sandboxcli/skills/k8e-sandbox/SKILL.md and docs/kip-17-sandbox-cli-profiles-and-apikey-ttl.md.

Quick Examples

# Run Python code (auto-creates session)
k8e-sandbox-cli run "print('hello')" --lang python

# Shell command (default lang=bash)
k8e-sandbox-cli run "ls -la /workspace"

# TypeScript — type annotations run via tsx
k8e-sandbox-cli run "const nums: number[] = [1, 2, 3]; console.log(nums.reduce((a, b) => a + b, 0))" --lang ts

# Multi-line TypeScript via stdin (interfaces, async/await)
k8e-sandbox-cli run --lang ts <<'EOF'
interface User { name: string; age: number }

async function oldest(users: User[]): Promise<User> {
  return users.reduce((a, b) => (a.age > b.age ? a : b));
}

const users: User[] = [{ name: "Ada", age: 36 }, { name: "Linus", age: 54 }];
oldest(users).then((u) => console.log(`Oldest: ${u.name} (${u.age})`));
EOF

# Multi-line via stdin
k8e-sandbox-cli run --lang python <<'EOF'
for i in range(10):
    print(i)
EOF

# Default egress: pypi.org, files.pythonhosted.org, registry.npmjs.org,
#   objects.githubusercontent.com, github.com, raw.githubusercontent.com
SID=$(k8e-sandbox-cli create | jq -r .session_id)
k8e-sandbox-cli write $SID /workspace/script.py <<'PYEOF'
import pandas as pd
print(pd.__version__)
PYEOF
k8e-sandbox-cli run "pip install pandas" --session-id $SID
k8e-sandbox-cli run "python3 /workspace/script.py" --session-id $SID

# Create session with custom runtime and egress
SID=$(k8e-sandbox-cli create --runtime firecracker --allowed-hosts pypi.org,github.com | jq -r .session_id)

# Clone git repo at session creation
SID=$(k8e-sandbox-cli create --git-repo https://github.com/user/repo.git --git-ref main | jq -r .session_id)

# Stream long-running output
k8e-sandbox-cli run "python3 train.py" --session-id $SID --raw

# Tenant-based cross-process session reuse
k8e-sandbox-cli run "echo hello" --tenant my-project

Configuration Overrides

The CLI auto-discovers the local cluster via TLS. For remote clusters, use k8e-sandbox-cli login once to set up mTLS credentials. Override when needed:

# Remote cluster: log in once (creates ~/.k8e/sandbox/{client.crt,client.key,ca.crt})
k8e-sandbox-cli --endpoint 10.0.0.1:50051 --apikey k8e-abc123... login

# After login, subsequent commands work without --apikey:
k8e-sandbox-cli run "echo hello"

# Or via environment variables:
K8E_SANDBOX_ENDPOINT=10.0.0.1:50051 K8E_SANDBOX_APIKEY=k8e-abc123... k8e-sandbox-cli login

# Override endpoint per-command:
K8E_SANDBOX_ENDPOINT=10.0.0.2:50051 k8e-sandbox-cli run "echo hello"

🖥️ Advanced Installation

Add a Worker Node

# Get token from server node
cat /var/lib/k8e/server/node-token

# On worker machine
curl -sfL https://k8e.sh/install.sh | \
  K8E_TOKEN=<token> \
  K8E_URL=https://<server-ip>:6443 \
  INSTALL_K8E_EXEC="agent" \
  sh -

Disable Sandbox Matrix

curl -sfL https://k8e.sh/install.sh | INSTALL_K8E_EXEC="server --disable-sandbox-matrix" sh -

Key Environment Variables

K8E_TOKEN=<secret>              # cluster join token
K8E_URL=https://<server>:6443   # server URL (agent nodes)
K8E_KUBECONFIG_OUTPUT=<path>    # kubeconfig output path

🆚 K8E vs The Alternatives

FeatureK8E 🚀K3sK8s (vanilla)MicroK8s
Install time~60s~90s~20min~5min
Binary size<100MB~70MB~1GB+~200MB
Agentic Sandbox✅ Native❌ No⚠️ Manual❌ No
eBPF networking✅ Cilium⚠️ Optional⚠️ Optional❌ No
Sandbox CLI standalone✅ Yes❌ No❌ No❌ No
HA embedded etcd✅ Yes✅ Yes✅ Yes⚠️ Limited
CNCF conformant✅ Yes✅ Yes✅ Yes✅ Yes
Multi-arch✅ Yes✅ Yes✅ Yes✅ Yes

🤝 Contributing

git clone https://github.com/<your-username>/k8e.git && cd k8e
git checkout -b feat/my-feature
make && make test
git push origin feat/my-feature

🛡️ Security

Report vulnerabilities via GitHub Security Advisories. Do not open public issues for security bugs.


📄 License

Apache License 2.0 — see LICENSE.


🙏 Acknowledgments

ProjectContribution
🐄 K3sLightweight Kubernetes foundation that inspired K8E
☸️ KubernetesThe orchestration engine everything is built on
🔷 CiliumeBPF-powered networking and per-session egress control
🤖 agent-sandboxKubernetes-native agent sandboxing primitives
🌐 CNCFFostering the open-source cloud native ecosystem

k8e.sh — Open Source Agentic AI Sandbox Matrix

GitHub Website Docs

If K8E powers your agents, give us a ⭐ — it means the world to us!

프로젝트 파일 및 신호

표시된 항목은 디렉터리 스냅샷에서 감지된 공개 저장소 신호입니다.

테스트감지됨
문서감지됨

저장소 정보

언어
Go
라이선스
Apache-2.0
최신 릴리스
v1.35.5-20260816-rc3+k8e1
마지막 업데이트
2026. 8. 17. AM 9:14

신중하게 설치하기

소스 코드, 권한, 수명 주기 스크립트, 의존성 및 네트워크 접근을 검토하고 신뢰하지 않는 플러그인은 격리 환경에서 테스트하세요.