Skip to content

Credential isolation

The PlatformAgent shell sandbox receives no API keys, access tokens, or refresh tokens through its environment or filesystem. The one credential it holds is a projected ServiceAccount token bound to the credential broker’s audience, which the Kubernetes API server does not accept; the audience is what keeps it from being a general Kubernetes credential. Its ServiceAccount is bound to no Google service account, so the metadata server has nothing to give it either. Credentials live in a trusted credential broker that runs as a Pod of its own, and the sandbox reaches credentialed capabilities only through a policy-enforced proxy across the network.

This is the only layout. There is no configuration that puts the broker back in the agent Pod and none that turns the shell sandbox off — spec.harness.experimental.shellSandbox.enabled: false is refused with Degraded/ShellSandboxCannotBeDisabled. The gateway’s platform-agent container does hold two credentials: the audience-bound token it presents to the broker, and a second audience-bound projected ServiceAccount token for the A2A bus. There is no password: the container names its bus principal in A2A_BUS_USER and the bus’s auth callout resolves the token to that principal’s grants. The agent now holds a credential has the trade.

This page summarizes the architecture. The canonical design — including scope, deny-policy details, migration steps, and CI verification assertions — is docs/credential-isolation-design.md.

Each PlatformAgent runs as four Pods (<name>-kube-proxy runs two replicas). The operator adds the A2A stack’s Pods beside them and one container to the gateway Pod; the A2A stack’s Pods below lists them.

Pod / container Trust level Role
<name>-gateway
  platform-agent Untrusted The model, the skills and the chat adapters. No CLI, and two credentials: the broker-audience token and the bus token.
  agent-api-auth Trusted The PlatformAgent API front door; the event watcher, which forwards cluster events on its own Kubernetes-API token; and, where enabled, the drift detector, which pulls audit records. Both make their Google calls (fleet clusters, Pub/Sub) through the broker’s watcher routes. And the audit-report store listener on 8700.
  fluent-bit Trusted Log forwarding.
  platform-agent-dashboard Untrusted Optional local dashboard (also credential-free).
  hermes-bridge Untrusted Takes tasks off the bus and runs each as a turn on the agent’s API server. Its image is the bridge program alone, with no shell and none of the agent’s files. It gets the agent container’s environment and mounts, except the Pod’s bus token, and holds the bridge bus password.
<name>-shell Untrusted sshd, /opt/data, the agent’s tools, stock kubectl wired to <name>-kube-proxy, and the broker CLI wrappers. Everything the model executes runs here.
<name>-kube-proxy Trusted The Kubernetes API proxy (two replicas). Verifies sandbox and session tokens (and, with an AgentProfile bound, profile worker tokens), enforces read-only-dry-run policy, and redacts Secret values.
<name>-credential-proxy Trusted Envoy, the credentialed command and chat runtime, the Minty client. Runs nothing the model wrote.

agent-api-auth is a native sidecar — an initContainers entry with restartPolicy: Always, needing Kubernetes 1.29+ — so it starts before the others and does not appear in spec.containers.

The operator also renders the A2A stack (Architecture → Deployment topology). The session pods are the only ones that run an agent; the rest hold the one bus identity each needs and no forge or cloud credential:

  • <name>-a2a-nats-0: the NATS JetStream bus, with the TLS websocket listener the console server proxies to. It holds the certificate its listeners serve and nothing of the agent’s.
  • <name>-a2a-callout (two replicas): the auth callout that authenticates every bus client, resolving a projected ServiceAccount token to its principal’s grants with a Kubernetes TokenReview. It holds the issuer keys in <name>-a2a-callout-keys.
  • <name>-a2a-verifier (two replicas): the capability verifier, the only principal that may read the cap bucket; a task submitted while no verifier is ready is refused.
  • <name>-a2a-gateway: the chat backend and the console door. It holds the Slack tokens when it holds Slack, and reaches Google Chat and Microsoft Teams through the broker with the kubeagents-credential-proxy-a2a-chat audience described below. On every install it also holds a kubeagents-credential-proxy-a2a-reports token, which it presents to the broker to read finished audit reports.
  • <name>-a2a-console: the console server, which hands the A2A console page the shared console bus password and proxies its websocket. Reachable only through kubectl port-forward.
  • <name>-a2a-provision-<hash>: the Job that provisions the streams, once per change.
  • <name>-bus-pin-<run>, <name>-bus-unpin-<run> (Jobs created by a three to one migration; their bus identity exists only while their work runs): each on its own ServiceAccount with no RBAC. The bus identity lets the pin Job move each provisioned stream’s leader and replica count by name (INFO, LEADER.STEPDOWN, UPDATE), and the unpin Job its replica count (INFO, UPDATE). Each identity expires at the run’s deadline.
  • <name>-bus-snapshot-<run>, <name>-bus-clear-<run>, <name>-bus-restore-<run>, <name>-bus-rollback-<run> (pods created by a one to three migration; their bus identity exists only while their work runs): the operator’s own pods, on one ServiceAccount per run with no RBAC. Theirs is the only bus identity that may SNAPSHOT, RESTORE or DELETE a stream, each in the phase that sends it and on the provisioned streams by name. It is in the identity map only while one of them runs, and expires at the run’s deadline.
  • <name>-bus-hash-<run> (pod): reads the staged snapshots read-only and reports their digests. It holds no bus credential.
  • During a one to three migration’s write freeze, the identity map holds only the migration’s identity and a sentinel that grants its own inbox, bound to a ServiceAccount nothing creates. No other workload authenticates to the bus; the callout’s own user and the system account stay. See Changing the bus’s server count.
  • Session pods (<profile>-<animal>-<hex>): one per /session conversation, all on one session ServiceAccount distinct from the gateway’s, fenced by an egress NetworkPolicy and a ResourceQuota. They read a cluster only under their cluster view, on by default on the session route, through <name>-kube-proxy for kubectl and the broker for gcloud, as the next paragraph says. Security and IAM covers their bus identity.
  • <name>-teams-inbound, when spec.integration.teams.inbound is enabled: the Microsoft Teams inbound receiver, the one pod the internet reaches, behind the Ingress you provide. It holds no credential of the install’s own: it verifies Microsoft’s signed token on each request and hands the activity to the broker under the audience below.
  • <name>-a2a-mcp: the MCP server, rendered by default (operator.mcpServer.enabled: false switches it off), holding its own console-mcp bus password and its own bearer token.
flowchart TB
subgraph GW["<name>-gateway Pod"]
AGENT["platform-agent<br/>model, skills, chat adapters<br/>broker-audience token and bus token"]
end
subgraph SH["<name>-shell Pod"]
SHELL["sshd + tools + stock kubectl + CLI wrappers<br/>no credentials, no cloud identity"]
end
subgraph KP["<name>-kube-proxy Pods"]
KPROXY["k8s-api-proxy :8443<br/>read-only-dry-run + Secret redaction"]
end
subgraph BR["<name>-credential-proxy Pod"]
ENVOY["Envoy listener<br/>:8765"]
RUNTIME["Credential runtime<br/>real CLIs, Slack/Chat clients, Minty client<br/>secret env + projected KSA token"]
end
AGENT -->|ssh| SHELL
SHELL -->|"HTTPS kubectl + bearer token"| KPROXY
SHELL -->|"HTTP (structured argv, relayed reads) + bearer token"| ENVOY
AGENT -->|"chat, MCP and Pub/Sub relays + bearer token"| ENVOY
ENVOY -->|private Unix socket| RUNTIME

The credential runtime also opens up to two TCP listeners of its own. The first, on port 8766, serves /metrics (unauthenticated, Concepts → Observability) and—under sizingProfile: auto in-cluster—bearer-authenticated active-standby handoff endpoints (/control/status, /control/activate, /control/drain) backed by CREDENTIAL_PROXY_CONTROL_FILE (the operator-managed <name>-credential-proxy-control Secret). It holds no workload CLI/API route or upstream credential, and answers at most sixteen connections at a time with a ten-second deadline on each, so a peer that reaches the port cannot exhaust the process that holds the credentials.

The broker’s NetworkPolicy admits the sandbox, the gateway, the A2A gateway (its audit-report reader on every install, and the Google Chat and Microsoft Teams relays it uses), and (unless operator.mcpServer.enabled is false) the A2A MCP server’s pod on 8765. More peers join that rule, each under its own condition. The Teams inbound receiver joins when spec.integration.teams.inbound is enabled. The session pods join under their cluster view, and the profile namespace’s pods join with an AgentProfile bound. The scope publisher’s pods join when the chart’s gateway-pod admission policy is present, whatever spec.scope declares.

