II.
Page JSON
Structured · livepage:docs-agent-mux-tutorials-k8s-mode
Kubernetes Invocation Mode json
Inspect the normalized record payload exactly as the atlas UI reads it.
{
"id": "page:docs-agent-mux-tutorials-k8s-mode",
"_kind": "Page",
"_file": "wiki/docs/agent-mux/tutorials/k8s-mode.md",
"_cluster": "wiki",
"attributes": {
"nodeKind": "Page",
"sourcePath": "docs/agent-mux/tutorials/k8s-mode.md",
"sourceKind": "repo-docs",
"title": "Kubernetes Invocation Mode",
"displayName": "Kubernetes Invocation Mode",
"slug": "docs/agent-mux/tutorials/k8s-mode",
"articlePath": "wiki/docs/agent-mux/tutorials/k8s-mode.md",
"article": "\n# Kubernetes Invocation Mode\n\n`RunOptions.invocationMode = { kind: 'k8s', ... }` runs the agent inside a Kubernetes pod, exec'ing into a container you control.\n\n## Quickstart\n\n```ts\nawait client.run({\n agent: 'claude',\n prompt: 'Run the suite',\n invocationMode: {\n kind: 'k8s',\n namespace: 'agents',\n pod: 'amux-runner-0',\n container: 'runner',\n },\n});\n```\n\nOr via CLI:\n\n```bash\namux run claude \\\n --mode k8s \\\n --namespace agents \\\n --pod amux-runner-0 \\\n --container runner \\\n --prompt \"Hello\"\n```\n\nUnder the hood this becomes:\n\n```\nkubectl exec -n agents amux-runner-0 -c runner -i -- \\\n claude --output-format jsonl --prompt \"Hello\"\n```\n\n## Ephemeral pods\n\nTo create a one-shot pod from an image, use `kind: 'k8s'` with `create: true`:\n\n```ts\ninvocationMode: {\n kind: 'k8s',\n namespace: 'agents',\n create: true,\n image: 'ghcr.io/a5c-ai/amux-runtime:latest',\n env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },\n}\n```\n\nThe run handle will delete the pod on completion.\n\n## Remote agent pattern\n\nCombine with the `agent-mux-remote` adapter to host many agents behind one pod template:\n\n```ts\nawait client.run({\n agent: 'agent-mux-remote',\n prompt: 'Hello',\n invocationMode: { kind: 'k8s', namespace: 'agents', pod: 'amux-0' },\n env: { AMUX_REMOTE_AGENT: 'claude' },\n});\n```\n\n## Prereqs\n\n- `kubectl` on `PATH` with a context that can `exec` into the target namespace.\n- The pod's container image must include the target agent CLI (or `amux` when using `agent-mux-remote`).\n\nSee [Invocation Modes](../reference/13-invocation-modes.md).\n",
"documents": []
},
"outgoingEdges": [],
"incomingEdges": [
{
"from": "page:docs-agent-mux-tutorials",
"to": "page:docs-agent-mux-tutorials-k8s-mode",
"kind": "contains_page"
}
]
}