MicroVMs

Architecture

How it's built

The demo is a single MCP server that turns tool calls into Kubernetes objects. Everything else is standard parts that already run in production: a Gateway, cert-manager and KEDA.

Today vs. the plan. In this demo every app runs as a locked-down Kubernetes pod (containerd) on a shared cluster. In the product, each app gets its own QEMU/KVM microVM on a dedicated server pool. The agent side (MCP tools, URLs, lifetimes) stays the same; only the layer that runs the app changes.

Two paths through the system

An agent deploys through the MCP server. A visitor opening the app goes through the Gateway. The two paths only meet at the Kubernetes objects.

Deploy path (agent)
AgentClaude Code, Claude.ai, Desktop or any MCP client
→
MCP servermcp.apps.kotono.nl/mcp
Python, streamable HTTP, OAuth or personal token
→
Kubernetes APIscoped Role in the apps namespace only
→
Per-app objectsDeployment · Service · ConfigMap · Certificate · HTTPRoute · HTTPScaledObject · Gateway listener
Request path (visitor)
Browserhttps://<name>.apps.kotono.nl
→
HA-IPone public address shared by all apps
→
Istio Gatewayper-app HTTPS listener with a Let's Encrypt certificate
→
KEDA interceptorholds the request and wakes the app if it's asleep
→
App pod0 or 1 replica, ambient mTLS

What one deploy does

Calling deploy_static(name="tips", html=…) runs these steps in order. Redeploying with the same name updates the app in place and keeps the URL.

  1. Authenticate and claim the name

    The token maps to a user. If tips already belongs to someone else, the call is refused. Everything gets an owner label.

  2. Store the files

    Pages and code go into a ConfigMap (up to 50 files, 900 KB in total; bigger uploads are sent in 100 KB parts). deploy_from_url uses an init container that downloads the repo or archive instead.

  3. Create the workload

    A Deployment running nginx-unprivileged (static), python:3.12 or node:22 (code), or the given image. It runs as non-root with all capabilities dropped, a seccomp profile and no service account token.

  4. Wire up HTTPS

    A cert-manager Certificate for tips.apps.kotono.nl, a new listener on the shared Gateway (with optimistic locking so parallel deploys don't overwrite each other) and an HTTPRoute.

  5. Enable scale to zero

    A KEDA HTTPScaledObject routes the host through the interceptor and scales to 0 after 5 idle minutes.

  6. Warm it and return the URL

    The server sends one request through the interceptor so the app is already awake when the agent shares the link.

Guardrails

The agent runs code nobody reviewed, so the platform assumes every app is untrusted.

ConcernHow it's handled
Isolation between appsPod Security restricted, non-root, no privilege escalation, all capabilities dropped, no service account token. Plan: own kernel per app (KVM)
NetworkDefault deny. Inbound only from the Gateway and KEDA. Outbound only DNS and ports 80/443 to the public internet; all private ranges are blocked, so no internal services and no outgoing mail.
CapacityNamespace quota: 10 pods, 2 CPU / 2 GiB requested, max 1 CPU / 512 MiB per container. No LoadBalancers, NodePorts or volumes.
Clean-upA reaper thread deletes apps 2 hours after deploy. Approved users can set a longer lifetime or keep an app.
OwnershipUsers only see and change apps carrying their own owner label. Names are first come, first served.
MCP server itselfIts Role only reaches the apps namespace plus the single Gateway object. Read-only root filesystem, non-root.
AccessPersonal tokens kept in a Kubernetes Secret, compared in constant time. OAuth for Claude.ai with redirects limited to Claude and localhost.

The parts

What runs where on the cluster (four nodes, Kubernetes 1.37).

ComponentNamespaceRole
MCP servermcp-systemThe tools, OAuth login, token check, reaper. Code is shipped as a ConfigMap; no image build needed.
Istio Gateway publicingress-nginxTerminates TLS for every app. Lives there because the existing HA-IP Service can only select pods in its own namespace.
KEDA + HTTP add-onkedaScale to zero and wake on request.
cert-managercluster-wideLet's Encrypt certificates via HTTP-01 on the Gateway, one per app.
AppsappsEverything agents deploy, with the quota and network policies above.

The repo

Everything for the demo is in mcp-demo/, with the Gateway config next to it.

PathWhat
server/server.pyMCP tools and Kubernetes logic
server/oauth.pyOAuth provider and login page, state kept in a Secret
k8s/mcp-server.yamlServer Deployment, RBAC, Let's Encrypt Issuer
k8s/apps-namespace.yamlThe apps namespace: quota, limits, network policies
deploy.shApplies the manifests, ships the code, restarts the server
add-user.sh · remove-user.shIssue or revoke a personal token and write ready-to-paste configs
keep-users.shWho may choose app lifetimes
install-keda.shInstalls KEDA and the HTTP add-on
../gateway/Istio Gateway, routes, certificates and reference grants

From demo to microVMs

What carries over, and what still has to be built.

Reused

The agent interface

The MCP tools, names, URLs, lifetimes and ownership model stay the same.

Reused

The front door

One shared address, per-app certificates and wake on request. No public IP per app.

To build

The runner

QEMU/KVM microVMs (no UEFI, minimal devices) on a dedicated server pool, kept apart from VPS.

To build

Placement and networking

Deciding where each microVM runs, its addresses, and routing from the Gateway to it.