On 8766 it admits pods in gke-gmp-system, where Managed Prometheus runs, and the operator’s own pods. The operator reads metrics into status.usage and status.sizing, and—under sizingProfile: auto in-cluster—calls bearer-authenticated /control/* endpoints for active-standby cutover. Nothing else reaches either port by selector. Under sizingProfile: auto in-cluster, port 8765 also admits sibling broker pods so standby pods can verify active peer /healthz (which :8765 routes alongside :8768 to the isolated health cluster).

Above one replica, on a chart install, where the CR shares the operator’s namespace, the agent’s Role can label a pod of that namespace to match the operator’s selector. That gains it the two listeners’ counters: the watcher’s, which the agent container already reaches over its own pod’s loopback, and the broker’s, to which it has no route today. Those are integers under closed label vocabularies and nothing else.

Envoy opens a second listener of its own, on port 8768, for the pod’s readiness probe. It routes one path, /healthz, to the broker through a cluster with its own small connection cap, and answers every other path with 404. The credentialed listener’s cluster caps the connections it holds to the broker, and every open cluster watch holds one, so a probe through it would fail once the fleet reached that cap. Neither the Service nor the NetworkPolicy opens 8768; the kubelet reaches it on the pod IP as it reaches any probe. The broker container has no liveness probe: the start script supervises both processes, and a probe-driven restart would drop every open watch.

The second opens only when CREDENTIAL_PROXY_HEALTH_PORT names a port, and answers GET /healthz and nothing else, under the metrics listener’s connection cap and deadline. A probe pointed at it reads the broker as alive even while the credentialed listener is at its thread cap; /healthz on 8765 stays, and the operator’s readiness probe reads it through Envoy’s health listener on 8768, above. The broker’s NetworkPolicy admits no pod on that port, so only a kubelet probe reaches it.

The thread cap is CREDENTIAL_PROXY_MAX_THREADS. By default it is the sum of Envoy’s connection ceilings to the broker’s socket, read at startup from the Envoy config beside the broker, so Envoy’s breaker refuses before the cap does. As shipped that is 4160: 4096 on the credentialed cluster plus 64 on the probe’s, and 1024 where none is declared. A connection past it is answered 503 with Retry-After: 5 and closed before any handler thread is spent. The log says ALERT connection refused when that starts and at most once a minute while it lasts, with the count refused in between. Envoy reuses each connection to the broker across requests, so a thread is held per open connection, not per request.

The PlatformAgent API door on 8643 shares the cap but has no Envoy in front of it, so nothing is derived for it: its cap is CREDENTIAL_PROXY_MAX_THREADS on the agent-api-auth container, 1024 when unset.

With spec.deployment.credentialProxy.exec.replicas above 0, the operator also runs the broker’s exec tier: <name>-credential-proxy-exec-tier pods from the same image, as the same Workload Identity ServiceAccount, that answer /v1/exec and /v1/gcp/ only. They mount no forge credential, no chat token and not the broker’s token for the minter or the audit-report store, and do not carry the label that opens the token minter. The one Secret they mount is the outbound proxy’s CA bundle (spec.proxy.caBundleRef), which holds public certificates.

Their NetworkPolicy admits the sandbox, the session pods under the cluster view and the profile namespace on 8765, and the same metrics readers on 8766. The sandbox, the profile workers and the session pods are given the tier’s address; they send their commands there and fall back to the broker Service when they cannot connect to it.

The sandbox image contains a wrapper binary for gcloud (and routes kubectl through <name>-kube-proxy). Forge access (issues, pull requests, publishing revisions) goes through the version-control broker’s verbs, and the sandbox’s git is a local hardened binary with no credential and no network transport. The gcloud wrapper sends the executable name and argument array to Envoy at the broker Service; the credential runtime executes the corresponding real CLI and returns output and exit status. It never evaluates an agent-supplied shell command, and the runtime’s Unix socket is mounted only in the broker Pod, so the sandbox cannot bypass Envoy. The real credential-aware CLIs ship in a separate credential-proxy image that neither the gateway nor the sandbox runs.

The broker authenticates every caller. A projected ServiceAccount token, one hour long, with an audience chosen per caller, is presented as a bearer header and verified with a Kubernetes TokenReview. The audience is what tells the broker which caller it is serving:

Audience Caller
kubeagents-credential-proxy The sandbox.
kubeagents-credential-proxy-chat The gateway.
kubeagents-credential-proxy-watcher The gateway’s agent-api-auth container alone, where the event watcher and drift detector run.
kubeagents-credential-proxy-a2a-chat The A2A gateway, when it serves Google Chat or Microsoft Teams.
kubeagents-credential-proxy-a2a-reports The A2A gateway, on every install. It reaches the audit-report store’s two report reads alone (below); the broker refuses it from any other ServiceAccount, and holds the gateway’s ServiceAccount to this audience and the a2a-chat one.
kubeagents-credential-proxy-session The session pods, under their cluster view: on by default on the session route, and overridden by the operator’s A2A_SESSION_CLUSTER_VIEW.
kubeagents-credential-proxy-profile Each profile tier’s ServiceAccount, with an AgentProfile bound.
kubeagents-credential-proxy-mcp The A2A MCP server’s pod, unless operator.mcpServer.enabled is false (and while the PlatformAgent controls its ServiceAccount). It reaches /v1/vcs/ alone, and only its proposal-view verb.
kubeagents-credential-proxy-scope The scope publisher’s Job, when the chart’s gateway-pod admission policy is present and <agent>-scope-publisher is the PlatformAgent’s, whatever spec.scope declares. It reaches /v1/exec alone, for gcloud only.
kubeagents-credential-proxy-teams-inbound The Teams inbound receiver’s pod, when spec.integration.teams.inbound is enabled. It reaches one route by one method, POST /v1/chat/teams/events, the Teams queue’s intake; the broker refuses it every other route and refuses the audience to every other ServiceAccount.

Every path on the credentialed listener except /healthz requires it, and an unidentified caller gets an undifferentiated 401. On port 8766, /metrics is unauthenticated like /healthz because the Prometheus collector and operator poller hold no caller token. Meanwhile, under sizingProfile: auto in-cluster, /control/* requires bearer authentication against <name>-credential-proxy-control (404 otherwise). The broker’s NetworkPolicy bounds who reaches port 8766, and /metrics serves counters with static labels and holds no upstream credential or policy.

CREDENTIAL_PROXY_ALLOWED_CALLERS names the ServiceAccounts served: the sandbox’s, where credentialed commands originate; the gateway’s, because the chat, MCP and Pub/Sub relays use the same listener; and the A2A gateway’s own, on every install, for its audit-report reader. That last one is bound both ways to kubeagents-credential-proxy-a2a-reports through CREDENTIAL_PROXY_A2A_REPORTS_CALLERS, which also lets it present kubeagents-credential-proxy-a2a-chat; when the A2A gateway serves Google Chat or Microsoft Teams, CREDENTIAL_PROXY_A2A_CHAT_CALLERS binds it to that audience the same way.

Unless operator.mcpServer.enabled is false (or another owner holds the ServiceAccount), it also names the A2A MCP server’s ServiceAccount, bound both ways to kubeagents-credential-proxy-mcp through CREDENTIAL_PROXY_MCP_CALLERS. Under the session pods’ cluster view it names one more, the session pods’ ServiceAccount, bound to the audience kubeagents-credential-proxy-session. That ServiceAccount may present no other audience, and no other caller may present that one.

With an AgentProfile bound, it names each profile tier’s ServiceAccount too, bound the same way to kubeagents-credential-proxy-profile. That role reaches kubectl and gcloud, on the cluster and project in the dispatcher’s signed task credential, which the worker sends in X-Kube-Agents-Task-Credential (design). Its log reads leave out the container logs of the profile namespace and of the agent’s namespace. A worker’s kubectl goes through <name>-kube-proxy instead, once the operator has opened that proxy to the profile namespace. The proxy holds it to the cluster in the same credential. The role’s kubectl serves a worker that is not routed there.

With that credential the profile role also reaches the MCP relay, for the Developer Knowledge server’s two document reads and nothing else, and the audit-report store’s routes, under the rules in Request paths. The broker replaces credential-shaped strings with [REDACTED] in this role’s MCP relay replies, audit-report reads and forge-text version-control reads, as it does in its command output. A reply with none passes byte for byte. A clone answer, a git bundle, is not changed.

With spec.integration.teams.inbound enabled, it names the Teams inbound receiver’s ServiceAccount too, bound to kubeagents-credential-proxy-teams-inbound through CREDENTIAL_PROXY_TEAMS_INBOUND_CALLERS.

The profile role also reaches the version-control routes, and every verb there needs that credential. It may read the managed repository: clone it, and view and list its pull requests and issues.

It may push a branch and open or update a pull request only when the credential carries the vcs:proposal-create permit. The dispatcher grants that permit only to a request that asked for a change through a structured confirm. Even then it opens or updates only a pull request from the install’s own branch in that repository, and pushes only to the install’s own branch namespace, never onto a branch that carries somebody else’s pull request. It may change a pull request’s title and description, but never its labels. The managed-repository list bounds both, and no other write is open to it.

Within that, a task writes only on what it made itself: a branch it pushed while the name was free, and a pull request it opened. A later task can’t continue an earlier task’s branch or pull request.

While the scope publisher’s Job may run, on the condition the audience table gives, it names the publisher’s ServiceAccount too, bound both ways to kubeagents-credential-proxy-scope through CREDENTIAL_PROXY_SCOPE_CALLERS; that role reaches gcloud alone.

Nothing crosses as a path. No filesystem is common to the sandbox and the broker, so a directory name sent from one means nothing in the other — or, worse, names a same-named directory of the broker’s. The working directory is therefore not sent at all, and every proxied command runs at the broker’s own workspace root. Four things cross instead: a document on stdin, a kubeconfig as a context name, a change as a bundle of revisions, and a read as a tar of one revision.

The environment does not cross either, save one tag on gcloud calls. The shim forwards a well-formed CLOUDSDK_METRICS_REQUEST_ATTRIBUTION (agent-skills/<ver> (skill:<name>), or the active skill in CREDENTIAL_PROXY_ACTIVE_SKILL_FILE) as gcloudAttribution. The broker sets AI_AGENT=kube-agents and that validated CLOUDSDK_METRICS_REQUEST_ATTRIBUTION on the gcloud child only. Any other variable exported in the agent shell has no effect on the proxied process’s environment.

A kubeconfig names a cluster; it never supplies content. A kubeconfig is executable configuration, not passive data. Fields such as users[].user.exec.command, clusters[].cluster.server, and users[].user.tokenFile would respectively run a program next to the credentials, redirect the minted access token, and disclose a broker file as a bearer token. None of it is visible to the command policy, whose rules match on the argument array: the argv is only ever kubectl get pods. The design doc has the full enumeration and the reasoning.

So the caller sends one string, a context name, the broker accepts it only if it is a well-formed gke_<project>_<location>_<cluster>, and it regenerates the kubeconfig itself with gcloud container clusters get-credentials into a directory mounted only in the broker Pod. That regenerated file is what every proxied command runs against (on an install that has armed the scoped service account pool, kubectl runs against a further derivation of it carrying the pool member’s token). get-credentials is the one command allowed to author a kubeconfig, and it writes only into the broker’s own directory.

Naming a cluster is not extra authority — get-credentials is bound by the same IAM the proxy already runs under, so it can only reach clusters this identity could reach anyway. A context name the proxy cannot regenerate from is rejected with 400 rather than honored.

A checkout the agent wrote is never a checkout the broker runs git in. The agent cannot hand the broker a directory at all, because there is no writable volume both can see (the one object both Pods project is the GitOps state ConfigMap, a read-only list of repository names). A skill that wants to change a repository has two ways up, and neither of them is a path.

The version-control verbs give the skill a private copy in the sandbox and send the work up as a bundle of revisions: the broker fetches that bundle into a scratch repository of its own and pushes from there. fleet-audit publishes a fix the same way: it clones the repository into the sandbox, commits there and sends the bundle. Either way the tree the credentialed git runs in is one the broker made.

That closes the .git/config class outright. core.fsmonitor and every other setting that names a program to run is read by git on every invocation, including read-only ones, and no argument-level policy could enumerate it; but the agent never supplies the tree it is read from. A forge’s CLI is kept out of those scratch clones for the same reason: it infers a repository from the nearest .git/config above its working directory, so the broker runs it from the scratch root, which holds none.

Leases order concurrent writers on the proxied-git path, since a Pod runs every scheduled audit on the Platform Agent’s roster alongside every kanban worker. The proxy refuses git add, commit, checkout, push, reset and the other verbs that write a working tree or a remote ref unless the resolved directory sits under one holding a .lease marker; the refusal is SECURITY_POLICY_BLOCKED with rule git.workspace.lease.

It is a floor rather than an ownership check — the broker can tell that a push is happening inside some lease, not whose. The version-control verbs never reach it, because they never name a directory; what keeps their callers apart is the copy’s name in the sandbox’s own scratch root, keyed on the repository and the branch. docs/designs/gitops-workspace-leases.md is canonical for the layout and the reaper.

git runs with its configuration pinned by the proxy. git is the one permitted executable that takes both its transport and its helper programs from configuration files, and several of those it reads from paths a caller could once influence. So its defaults are overridden rather than trusted. Every proxied git runs with:

  • the transport allowlist restricted to https;
  • the system configuration file suppressed;
  • the global configuration file pinned to a path mounted only in the broker Pod;
  • the hooks directory pinned to an empty directory the agent cannot write to;
  • the file-system monitor disabled;
  • commit signing disabled, along with the signing program of every signature format git supports rather than just the default one;
  • subcommand autocorrection off;
  • a push kept in the repository the command names, so git does not also push inside its submodules;
  • both of the editors git launches set to a command that does nothing. The broker has no terminal, so nothing that needed one could have worked anyway.

On the defence-in-depth argument gate behind /v1/exec (which itself refuses git in favor of the /v1/vcs/* routes described below), the proxy also refuses, in the argument array, the global options that would undo any of that:

  • -c and --config-env, which set configuration outranking the pins;
  • --exec-path, which chooses where git looks for the program to run;
  • --git-dir and --work-tree, which name a repository directly and so sidestep the workspace containment applied to the working directory;
  • --attr-source and --shallow-file, which redirect attribute or shallow file lookup;
  • --global, --system and --file, which write the configuration files the proxy pins.

-C remains available for choosing a directory inside a leased workspace, since the containment check follows it. Repository-local git config remains available for author identity configuration (user.name, user.email) and query options (--get, --list, get, list).

Subcommands on that gate are restricted to an explicit allowlist (ALLOWED_GIT_SUBCOMMANDS). Beside it sit the refused subcommands and options that run caller-named programs on an ordinary subcommand. Those run a command once per commit during a rebase, over the matches of a search, to compute a commit trailer’s value, or, for --help, through the documentation viewer.

The viewer needs both entries: git help -m and git help -w run the program named in man.<tool>.cmd or browser.<tool>.cmd, and git status --help reaches the same viewer with status in the subcommand slot, so neither refusal closes it alone. No pin can reach those keys, because the name inside the key is arbitrary. -h stays available; git answers it from the subcommand’s own option table without starting a viewer.

The design doc has the full list of git options and subcommand controls. Every refusal comes back as SECURITY_POLICY_BLOCKED with rule git.argument.refused, and no shipped skill uses any of them.

These pins were never what handled configuration stored inside a repository’s own .git/config, which no pin can reach. That is closed by the broker owning every tree it runs git in. The proxy serves /v1/vcs/*, where the caller sends a bundle or asks for a snapshot of one revision, and each broker tree lives for one request. There is no field to turn these routes off: an install that could would be choosing to keep the class open. The design doc has the mechanism and what it is and is not worth.

The broker also serves POST /v1/feedback/submit to the sandbox: it files a confirmed report about kube-agents itself through the project’s public feedback form. To do that it reaches the form’s short link on the docs site, the Google Forms host the link names, and api.github.com unauthenticated to find the issue the form opened. It holds no credential for any of the three and keeps nothing across calls, and the sandbox, which reaches only DNS and the broker, has no other way to the form.

This is a write path from model-authored code to a public tracker. What bounds it is the confirmation the persona has to obtain before the card is filed, the payload’s user_confirmed assertion, and the secret-shaped text the broker refuses. A match on the title and the report’s own text against the tracker’s last day files one report once. A report that a person did not see word for word is the failure the design guards against; see docs/designs/chat-feedback-command.md.

kubectl and gcloud are read-only by default. The proxy enforces that kubectl may not run mutating verbs like delete, create, patch, or rollout restart, and that gcloud may not run commands that change cloud resources. It refuses the flags that would change which identity a command authenticates as or which server receives the credential: --as, --server, --token, --kuberc, --insecure-skip-tls-verify and their gcloud equivalents. kubectl reads an underscore in a flag name as a hyphen, so the proxy refuses --tls_server_name as it refuses --tls-server-name. The refusal comes back as SECURITY_POLICY_BLOCKED with a rule such as kubernetes.read-only or kubernetes.identity-change-forbidden.

gh may not complete a change on GitHub. The agent’s job is to propose, so the proxy refuses the verbs that would let it also dispose:

  • merging a pull request (github.merge);
  • approving a review (github.assent);
  • mutating through the REST API: gh api with -X POST|PUT|PATCH|DELETE or a field flag (github.api-mutation);
  • triggering a workflow run or cutting a release (github.pipeline-trigger);
  • repository administration: secrets, variables, and repository delete, archive or edit (github.repo-administration).

Rulesets are not on that list because gh ruleset cannot change one: it has only check, list and view, and reshaping a ruleset goes through gh api, where github.api-mutation refuses it. Opening pull requests, issues and comments is untouched, which is the path the product runs on. The refusal is SECURITY_POLICY_BLOCKED with the rule id.

These are deny rules shipped in the operator’s policy ConfigMap, not entries in the broker’s built-in allowlist the paragraph below is about. A false refusal here is fixed in a different place; see the appeal note at the end of this section.

How much this allowlist is carrying depends on the permission set. On a default read-only install it is the outermost of three layers, not the whole control. The agent’s KSA holds no write verb on workloads or cluster state, so the API server refuses a mutation the allowlist missed. The GSA holds the read-only set’s roles, which grant no write to infrastructure; Roles per set names the one qualification, under the Trace role. So a gcloud mutation is refused at GCP, the Trace-console writes excepted, and those the allowlist refuses. Security and IAM is canonical for what the agent may and may not do; this page describes only the proxy’s own layer.

Under a custom permission set that names an admin role, that stops being true. roles/container.admin authorizes the agent through IAM regardless of its Kubernetes RBAC, so both layers beneath the allowlist fall away and a command it fails to refuse runs with the broker’s full credential. Treat the allowlist as the only control in that configuration.

Kubernetes impersonation is planned and not yet deployed; once it ships, the API server will authorize each request as the requesting human user rather than as the agent. Note also that the current deployment shares one Google service account across every agent — that is the gap impersonation closes, not a mitigation.

A first deployment in a live environment will find read-only commands nobody anticipated. A kubernetes.* or gcp.* refusal means the broker’s built-in allowlist lacks the verb, which is a change to kube-agents rather than to your install. A github.* or git.* refusal comes from the deny policy the operator renders, which is a different review. Report the blocked command to your infrastructure team with the rule id from the refusal; the change stays scoped to the one command that was missing.

The exception is gcp.scoped-sa.unmapped-scope, which is not a verb problem at all. It means the request named a cluster in a project the scoped service account pool has no account for; the refusal names the project and the cluster. The fix is one of the three the refusal and this page name. Declare that project in the scope and apply so the pool derives its account; exclude the cluster from the fleet; or leave the pool disarmed. A project created under a declared folder since the last apply is refused until the next apply lists it.

scope.excluded-cluster isn’t a verb problem either. The install’s spec.scope.exclude.clusters names that cluster, so the refusal is the exclusion working; remove the entry to let the agents back in. A serial port read is refused for an instance whose name starts like an excluded cluster’s node, which can also be a node of a cluster whose name starts with the excluded name (spec.scope says how). scope.exclude-unreadable means the broker can’t read the scope file the operator mounts, and it reaches no cluster until it can.

scope.held-cluster is an operator’s pause: spec.hold names that cluster, or every cluster, and the refusal quotes its reason. Removing the hold lifts the refusal, usually within a minute or two. scope.hold-unreadable means the hold file can’t be read, and the broker reaches no cluster until it can.

Data <name>-shell platform-agent Credential broker
spec.deployment.env Five names only, which the operator normalises (see below) Allowlisted names only, as literal values Yes
Slack / Teams credentials No No Yes, Secret-backed env; when the A2A gateway holds Slack (Slack on, Google Chat off), it holds the Slack tokens instead
PlatformAgent external API key No No Yes, Secret-backed env
Session KV API key and HMAC salt No Yes, Secret-backed env Yes, API key only
Automatic KSA token mount Disabled Disabled Disabled
Explicit projected KSA token Broker audience Broker audience and a2a-bus Read-only, one-hour token
A2A session pod’s broker token — — Under the session pods’ cluster view, each session pod projects a token for the session audience; <name>-kube-proxy accepts it for read-only-dry-run kubectl (with Secret redaction) and the broker confers a role that reaches gcloud reads only
Cloud identity via metadata None — unbound ServiceAccount Yes Yes
gcloud/kubectl configuration No No Private emptyDir
GitHub installation token/cache No No Private emptyDir
Working tree for proxied git No No Broker’s own volume

SESSION_KV_API_KEY and SESSION_KV_SALT are platform-agent’s only Secret-backed environment variables, and both are pod-scoped: neither opens anything outside the gateway Pod. They cannot sit behind the proxy because that container is the server here.

session_kv_server.py binds 127.0.0.1:8699 and needs the key in order to reject callers that are not one of its clients. Those clients are the event watcher, the drift detector, the Platform MCP server, the incident_context plugin, the kanban notifier, the chat adapter’s scheduled-report relay, the two findings scripts and the stall-watch cron script. The salt hashes chat identities before they are written, which has to happen where the identity already is. The design doc has the full reasoning.

Both are optional in the sense that the pod starts without them, and one of them is not optional in practice. The k8s-event-watcher in agent-api-auth authenticates with SESSION_KV_API_KEY and treats an empty value as fatal, so it exits on every start and no cluster events are watched at all. The container stays Ready, so its log is the only place that says so. The drift detector in the same container fails the same way on the same key, and with the same silence. The Session KV server also answers 503, and identity hashing falls back to a per-process salt with a warning.

Pod-wide automountServiceAccountToken is false on every pod (the A2A gateway automounts the token of its own narrow Role, which is the grant it spawns session pods with). Every projected token below expires after one hour:

Holder Token Where, and when
The sandbox Broker token, audience kubeagents-credential-proxy Always; the token every proxied kubectl and gcloud presents.
The broker Its own, audience kubeagents-credential-proxy Always.
The gateway Broker token, audience kubeagents-credential-proxy-chat Always.
The A2A gateway Broker token, audience kubeagents-credential-proxy-a2a-chat /var/run/secrets/a2a-chat-relay/token, when it serves Google Chat or Microsoft Teams.
The A2A gateway Broker token, audience kubeagents-credential-proxy-a2a-reports /var/run/secrets/a2a-reports/token (A2A_REPORT_STORE_TOKEN_FILE), on every install.
agent-api-auth A separate Kubernetes-API token projection for the event watcher The conventional in-cluster path. The audit-report store listener also reads the cluster JWKS with it.
The broker Audience kubeagents-audit-report-store /var/run/secrets/kubeagents/audit-report-store/token; what it presents to the audit-report store listener. Not in the exec tier.
agent-api-auth alone Broker token, audience kubeagents-credential-proxy-watcher For the watchers’ fleet and Pub/Sub calls.
The agent container Audience a2a-bus /var/run/secrets/a2a-bus/token.
Each session pod Broker token, audience kubeagents-credential-proxy-session Under the session pods’ cluster view.
The A2A MCP server’s pod Broker token, audience kubeagents-credential-proxy-mcp /var/run/secrets/a2a-mcp-broker/token, unless operator.mcpServer.enabled is false.
The scope publisher’s Job Broker token, audience kubeagents-credential-proxy-scope /var/run/secrets/kubeagents/credential-proxy/token, while the publisher may run (the audience table’s condition).
The operator’s manager pod Audience a2a-bus /var/run/secrets/a2a-bus/token. It authenticates to nothing until the identity map carries the operator’s entry, which publishes AgentProfile cards on the A2A directory.
The Teams inbound receiver Broker token, audience kubeagents-credential-proxy-teams-inbound /var/run/secrets/kube-agents/teams-inbound/token, with spec.integration.teams.inbound enabled.

None is mounted in the dashboard.

  • CLI commands — the sandbox forwards gcloud to the broker (while kubectl routes through <name>-kube-proxy); the broker also runs git, and the forge CLI of any configured forge that declares one, on its own behalf for the version-control verbs. The proxy rejects known credential-disclosure, credential-replacement, and self-modification operations, and the GitHub write path (see below); interactive TTY programs, unbounded streaming, sandbox-only file paths, and background processes fail closed.

  • Command output for profile workers and session pods — for a command the broker runs, it replaces credential-shaped strings in the command’s stdout and stderr with [REDACTED] before it answers. The shapes are GitHub, Google, AWS, Slack and model-provider keys and tokens, Authorization header values, signed JWTs, and passwords in URLs. A token the output cap cut short, a token after a JSON escape, and a whole private key block are replaced too. Redacted JSON output still parses. The exit code and the rest of the reply are unchanged. The sandbox’s shell gets the output as the command printed it, and the agent runtime redacts it there. The A2A MCP server’s proposal-view answers are redacted the same way.

  • kubectl output through <name>-kube-proxy — a session pod’s kubectl, and a routed profile worker’s, is not a command the broker runs. The proxy redacts Secret values and passes other output as the cluster returned it.

  • What redaction does not cover — it guards against a credential read by accident. It does not stop a model that reshapes output on purpose. The read-only gates, and the absence of Secret reads, are the controls for that. It does not match a token joined to a word character before it (AWS_AKIA...), PGP armour, or a value wrapped in base64.

  • Cloud API reads — GET /v1/gcp/<host>/<path> relays one Google REST read named in api_policy.API_READ_ROUTES on the broker’s identity, with the caller’s headers dropped and the credential-substituting query keys stripped. Today those routes are Cloud Monitoring, Managed Prometheus, Cloud Trace, Cloud Billing Catalog services and skus, and GKE cluster reads. One more read is a POST: Cloud Logging’s entries:list, for one project’s log entries. The broker checks its JSON body and forwards its own copy of it. Another host, a write, a sibling path or a token endpoint is refused with a gcp.api.* rule. credential_proxy_client.ApiSession is the client. See designs/gcp-api-relay.md.

  • Chat — Slack, Google Chat, and Microsoft Teams adapters send credential-free payloads to Envoy. The credential runtime owns the platform tokens (SLACK_BOT_TOKEN/SLACK_APP_TOKEN, Google Chat app credentials, and TEAMS_APP_ID/TEAMS_APP_PASSWORD) and performs the external API calls, enforcing method/host guards, tenant checks, and payload limits. A Slack-armed A2A gateway reads the Slack tokens as Secret-backed env itself and applies allowedUsers itself.

  • PlatformAgent API — the Service targets port 8643 on agent-api-auth in the gateway Pod, which validates the external bearer key and forwards to the agent API on loopback (port 8642) with a non-secret sentinel. It answers GET /api/scope directly from fleet_scope.json, the Cluster Agent profile directories on the data volume, and k8s-event-watcher’s loopback /metrics listener. The real key never reaches platform-agent.

  • GitHub — the broker obtains a Google OIDC identity token and calls Minty, which brokers a repository-scoped GitHub App installation token with a maximum one-hour lifetime. The App’s private key stays in Cloud KMS.

  • Watchers — the event watcher and the drift detector in the gateway Pod’s agent-api-auth container present the kubeagents-credential-proxy-watcher audience. It covers one GKE cluster read and the drift subscription’s four Pub/Sub calls under /v1/watcher/gcp/, and Kubernetes events, named reads, the event watcher’s count lists and one named Pod’s metadata under /v1/k8s/. The count lists read five cluster-scoped workload kinds, one item each with a metadata-only Accept; the Pod read also carries a metadata-only Accept. Of that Pod, the broker relays only:

    • its controller ownerReference (the kind, the name and controller: true), and only when the kind is one the owner lookup folds on: a ReplicaSet, StatefulSet, DaemonSet or Job;
    • for a ReplicaSet, the pod-template-hash label, and only when the ReplicaSet’s name ends in -<hash>. For any other ReplicaSet, neither the ownerReference nor the label is relayed;
    • never the Pod’s name, namespace or UID, another owner, an annotation, another label, managedFields, the spec or the environment.
  • Audit-report store — seven routes under /v1/audit-reports, relayed to the store listener in the gateway Pod’s agent-api-auth container. The broker presents its kubeagents-audit-report-store token, read fresh on each call. A body over 1 MiB is refused, no token or body is logged, and the exec tier doesn’t serve these routes. A run’s run-start record rides the run read and write under the reserved name runs/started-<run id>, decided as a run write, never stamped, and refused on every other route. On a run write the broker sets X-Report-Writer from the caller it verified (shell, or builtin-schedule:<audit>:<task>) and drops any copy a caller sends. The two report reads answer that header back only while it matches the stored bytes. Three roles reach them:

    • a profile worker reads every stream when its task credential’s profile is in CREDENTIAL_PROXY_REPORT_PROFILES (fleet-audit,platform). It writes only with a builtin trigger named schedule/<audit> whose stream is the audit it writes, and only to the repository the audit publishes to, or no_forge%2Flocal when there is none, apart from the declared-intent record below. Of run-start records it writes only its own run’s: the run id must be its verified task credential’s task claim (audit-report.run-start-task otherwise). The store orders those records by its own receipt time, never the writer’s clock. One with no task credential is refused;
    • with that list set, a worker whose profile isn’t on it reads only its own builtin schedule’s stream, on the key below, with that schedule’s trigger, never the stream list (audit-report.own-stream-route). It writes under the rule above;
    • the sandbox’s shell reads every stream and writes the key the audit publishes to (or no_forge%2Flocal) or any repository registered in managed_repos, as it writes today’s file store directly;
    • the A2A gateway’s report reader, with its kubeagents-credential-proxy-a2a-reports audience, reads one finished report of any audit, GET /v1/audit-reports/<audit>/publish/latest or GET .../publish/runs/<ts>, on the key the audit publishes to (or no_forge%2Flocal) alone. It sends the word publish in place of the key, and the broker relays the request with the publish key in its place. Any real key from it is refused, the publish key spelled out included. The broker resolves publish for this role only. It never lists the streams, reads a run index, writes or deletes. Only that audience, from the A2A gateway’s ServiceAccount, gives this role, and the role reaches no other route. The broker redacts credential shapes from what it reads, as for a profile worker.

    A run’s declared-intent record rides the run routes too, as runs/declared-<run id>. A profile task writes it only when its task credential’s report_run claim names that run and audit. It writes only to the repository the audit publishes to, or no_forge%2Flocal. The record is never stamped, the shell and the A2A report reader write none, and nothing issues the claim yet.

    A run’s state and report records ride the run routes as runs/state-<run id> and runs/report-<run id>. Each write is decided as a run write first. Then a profile task writes only its own run’s records, named for its verified credential’s task claim. The shell writes only the one-time seed’s, state-seed and report-seed. Any other name is refused with audit-report.run-record. Neither record is stamped, and the A2A report reader writes none.

  • Pub/Sub platform adapter — four subscription calls (read, pull, acknowledge, modifyAckDeadline) under /v1/pubsub/gcp/, presented with the gateway’s kubeagents-credential-proxy-chat audience and confined to the subscriptions the operator renders from the AgentPlugin configs.

Guarantee: the operator places no managed credential in the <name>-shell Pod’s environment, root filesystem, persistent data volume, or ServiceAccount token path. Its ServiceAccount carries no iam.gke.io/gcp-service-account annotation, so the metadata server answers it with a principal IAM grants nothing. That is the Pod that runs everything the model wrote.

spec.deployment.env goes to the credential broker because it may contain credentials. Only a short allowlist reaches the agent, as literal values only. It holds the OpenTelemetry settings, EOD_EXCLUDE_NAMESPACES, the ALERT_DAILY_LIMIT_* alert ceilings, the FEEDBACK_PROMPT_* switch and delay, and the four findings pacing limits (FINDINGS_DAILY_CRITICALS, FINDINGS_FIRST_REPORT_CRITICALS, FINDINGS_NONCRITICAL_AFTER_HOUR, FINDINGS_NONCRITICAL_MAX). It also holds the five leeway-watch alert thresholds (LEEWAY_WATCH_MIN_SEVERITY, LEEWAY_WATCH_MIN_DRIFT, LEEWAY_WATCH_MIN_MAX_DOMAIN_SHARE, LEEWAY_WATCH_MIN_EXCESS_OVER_FLOOR, LEEWAY_WATCH_REFRESH_DAYS), the INCIDENT_WORKLOAD_DEDUP_SECONDS window, the INCIDENT_TRIAGE_OPEN_PULL_REQUEST switch and its INCIDENT_TRIAGE_MAX_OPEN_PULL_REQUESTS limit, the KUBEAGENTS_ROSTER_SUMMARY_THRESHOLD roster count, and the KAGE_SLACK_UX flag. The BOOTSTRAP_MAX_CREATES_PER_TICK reconcile create cap, the two idle thresholds, CRON_IDLE_HIBERNATE_DAYS and CRON_IDLE_THROTTLE_DAYS, the CRON_CATCH_UP_STAGGER_MINUTES catch-up step, the POST_MERGE_READS_PER_TICK read cap and the KUBEAGENTS_EVAL_RUN_TAGS eval switch reach it the same way.

Two names go the other way and reach the <name>-shell Pod, not the agent. KUBEAGENTS_AUDIT_AUTO_PROMOTE, the fleet audits’ auto-promotion switch, is normalised by the operator to true or false. KUBEAGENTS_KUBECTL_COST_TIER, the column of the shell’s kubectl cost table, is passed only as a lowercase word. The tier also goes, normalised the same way, to the A2A gateway as A2A_KUBECTL_COST_TIER, and from the gateway to the session Pods it starts under the cluster view as KUBEAGENTS_KUBECTL_COST_TIER, since their kubectl runs the same admission.

Literal HTTP_PROXY, HTTPS_PROXY, NO_PROXY, http_proxy, https_proxy, and no_proxy entries in spec.deployment.env also forward to <name>-a2a-gateway; valueFrom entries are ignored. The gateway’s in-cluster Kubernetes API clients and its Google Chat and Teams relay clients bypass those proxy variables. With spec.proxy set, none of those entries reaches the broker or the gateway.

Three names reach both Pods, each as a file the operator owns: the earned-autonomy switches KUBEAGENTS_POST_MERGE_CHECK (off, silent or report), KUBEAGENTS_AUTOMERGE (off, practice or on) and KUBEAGENTS_DIAL (off or on). Each is off when unset, and any other value reads as off. The agent gets them pinned in its managed .env, every switch on every render, so a line the agent writes into the PVC .env cannot turn one on. The <name>-shell Pod’s entrypoint writes each to a root-owned file under /run/kube-agents-sandbox/. agents/platform/scripts/kubeagents_switches.py, their reader in both Pods, takes those files before the variable.

KUBEAGENTS_POST_MERGE_CHECK, when not off, makes the agent record each fleet-audit no-pdb fix pull request it opens for the post-merge check (silent and report record alike). The post-merge-check cron job follows each to a stored outcome; report also comments it once on the fix pull request, and a failed run posts to chat.

automation_rules.py reads KUBEAGENTS_AUTOMERGE. KUBEAGENTS_DIAL, when on, also reaches the credential broker through spec.deployment.env, where it makes the autonomy dial a second source for the write mode (Explain-only mode). The credential broker reads KUBEAGENTS_AUTOMERGE from the same copy of spec.deployment.env, unnormalised, so any value but practice or on reads as off there too, before it applies an auto-merge label. Session-kv’s dial_state.py reads KUBEAGENTS_DIAL and runs automerge_switch.py, which also reads it and refuses to run without it.

The gateway Pod holds no cloud identity. The broker Pod runs as the Workload Identity-annotated ServiceAccount (spec.security.serviceAccountName, kubeagents-platform-agent by default), and the gateway Pod runs as <name>-gateway-agent, which the operator mints with no annotation. GKE resolves Workload Identity by the Pod’s ServiceAccount, so the gateway’s metadata server has no Google service account to answer for, and the gateway’s NetworkPolicy no longer opens the metadata path at all. Everything in the gateway that called Google — the remote MCP servers, the event watcher, the drift detector and the Pub/Sub platform adapter — goes through the broker. spec.security.workloadIdentityFederation remains optional hardening for the broker’s own credential.

The Pub/Sub platform adapter pulls through the broker too. The pubsub-platform AgentPlugin runs in the gateway Pod, so it holds no Google credential. It reads its subscriptions through the broker’s Pub/Sub relay, which the operator confines to the subscriptions the AgentPlugin configs name, qualified with the harness project; the broker refuses any other subscription and every other Google API on that route.

The operator fills the relay URL on the gateway and the subscription set on the broker only when at least one plugin route names a subscription it can qualify. That means a full projects/<project>/subscriptions/<name> path, or a short subscription or topic name on an agent with a harness project. With no such route the URL is rendered empty rather than left out, so a plugin cannot supply its own, and the adapter does not connect.

The sharing that made this a container-boundary problem is gone. The broker is not in a Pod with anything that runs model-authored code, so there is no shared network namespace, no shared process namespace, and no shared writable volume. docs/security-requirements.md tracks the requirement formally.

The agent now holds a credential, and that was a choice

Section titled “The agent now holds a credential, and that was a choice”

The platform-agent container mounts the broker-audience projected token, so the model can read it. A prompt-injected agent gains no new authority inside the Pod, because it could already reach the broker. What it gains is exportability: the token is a file, and a file can be exfiltrated, after which an outside party has broker access — bounded by the command policy — until the token expires.

Against the credential requirements this token is short-lived, audience-bound and independently revocable, but not non-exportable, and that last clause is the one it misses.

There is a second file with the same property, the a2a-bus token. It is bounded more tightly than the broker’s: the bus resolves it through an auth callout to the agent principal, whose grants are the topic blackboard and nothing else. There is no task plane in either direction, and no JetStream consumer verb at all, so an exfiltrated copy cannot ask the server to deliver a stream anywhere. It replaced a shared static password, which was neither short-lived nor bound to this workload.

An alternative was considered and deferred. agent-api-auth is already a credential-holding container in the agent Pod, on loopback, at a different UID, with no volumes the agent can read. A mirror image of it — an egress forwarder that holds the token, listens on 127.0.0.1:8765, and attaches the credential on its way out to the broker Service — would preserve “the agent holds no credential at all”. It is not built because it is a new component with its own failure modes and lifecycle, and nothing forecloses it: the client’s authorization_headers() would return nothing and the forwarder would supply the header instead.

Everything the agent executes — the wrappers, execute_code, and the file tools — runs in a <name>-shell StatefulSet reached over SSH. This is not optional: spec.harness.experimental.shellSandbox.enabled: false is refused with Degraded/ShellSandboxCannotBeDisabled and changes nothing about the running workload. docs/designs/agent-shell-sandboxing.md is canonical.

spec.security.workloadIdentityFederation is the optional hardening on top. With it, the broker takes its cloud identity from an audience-scoped projected token mounted in its Pod alone. The token is exchanged through Workload Identity Federation, whose credential source is a file path rather than the metadata server, for an impersonation of the existing Google service account. Without it the broker takes its cloud identity from the metadata server, which answers for the annotated ServiceAccount the broker alone runs as. The design doc has the one-time pool setup, which no install surface performs.

spec.security.egressPolicy: Allowlist renders one NetworkPolicy on the agent Pod: default-deny egress, with rules for a fixed set of destinations and whatever spec.security.egressAllowlist adds. The fixed set is DNS, the credential broker, LiteLLM, the namespace of the OpenTelemetry collector the agent resolved, the Hindsight memory API, and the A2A NATS pods on TCP 4222. The collector is the managed one by default, and there is no rule when the endpoint names nothing in-cluster. The metadata server’s credential API is denied by not appearing on that list.

The DNS rule is the one place a metadata address does appear, on port 53 alone. On a cluster using Cloud DNS for GKE the node answers DNS at 169.254.169.254:53 and every Pod’s resolv.conf names it. Withholding it would leave the Pod with no name resolution, and every destination in this allowlist is reached by name. The token is minted over TCP 80 pre-NAT and 988 post-NAT, and no rule permits this address on either. (TCP 80 is permitted to the LiteLLM Pod selector, which no link-local address matches.)

The peer does widen one thing, on one kind of cluster. Where CoreDNS forwards externally — the stock configuration — it grants nothing the k8s-app: kube-dns peers above do not already grant, since those resolve arbitrary external names. Where an administrator has removed that forwarding to close DNS as an exfiltration path, this peer hands the Pod the node’s GCE recursive resolver and reopens it. GKE’s metadata interception rewrites TCP 80 and 8080, not 53, so the address answers DNS there on any GCE node not running gke-metadata-server or metadata concealment. If that describes your cluster, the peer is the one part of this policy to weigh rather than accept.

Turning this on does not take any egress away from the agent Pod. It cannot. Adding a NetworkPolicy is a monotone operation: policies selecting one Pod are unioned, the Pod may send whatever any of them permits, and the API has no deny rule at all. The agent Pod is already selected for egress by <name>-gateway-netpol, which the operator renders on every reconcile whether or not you set this field. So with the flag on the Pod’s permitted egress is a strict superset of what it was with the flag off.

In the default shape it adds the credential broker on TCP 8765 and, when the agent is not exporting telemetry, the managed collector namespace on 4317/4318. The gateway policy renders its own OTel rule only while there is an endpoint to export to. This one keeps gke-managed-otel on a cluster that resolved to no collector, so that exports are not blocked the moment a collector appears there. With an endpoint, both policies read the namespace off it and name the same one.

That holds wherever another policy still permits the wider egress, which is every install shape but one. spec.networkPolicy.enabled: false stops the operator rendering <name>-gateway-netpol at all and deletes one it owns. With the field false, this policy really is the only one selecting the agent Pod, and on an enforcing CNI it then default-denies for real. That denies the metadata server, but also GitHub, web search, external 443 and everything else not on the allowlist. Everywhere else it is a property of the API, not of a particular cluster.

What <name>-gateway-netpol already permits, and this therefore cannot remove:

  • No metadata path: it names 169.254.169.254/32 on port 53 only, as this policy does, for the Cloud DNS reason above. The rules that used to admit TCP 80 and the metadata-daemon port went with the gateway’s Workload Identity.
  • TCP 443 to 0.0.0.0/0 minus the private ranges, unless FQDNNetworkPolicy is enabled. Every HTTPS destination on the public internet stays open, and with it the exfiltration half of what this is meant to be.

The gateway policy no longer permits the metadata path: the gateway holds no Google identity to fetch a token for. The overlap that remains is its TCP 443 rule to 0.0.0.0/0 minus the private and link-local ranges, which the allowlist does not subtract while that rule stands.

So what is it for today? Two things, neither of them enforcement. It renders an auditable statement of the destinations the agent is supposed to need, as an object you can diff and a reviewer can read. And it settles the field, the refusal rules and the reconcile behaviour now, so that narrowing the gateway policy later is a one-policy change rather than a new feature. If you were planning a capability-impact review before enabling this, you do not need one yet; what it will cost says when you will.

The complementary control, removing the identity rather than the route, is in place: neither the gateway’s ServiceAccount nor the <name>-shell Pod’s carries an iam.gke.io/gcp-service-account annotation, so neither has a Google service account to mint, whatever the CNI enforces.

None of these is enforced by the operator. The broker always runs outside the agent Pod, so the field has no prerequisite to refuse.

  1. The cluster CNI must enforce NetworkPolicy, and the operator cannot tell whether it does. An unenforced policy is accepted, stored, and returned by kubectl get exactly like an enforced one; there is no field, condition or event to read. GKE Autopilot and GKE Dataplane V2 always enforce. A GKE Standard cluster created without network policy gets a no-op.
  2. No other policy may widen it, which is the point above and also applies to anything an administrator adds later. Nothing detects that.
  3. The allowlist has to stay complete, and it deliberately is not — see what it will cost. Every gap is pressure toward a broader rule.

Refused means not reconciled, not stopped. On a new agent those are the same thing — no Deployment is created. On an agent that is already running, the existing Pods keep running exactly as they were, with metadata access, and every subsequent change to the resource is ignored while the operator retries every 30 seconds. The refusal protects you from believing you have the control; it does not take the workload down to make the point. kubectl describe platformagent is where you find out.

One refusal reason remains. EgressAllowlistRefused still renders the policy, minus the destinations it refused. The objection is to one value, not to the control, so the guardrail keeps being reconciled (delete it and the next pass puts it back) while the status stays Degraded until the spec is fixed.

Setting egressPolicy: None does not delete the policy. The operator will not remove a guardrail it may not have created, so <name>-sandbox-metadata-deny stays in the namespace after the field goes off. On its own that is fail-closed and fine: the Pod it selects keeps a door shut that nothing is asking to open.

To remove it, two steps in order:

  1. Set egressPolicy: None.
  2. kubectl -n NAMESPACE delete networkpolicy NAME-sandbox-metadata-deny. This is safe only after step 1 — delete it while the field still says Allowlist and the next reconcile puts it straight back.

There is no ordering to get wrong beyond those two steps: the broker cannot come back into the agent Pod.

Two things to verify on the cluster, neither of which the operator can check for you:

  • Does the CNI enforce NetworkPolicy? gcloud container clusters describe CLUSTER --format='value(networkPolicy.enabled,networkConfig.datapathProvider)'. Autopilot and Dataplane V2 always do. A GKE Standard cluster created without network policy gets a policy object that enforces nothing.
  • Does the cluster run NodeLocal DNSCache, and does DNS still resolve after enabling? This one can take the agent down. NodeLocal DNSCache runs with hostNetwork, so on Cilium and Dataplane V2 its traffic carries a host or remote-node identity. Neither the k8s-app: node-local-dns Pod selector nor the 169.254.20.10/32 CIDR peer in the rendered rule is guaranteed to match that, because CIDR peers do not select node identities unless policy-cidr-match-mode includes nodes, which is off by default. Both peers work on an iptables dataplane, which is why both are rendered.
    • The rule also carries the resolved cluster DNS ClusterIP, for the dataplanes that match the Service VIP instead, and 169.254.169.254/32 for Cloud DNS for GKE.
    • If neither peer matches, DNS is blocked outright and every destination in the allowlist becomes unreachable, because they are all reached by name. Check with kubectl -n kube-system get ds node-local-dns first, and after enabling confirm resolution from the agent container before trusting the policy.

What it will cost, once it does block something

Section titled “What it will cost, once it does block something”

None of this happens today — with the one exception above: an install running spec.networkPolicy.enabled: false on an enforcing CNI pays this whole bill the moment the flag goes on. Everywhere else, every destination below is one <name>-gateway-netpol still permits to the same Pod, so you can enable the flag and observe no behaviour change in either direction. This is the bill that falls due once the gateway policy is narrowed, and it is here so that the narrowing is not a surprise.

At that point the allowlist covers DNS, the broker, LiteLLM, the OTel collector, the Hindsight memory API and the A2A NATS pods. The DNS rule carries selector peers, the resolved cluster DNS ClusterIP, and the Cloud DNS resolver, the same ladder the gateway policy renders. Everything the agent container reaches on its own would go away:

  • DuckDuckGo web search, which deploy/shared/defaults/config.yaml turns on for every profile (web.backend: ddgs), and the browser toolset on any profile that does not disable it (the Chat, Platform and Cluster Agents all do, through agent.disabled_toolsets). The toolset needs an image built with a browser; the agent image ships none;
  • github.com reached directly from the sandbox — not the version-control verbs, which go through the broker;
  • the metadata lookup in cluster_agent_reconcile.py, which is how that script finds the management project (RECONCILE_PROJECT, the old override, is pinned empty in the managed .env; a project other than the pod’s belongs in spec.scope.projects). It fails soft after a five-second timeout and falls back to gcloud config get-value project, a broker call that is on the allowlist. So the cost is the timeout on each tick, provided the broker’s configured project is the pod’s own. A fallback answer that differs from the previous run’s management project is treated as unresolved rather than as a changed management project.

Credentialed gcloud and kubectl, the version-control verbs, and the gke and developer_knowledge MCP servers would be unaffected either way: they call the broker, and the broker is on the list.

None of that would be accidental. Unrestricted egress from a container that searches the web, or drives a browser on an image built with one, is the exfiltration path, so the capabilities this would remove are the same ones that make the control worth having. Weigh it as a trade rather than a regression, when it arrives.

spec.security.egressAllowlist.extraRules takes NetworkPolicy egress rules verbatim. Two things to know:

  • NetworkPolicy matches addresses, never DNS names. Restoring a hosted service means naming its published address ranges and keeping them current.
  • A rule whose ipBlock contains a metadata address is dropped, not narrowed. That includes 0.0.0.0/0 with an except clause naming the metadata server — see below for why an except clause is not a block. To grant broad egress you have to carve the ranges around 169.254.169.252 and 169.254.169.254 yourself, in the spec, where a reviewer can see it.

spec.security.egressAllowlist.controlPlaneCIDRs is separate because there is no NetworkPolicy peer for “the Kubernetes API server”. On GKE the control plane is not a Pod and not in the cluster, and the in-cluster kubernetes Service address is translated to it before policy is evaluated. Left empty the rule is absent and nothing in the agent Pod can reach the API, which matters to any sidecar or plugin you added that talks to it. Find the range with gcloud container clusters describe CLUSTER --format='value(privateClusterConfig.masterIpv4CidrBlock,endpoint)'.

Why it is default-deny rather than “allow everything except the metadata server”

Section titled “Why it is default-deny rather than “allow everything except the metadata server””

The obvious shape — one broad rule with the metadata address in an except clause — is what this repository shipped once before, and it is unsound twice over on GKE:

  • On GKE Dataplane V2 it is a near-total outage, not a permissive rule. Google’s documentation states that Pod traffic is never covered by an ipBlock rule, so a policy whose only peer is 0.0.0.0/0 permits no Pod-to-Pod traffic at all — not kube-dns, not LiteLLM, not the broker.
  • On an iptables dataplane the except clause names an address the policy never sees. A request to 169.254.169.254:80 is translated to the node-local metadata server at 169.254.169.252:988 in NAT PREROUTING, before the filter rules run. This is kubernetes/kubernetes#68078, open since 2018 and titled “Network policy not properly blocking GKE metadata IP”.

Default-deny sidesteps both: it names Pods with selectors rather than CIDRs, and it does not have to predict which address the request was rewritten to, because no rule permits either address on a port the token can be minted over. For the same reason all three metadata addresses — 169.254.169.254, 169.254.169.252 and the IPv6 fd20:ce::254 — are refused in extraRules, on every port. The DNS rule’s port-53 grant to 169.254.169.254 is the operator’s alone; extraRules cannot widen it. spec.networkPolicy.additionalEgress is a separate matter — it appends to the gateway policy over the same Pod and is bounded by prefix width rather than by destination, so it can reach a metadata address. See Security and IAM.

It is also why this is one policy object and not two. There is no deny rule in NetworkPolicy, so a separate “everything except metadata” policy would not subtract the metadata server from an allowlist. It would add the internet to it.

Every brokered CLI reports credential proxy unavailable. The gcloud command inside <name>-shell, session pods and AgentProfile workers is a wrapper that forwards to the broker Service. So is kubectl on a worker not routed through <name>-kube-proxy. kubectl in <name>-shell and session pods talks directly to <name>-kube-proxy, and a routed worker’s through its own loopback. When nothing is listening on the broker, wrapper calls fail the same way:

credential proxy unavailable: [Errno 111] Connection refused

This is an availability problem rather than an authentication one — a rejected credential comes back as an HTTP error, not a refused connection. The broker is a Pod of its own, so the message means it has no ready endpoint. Check the endpoint first and the events second:

Terminal window
kubectl get endpoints -n kubeagents-system platform-agent-credential-proxy
kubectl describe pod -n kubeagents-system -l app=platform-agent-credential-proxy
kubectl logs -n kubeagents-system deploy/platform-agent-credential-proxy

If the endpoint is there and the broker is healthy, the sandbox Pod is the next place to look — the shims run there, over SSH from the gateway:

Terminal window
kubectl get pods -n kubeagents-system -l app=platform-agent-shell
kubectl logs -n kubeagents-system platform-agent-shell-0

A proxied command prints CREDENTIAL_PROXY_EXEC_URL ignored (…); commands go to the stateful broker. The sandbox has an exec-tier URL that the shim cannot use: it is not a valid http:// URL, it has no host, its port is not a number from 0 to 65535, or it has a query or a fragment. The shim ignores it, and the command runs on the stateful broker as on an install without the exec tier. The operator sets this variable, so check the operator version and the sandbox’s environment.

A proxied command fails with credential proxy error: the connection dropped after the request was sent …; the command may have run. The connection to the broker closed after the command was sent and before its answer came back, for example because the broker Pod restarted. The shim does not send the command again, because the broker may have run it. Check what the command changed before you run it again: a kubectl get is safe to repeat, but an apply or a delete may already have taken effect.

A 401 from every proxied command is the other half of the same path, and it is authentication rather than availability. The broker verifies an audience-bound projected token with a TokenReview, so a 401 means the token was absent, expired, minted for another audience, or presented by a ServiceAccount that is not in CREDENTIAL_PROXY_ALLOWED_CALLERS. The broker’s log names the reason; the caller never gets it.

A proxied command fails with credential proxy error (HTTP 200): …; the command may have run. The broker answered that the command ran, but the shim could not use the answer. It was not JSON, not a JSON object, a field of it was missing or had the wrong type, or its exit code was outside -127 to 255. The line names which, and prints nothing of the answer. The shim does not send the command again. Check what the command changed, as for a dropped connection; if it repeats, look at what sits between the sandbox and the broker. A command that a signal ended is not this case: the shim prints its output and exits with 128 plus the signal’s number, as a shell does (137 for SIGKILL).

A proxied command fails with one of the admission messages: the credential proxy is at its limit of 8 concurrent commands …, the credential proxy is at its child memory budget (… MiB in use of … MiB: …) …, the credential proxy's admission queue is held by requests waiting for its child memory budget (…) …, the credential proxy keeps … of its … admissions for interactive work …, the credential proxy keeps one of its … admissions for background work … or the profile role is limited to … concurrent command(s) through the credential proxy (CREDENTIAL_PROXY_PROFILE_SLOTS) …. The sandbox’s wrappers retry these by themselves, as described below. The broker admits a bounded number of commands at once, and the rest of this entry says what bounds them.

The slot cap is CREDENTIAL_PROXY_MAX_CONCURRENT_COMMANDS (8 on default and fixed profiles; 8 on small, 12 on medium, 16 on fleet under sizingProfile: auto). Within that, the broker admits only as many as fit a memory budget it derives from its container’s memory limit, because each command is a child process that the limit has to hold. A child is about 100 to 120 MiB for gcloud, or kubectl with its auth plugin.

At the operator’s default 2Gi limit the budget admits ten at once, so the slot cap of eight binds. Under auto, 4Gi (medium) admits 22 (1792 MiB headroom at 12 slots) and 8Gi (fleet) admits 45 (5184 MiB headroom at 16 slots).

Each request has a class: profile workers’ and the scope publisher’s are background, and every other caller’s are interactive. Background work holds at most the admitted count less two, in slots and in budget room, so on a pod that admits three or more, interactive commands always find two admissions. Interactive work holds at most the admitted count less one, so background work always finds one. Profile workers’ calls together also hold at most CREDENTIAL_PROXY_PROFILE_SLOTS (4 by default, never more than the background share), and one past that is refused at once.

Inside a class requests are admitted in arrival order, and interactive requests go ahead of queued background ones. A forge credential refresh, which takes no slot, also passes commands waiting only for a slot when it fits the budget. A request still waiting after a minute is refused with a 503 rather than run. Long-running brokered commands hold their admission for as long as they run. At the defaults seven of them from interactive callers hold everything interactive work may take, and an eighth waits for one to finish.

The broker’s log shows the queueing (request waited … for a slot, … for memory budget, or … for the background share and … for the interactive share) and the refusal (command queued too long, or … credential refresh queued too long for a refresh), each followed by the refusal’s text, which the refresh client also reports after the HTTP code. A refresh refused on the refresh lock says … waited 60s for another refresh to finish, and one that stepped aside for a vcs request’s refresh says so with the time it spent. The broker’s startup line says how many requests the budget admits.

The broker CLI wrappers (gcloud, plus kubectl on an AgentProfile worker not routed through <name>-kube-proxy) retry a refusal at the slot cap, the memory budget, a class share or the profile share by themselves, up to four more times. Each retry follows a jittered wait of about 2, 4, 8 and 16 seconds at most (or a Retry-After the reply carries, held between 2 and 30 seconds) and prints one stderr line. A refusal at the slot cap, the memory budget or a class share comes after a 60-second queue, so the wrappers stop after about two minutes rather than outlive the terminal tool’s 180-second limit.

The version-control skill’s broker calls retry on the same schedule, but only a refusal the broker marks as given before it admitted the request, when nothing has run. A refusal from the forge itself, its rate limit among them, is never retried.

A command still refused when the retries run out fails with credential proxy throttled: gave up after … attempts; run it again later. The per-role caps (the session role is limited to …, and the scope publisher’s) are not retried, because they are the caller’s own limit; wait for one of its commands to finish.

The budget follows the container’s memory limit, which spec.deployment.credentialProxy.resources moves. A limit under 544Mi, at which the budget would admit fewer than two requests at once, turns the budget off: the broker logs a WARNING at startup naming the limit it read and admits by the slot cap alone. On GKE Autopilot without bursting a container’s limit equals its memory request. There the proxy’s limit is the operator’s Autopilot request, 2Gi, so the budget admits the same ten, held to eight by the slot cap; a requests.memory override under 544Mi turns it off there.

How often commands queue, for how long and behind which bound, and how many are refused, are series on the broker’s metrics listener. kubeagents_credential_proxy_admission_wait_seconds, kubeagents_credential_proxy_admission_refusals_total, and the slot and budget gauges beside them (Observability names them) are where to read the queue before reaching for the log.

A proxied command fails with the credential proxy is at its hard resource watermark (memory=… tmp=…) and is admitting interactive sessions only …, and the broker answered 429 with Retry-After. Beside the budget above, the broker reads what its container holds now: on every admission, the cgroup’s working set (usage less inactive file cache) against its limit. Every 30 seconds it sums its state and /tmp volumes against the caps in CREDENTIAL_PROXY_STATE_LIMIT_BYTES and CREDENTIAL_PROXY_TMP_LIMIT_BYTES: each volume’s sizeLimit, or its share of an ephemeral-storage limit set under the two together. From 75% of memory or 70% of a volume (CREDENTIAL_PROXY_MEM_SOFT_PCT, CREDENTIAL_PROXY_DISK_SOFT_PCT) it runs one command at a time and frees idle scratch. From 85% or 80% (CREDENTIAL_PROXY_MEM_HARD_PCT, CREDENTIAL_PROXY_DISK_HARD_PCT) it refuses background callers at once with 429 CREDENTIAL_PROXY_RESOURCE_PRESSURE, Retry-After (5 to 30 seconds) and retry_after in the body.

One slot stays open to chat session pods up to 92% memory or 90% disk, beside the one command the clamp lets background work run. The class is the caller’s authenticated role; nothing a command sends changes it. The refusal’s text names the interval (retry in 17 s); the sandbox’s wrappers wait it out and retry, as for the 503 above. The log shows the crossing (resource watermark normal -> hard (memory=86% …)), the relief (resource watermark relief: …) and each refusal (command refused under resource pressure). kubeagents_credential_proxy_resource_watermark_ratio carries each resource’s fill, and the refusals counter counts these under bound="pressure". A gate that trips at rest means the volumes or the memory limit are undersized for the fleet. Raise spec.deployment.credentialProxy.resources (a larger ephemeral-storage limit widens the state volume), or set the percentages through spec.deployment.env.

A proxied command fails with BROKER_LOOP_BREAKER: identical command failed or was blocked 5 consecutive times in this session; stop retrying this command and report the refusal/error. The broker CLI wrappers send the run’s key as the request’s sessionId: a kanban card, a scheduled job’s run, or a session pod’s session. They are gcloud, plus kubectl on an AgentProfile worker not routed through <name>-kube-proxy. In the shell sandbox the first two come from the command’s working directory; a chat turn sends no key and is not counted. When one keyed run sends the same command, on the same cluster, and it fails or is refused five times running, the sixth and every later one is refused without running. It counts as blocked, rule session.loop-breaker, printed as a policy block.

A different command still runs and is counted on its own, so a loop over two failing commands is refused each of them at its sixth call. The broker keeps a run’s last 8 failing commands, and any success of the run clears the counts. BROKER_SESSION_MAX_IDENTICAL_FAILURES in spec.deployment.env moves the count; 0 turns it off.

A kanban card’s key is the card id, so its streak carries into the card’s next dispatch. A card re-dispatched after five failures of one command is refused that command until another of its commands succeeds, the broker restarts, or the card leaves the broker’s last 1024 keys.

A proxied command fails with BROKER_SESSION_BUDGET_EXCEEDED: session exceeded 1500 tool invocations; summarize current findings and finish the turn. A keyed run of the shell or profile role sent more than BROKER_SESSION_MAX_TOOL_CALLS commands (1500 by default). A policy refusal counts as a command. A busy answer does not: the wrapper re-sends the command, and the retries are one invocation. A conversation is never held: a chat turn in the shell sandbox carries no key, and the session pod’s role is exempt; the scope publisher, a script, sends none.

The refusal counts as blocked with rule session.tool-budget. Each replica counts alone, so N exec-tier replicas admit about N times the ceiling. A request without a sessionId, such as a collector run by hand, is never counted; one a card or scheduled run launches inherits the key. Raise the variable in spec.deployment.env, or set 0 to turn the ceiling off.

A scheduled run’s key names one execution, so its count ends with the run. A kanban card’s key is the card id, so the count spans every dispatch of the card on a replica. A card past the ceiling is refused on its next dispatch too, until the broker restarts or the card leaves the last 1024 keys.

Cloud diagnostics inside the sandbox fail while the broker is down. The gcloud wrapper is the only gcloud the sandbox has, so cloud commands inside <name>-shell return the same connection error (kubectl talks separately to <name>-kube-proxy). Test the broker’s cloud identity from a throwaway Pod using the same ServiceAccount:

Terminal window
kubectl run wi-check -n kubeagents-system --rm -it --restart=Never \
--image=google/cloud-sdk:slim \
--overrides='{"spec":{"serviceAccountName":"kubeagents-platform-agent"}}' \
-- gcloud auth print-access-token

The credential-proxy container restarts and its log ends without an error. Read the previous container’s exit first:

Terminal window
kubectl get pod -n kubeagents-system -l app=platform-agent-credential-proxy \
-o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.containerStatuses[*].lastState.terminated}{"\n"}{end}'

OOMKilled with exit code 137 is the kernel killing the container for its memory limit. On cgroup v2 the kubelet arms the group kill, so one child over the limit takes the broker, Envoy and every command in flight with it, and the log stops mid-request. The broker’s memory high-water and memory limit reached lines before the stop say what the container held and which process held it; largest child so far names the biggest child (the first such line is the startup command, bootstrap). The same figures are series on the metrics listener (Observability).

A kubectl child in the hundreds of MiB is a listing of a large cluster. The tool builds the whole list before it prints. The image’s kubectl held 432 MiB listing 4,000 pods as JSON and 1.3 GiB as YAML, where the budget charges 128 MiB per request for the child (176 MiB with its output allowance). Size spec.deployment.credentialProxy.resources.limits.memory for every concurrent command (8 on fixed/default profiles; 8 small, 12 medium, and 16 fleet under sizingProfile: auto), or pick a sizingProfile row that fits. Add the 192 MiB reserve for the broker and Envoy. The 2Gi default holds eight requests of 176 MiB, not eight of 500 MiB.

Any other exit is named by the container’s PID 1 as start-services: … exited with status … or … was killed by signal …, the line its PID 1 writes before the container ends. A stop the kubelet sent to the container (a rollout, an eviction, a drain) reads … stopped by signal 15 … instead.

The broker exits during startup. The credential runtime runs CREDENTIAL_PROXY_BOOTSTRAP_COMMAND before it begins serving, and a non-zero exit stops the container, so the Deployment never has a ready endpoint. The command’s stdout and stderr go to the container’s log. Bootstrap failures usually mean the Pod cannot reach the cluster or mint a token; see Security & IAM for the Workload Identity binding it depends on.

Another cause is a universe domain mismatch. The log then ends with credential proxy failed to start, and the record says that the universe domain in the broker’s environment differs from the domain the metadata server reports. A broker that started before the metadata server answered ends later with credential proxy stops serving and the same text. Set spec.harness.universeDomain to the reported domain, or omit it.

  • Security & IAM — Workload Identity, the GCP permission sets, and the read-only Kubernetes RBAC.
  • Token minter (Minty) — short-lived GitHub App tokens via KMS.
  • Full design doc — scope, deny policy, migration, and CI verification assertions.